test bulk delete products (#3633)
* wip * bulk delete 2 products * removed unused helper * added TC number
This commit is contained in:
parent
70c7f3a2f8
commit
cf4adbc1af
9 changed files with 86 additions and 18 deletions
70
cypress/e2e/products/productsList/deleteProducts.js
Normal file
70
cypress/e2e/products/productsList/deleteProducts.js
Normal file
|
@ -0,0 +1,70 @@
|
|||
/// <reference types="cypress"/>
|
||||
/// <reference types="../../../support"/>
|
||||
import faker from "faker";
|
||||
|
||||
import { BUTTON_SELECTORS, PRODUCTS_LIST } from "../../../elements/";
|
||||
import { DIALOGS_MESSAGES } from "../../../fixtures/";
|
||||
import { urlList } from "../../../fixtures/urlList";
|
||||
import { getDefaultChannel, productsUtils } from "../../../support/api/utils/";
|
||||
import { ensureCanvasStatic } from "../../../support/customCommands/sharedElementsOperations/canvas";
|
||||
|
||||
describe("Test for deleting products", () => {
|
||||
const startsWith = "AABulkDeleteCypress";
|
||||
const name = `${startsWith}${faker.datatype.number()}`;
|
||||
const name2 = `${startsWith}${faker.datatype.number()}`;
|
||||
let channel;
|
||||
let product;
|
||||
|
||||
before(() => {
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
productsUtils.deleteProductsStartsWith(startsWith);
|
||||
getDefaultChannel()
|
||||
.then(channelResp => {
|
||||
channel = channelResp;
|
||||
productsUtils.createTypeAttributeAndCategoryForProduct({ name });
|
||||
})
|
||||
.then(({ attribute, category, productType }) => {
|
||||
productsUtils.createProductInChannel({
|
||||
attributeId: attribute.id,
|
||||
categoryId: category.id,
|
||||
channelId: channel.id,
|
||||
name,
|
||||
productTypeId: productType.id,
|
||||
});
|
||||
productsUtils.createProductInChannel({
|
||||
attributeId: attribute.id,
|
||||
categoryId: category.id,
|
||||
channelId: channel.id,
|
||||
name: name2,
|
||||
productTypeId: productType.id,
|
||||
});
|
||||
})
|
||||
.then(({ product: productResp }) => {
|
||||
product = productResp;
|
||||
cy.checkIfDataAreNotNull({ channel, product });
|
||||
});
|
||||
});
|
||||
|
||||
it(
|
||||
"should delete 2 first products on products grid view - SALEOR_2709",
|
||||
{ tags: ["@metadata", "@allEnv", "@stable"] },
|
||||
() => {
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
cy.visit(urlList.products);
|
||||
// checks two first rows on products data grid
|
||||
cy.clickGridCell(0, 0);
|
||||
cy.clickGridCell(0, 1);
|
||||
cy.clickOnElement(BUTTON_SELECTORS.deleteProductsButton);
|
||||
cy.contains(DIALOGS_MESSAGES.confirmProductsDeletion).should(
|
||||
"be.visible",
|
||||
);
|
||||
cy.addAliasToGraphRequest("productBulkDelete")
|
||||
.clickSubmitButton()
|
||||
.waitForRequestAndCheckIfNoErrors("@productBulkDelete");
|
||||
ensureCanvasStatic(PRODUCTS_LIST.dataGridTable);
|
||||
cy.get(BUTTON_SELECTORS.submit).should("not.exist");
|
||||
cy.contains(name).should("not.exist");
|
||||
cy.contains(name2).should("not.exist");
|
||||
},
|
||||
);
|
||||
});
|
|
@ -1,4 +1,2 @@
|
|||
import { PRODUCT_DETAILS } from "./product-details";
|
||||
import { PRODUCTS_LIST } from "./products-list";
|
||||
|
||||
export { PRODUCT_DETAILS, PRODUCTS_LIST };
|
||||
export { PRODUCT_DETAILS } from "./product-details";
|
||||
export { PRODUCTS_LIST } from "./products-list";
|
||||
|
|
|
@ -8,6 +8,7 @@ export const BUTTON_SELECTORS = {
|
|||
selectOption: "[data-test-id*='select-option']",
|
||||
notSelectedOption: ":not([aria-selected])",
|
||||
deleteButton: '[data-test-id="button-bar-delete"]',
|
||||
deleteProductsButton: '[data-test-id="delete-products-button"]',
|
||||
deleteItemsButton: '[data-test-id="button-delete-items"]',
|
||||
confirmDeleteButton: '[data-test-id="confirm-delete"]',
|
||||
expandIcon: '[data-test-id="expand-icon"]',
|
||||
|
|
|
@ -1,12 +1,4 @@
|
|||
import { ADDRESS_SELECTORS } from "./addressForm";
|
||||
import { BUTTON_SELECTORS } from "./button-selectors";
|
||||
import { PRESETS, SEARCH } from "./presetsAndSearch";
|
||||
import { SHARED_ELEMENTS } from "./sharedElements";
|
||||
|
||||
export {
|
||||
ADDRESS_SELECTORS,
|
||||
BUTTON_SELECTORS,
|
||||
PRESETS,
|
||||
SEARCH,
|
||||
SHARED_ELEMENTS,
|
||||
};
|
||||
export { ADDRESS_SELECTORS } from "./addressForm";
|
||||
export { BUTTON_SELECTORS } from "./button-selectors";
|
||||
export { PRESETS, SEARCH } from "./presetsAndSearch";
|
||||
export { SHARED_ELEMENTS } from "./sharedElements";
|
||||
|
|
|
@ -2,3 +2,4 @@ export { bodyMockHomePage } from "./bodyMocks";
|
|||
export { orderDraftCreateDemoResponse } from "./errors/demo/orderDratCreate";
|
||||
export { urlList } from "./urlList";
|
||||
export { ONE_PERMISSION_USERS } from "./users";
|
||||
export { DIALOGS_MESSAGES } from "./messages";
|
||||
|
|
3
cypress/fixtures/messages.js
Normal file
3
cypress/fixtures/messages.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
export const DIALOGS_MESSAGES = {
|
||||
confirmProductsDeletion: "Are you sure you want to delete 2 products?",
|
||||
};
|
|
@ -1,3 +1,5 @@
|
|||
export { createChannel, updateChannelOrderSettings } from "./Channels";
|
||||
export { createCustomer, deleteCustomersStartsWith } from "./Customer";
|
||||
export { getOrder } from "./Order";
|
||||
export { createDraftOrder, getOrder } from "./Order";
|
||||
export { updateMetadata, updatePrivateMetadata } from "./Metadata";
|
||||
export { getProductMetadata } from "./storeFront/ProductDetails";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export { deleteChannelsStartsWith } from "./channelsUtils";
|
||||
export { deleteChannelsStartsWith, getDefaultChannel } from "./channelsUtils";
|
||||
export { createOrder, createReadyToFulfillOrder } from "./ordersUtils";
|
||||
export { createShipping, deleteShippingStartsWith } from "./shippingUtils";
|
||||
export {
|
||||
|
|
|
@ -23,6 +23,7 @@ export const ProductListDeleteButton = forwardRef<
|
|||
onClick={onClick}
|
||||
icon={<TrashBinIcon />}
|
||||
variant="secondary"
|
||||
data-test-id="delete-products-button"
|
||||
/>
|
||||
</Tooltip.Trigger>
|
||||
<Tooltip.Content side="bottom">
|
||||
|
|
Loading…
Reference in a new issue