Fix tests for attributes in products types (#2269)
This commit is contained in:
parent
c1185198f5
commit
22e78bbd23
2 changed files with 24 additions and 27 deletions
|
@ -48,7 +48,7 @@ describe("As an admin I want to manage attributes in product types", () => {
|
||||||
.get(PRODUCT_TYPE_DETAILS.assignProductAttributeButton)
|
.get(PRODUCT_TYPE_DETAILS.assignProductAttributeButton)
|
||||||
.click()
|
.click()
|
||||||
.addAliasToGraphRequest("AssignProductAttribute")
|
.addAliasToGraphRequest("AssignProductAttribute")
|
||||||
.assignElements(startsWith, false)
|
.assignElements(startsWith, false, true)
|
||||||
.confirmationMessageShouldAppear()
|
.confirmationMessageShouldAppear()
|
||||||
.waitForRequestAndCheckIfNoErrors("@AssignProductAttribute");
|
.waitForRequestAndCheckIfNoErrors("@AssignProductAttribute");
|
||||||
getProductType(productType.id);
|
getProductType(productType.id);
|
||||||
|
@ -71,11 +71,12 @@ describe("As an admin I want to manage attributes in product types", () => {
|
||||||
productTypeDetailsUrl(productType.id),
|
productTypeDetailsUrl(productType.id),
|
||||||
)
|
)
|
||||||
.get(PRODUCT_TYPE_DETAILS.hasVariantsButton)
|
.get(PRODUCT_TYPE_DETAILS.hasVariantsButton)
|
||||||
|
.should("be.enabled")
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
.get(PRODUCT_TYPE_DETAILS.assignVariantAttributeButton)
|
.get(PRODUCT_TYPE_DETAILS.assignVariantAttributeButton)
|
||||||
.click()
|
.click()
|
||||||
.addAliasToGraphRequest("AssignProductAttribute")
|
.addAliasToGraphRequest("AssignProductAttribute")
|
||||||
.assignElements(startsWith, false)
|
.assignElements(startsWith, false, true)
|
||||||
.confirmationMessageShouldAppear()
|
.confirmationMessageShouldAppear()
|
||||||
.wait("@AssignProductAttribute");
|
.wait("@AssignProductAttribute");
|
||||||
getProductType(productType.id);
|
getProductType(productType.id);
|
||||||
|
|
|
@ -1,27 +1,23 @@
|
||||||
import { ASSIGN_ELEMENTS_SELECTORS } from "../../../elements/shared/assign-elements-selectors";
|
import { ASSIGN_ELEMENTS_SELECTORS } from "../../../elements/shared/assign-elements-selectors";
|
||||||
|
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
|
||||||
|
|
||||||
// export function assignElements(name, withLoader = true) {
|
Cypress.Commands.add(
|
||||||
// cy.get(ASSIGN_ELEMENTS_SELECTORS.searchInput).type(name);
|
"assignElements",
|
||||||
// if (withLoader) {
|
(name, withLoader = true, waitWithoutLoader = false) => {
|
||||||
// cy.get(ASSIGN_ELEMENTS_SELECTORS.dialogContent);
|
cy.get(ASSIGN_ELEMENTS_SELECTORS.searchInput).type(name);
|
||||||
// waitForProgressBarToNotBeVisible();
|
if (withLoader) {
|
||||||
// }
|
cy.get(ASSIGN_ELEMENTS_SELECTORS.dialogContent);
|
||||||
// cy.contains(ASSIGN_ELEMENTS_SELECTORS.tableRow, name)
|
cy.waitForProgressBarToNotBeVisible();
|
||||||
// .find(ASSIGN_ELEMENTS_SELECTORS.checkbox)
|
}
|
||||||
// .click()
|
if (waitWithoutLoader) {
|
||||||
// .get(ASSIGN_ELEMENTS_SELECTORS.submitButton)
|
cy.get(SHARED_ELEMENTS.dialog)
|
||||||
// .click();
|
.find(ASSIGN_ELEMENTS_SELECTORS.tableRow)
|
||||||
// }
|
.should("have.length", 1);
|
||||||
|
}
|
||||||
Cypress.Commands.add("assignElements", (name, withLoader = true) => {
|
cy.contains(ASSIGN_ELEMENTS_SELECTORS.tableRow, name)
|
||||||
cy.get(ASSIGN_ELEMENTS_SELECTORS.searchInput).type(name);
|
.find(ASSIGN_ELEMENTS_SELECTORS.checkbox)
|
||||||
if (withLoader) {
|
.click()
|
||||||
cy.get(ASSIGN_ELEMENTS_SELECTORS.dialogContent);
|
.get(ASSIGN_ELEMENTS_SELECTORS.submitButton)
|
||||||
cy.waitForProgressBarToNotBeVisible();
|
.click();
|
||||||
}
|
},
|
||||||
cy.contains(ASSIGN_ELEMENTS_SELECTORS.tableRow, name)
|
);
|
||||||
.find(ASSIGN_ELEMENTS_SELECTORS.checkbox)
|
|
||||||
.click()
|
|
||||||
.get(ASSIGN_ELEMENTS_SELECTORS.submitButton)
|
|
||||||
.click();
|
|
||||||
});
|
|
||||||
|
|
Loading…
Reference in a new issue