Fix tests for attributes in products types (#2269)

This commit is contained in:
Karolina Rakoczy 2022-09-01 15:17:13 +02:00 committed by GitHub
parent c1185198f5
commit 22e78bbd23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 27 deletions

View file

@ -48,7 +48,7 @@ describe("As an admin I want to manage attributes in product types", () => {
.get(PRODUCT_TYPE_DETAILS.assignProductAttributeButton)
.click()
.addAliasToGraphRequest("AssignProductAttribute")
.assignElements(startsWith, false)
.assignElements(startsWith, false, true)
.confirmationMessageShouldAppear()
.waitForRequestAndCheckIfNoErrors("@AssignProductAttribute");
getProductType(productType.id);
@ -71,11 +71,12 @@ describe("As an admin I want to manage attributes in product types", () => {
productTypeDetailsUrl(productType.id),
)
.get(PRODUCT_TYPE_DETAILS.hasVariantsButton)
.should("be.enabled")
.click({ force: true })
.get(PRODUCT_TYPE_DETAILS.assignVariantAttributeButton)
.click()
.addAliasToGraphRequest("AssignProductAttribute")
.assignElements(startsWith, false)
.assignElements(startsWith, false, true)
.confirmationMessageShouldAppear()
.wait("@AssignProductAttribute");
getProductType(productType.id);

View file

@ -1,27 +1,23 @@
import { ASSIGN_ELEMENTS_SELECTORS } from "../../../elements/shared/assign-elements-selectors";
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
// export function assignElements(name, withLoader = true) {
// cy.get(ASSIGN_ELEMENTS_SELECTORS.searchInput).type(name);
// if (withLoader) {
// cy.get(ASSIGN_ELEMENTS_SELECTORS.dialogContent);
// waitForProgressBarToNotBeVisible();
// }
// cy.contains(ASSIGN_ELEMENTS_SELECTORS.tableRow, name)
// .find(ASSIGN_ELEMENTS_SELECTORS.checkbox)
// .click()
// .get(ASSIGN_ELEMENTS_SELECTORS.submitButton)
// .click();
// }
Cypress.Commands.add("assignElements", (name, withLoader = true) => {
Cypress.Commands.add(
"assignElements",
(name, withLoader = true, waitWithoutLoader = false) => {
cy.get(ASSIGN_ELEMENTS_SELECTORS.searchInput).type(name);
if (withLoader) {
cy.get(ASSIGN_ELEMENTS_SELECTORS.dialogContent);
cy.waitForProgressBarToNotBeVisible();
}
if (waitWithoutLoader) {
cy.get(SHARED_ELEMENTS.dialog)
.find(ASSIGN_ELEMENTS_SELECTORS.tableRow)
.should("have.length", 1);
}
cy.contains(ASSIGN_ELEMENTS_SELECTORS.tableRow, name)
.find(ASSIGN_ELEMENTS_SELECTORS.checkbox)
.click()
.get(ASSIGN_ELEMENTS_SELECTORS.submitButton)
.click();
});
},
);