Update cypress version (#3053)
* update cypress * Fix clearAndtypeCommand * Fix selects * Fix attribute query, and logging errored responses * Fix mailhog commands * Fix mailhog * Fix for warehouses * fix tests for plugins and sku * Fix creating variants * Fix plugins * move cypress to optionalDependencies * move cypress to optionalDependencies
This commit is contained in:
parent
4ae2748e8e
commit
2b3c566e09
11 changed files with 71 additions and 41 deletions
|
@ -53,6 +53,10 @@ describe("As an unlogged customer I want to order physical and digital products"
|
|||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
});
|
||||
|
||||
it(
|
||||
"should purchase digital product as unlogged customer. TC: SALEOR_0402",
|
||||
{ tags: ["@checkout", "@allEnv", "@stable", "@oldRelease"] },
|
||||
|
|
|
@ -120,6 +120,7 @@ describe("Manage products stocks in checkout", () => {
|
|||
})
|
||||
.then(({ order }) => {
|
||||
expect(order, "order should be created").to.be.ok;
|
||||
cy.clearSessionData().loginUserViaRequest();
|
||||
getVariants([lastVariantInStock]);
|
||||
})
|
||||
.then(variantsList => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export const VARIANTS_SELECTORS = {
|
||||
variantNameInput: '[data-test-id="variant-name"]',
|
||||
skuTextField: '[data-test-id="sku"] input',
|
||||
skuTextField: '[data-test-id="sku"]',
|
||||
attributeOption:
|
||||
"[data-test-type='option'], [data-test-id='multi-autocomplete-select-option']",
|
||||
attributeSelector: "[data-test-id='attribute-value']",
|
||||
|
|
|
@ -88,7 +88,7 @@ export function getAttribute(attributeId) {
|
|||
visibleInStorefront
|
||||
availableInGrid
|
||||
unit
|
||||
choices{
|
||||
choices(first: 100){
|
||||
edges{
|
||||
node{
|
||||
file{
|
||||
|
|
|
@ -30,6 +30,7 @@ Cypress.Commands.add(
|
|||
const respInSting = JSON.stringify(response.body);
|
||||
if (respInSting.includes(`"errors":[{`)) {
|
||||
cy.log(query).log(JSON.stringify(response.body));
|
||||
cy.wrap(response);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
@ -31,7 +31,7 @@ export function getMailActivationLinkForUser(email, regex, i = 0) {
|
|||
`There is no email invitation for user ${serverStoredEmail}`,
|
||||
);
|
||||
}
|
||||
return cy.mhGetMailsByRecipient(serverStoredEmail).should(mails => {
|
||||
return cy.mhGetMailsByRecipient(serverStoredEmail).then(mails => {
|
||||
if (!mails.length) {
|
||||
cy.wait(10000);
|
||||
getMailActivationLinkForUser(serverStoredEmail, regex, i + 1);
|
||||
|
@ -56,14 +56,14 @@ export function getMailActivationLinkForUserAndSubject(email, subject, i = 0) {
|
|||
`There is no email invitation for user ${serverStoredEmail}`,
|
||||
);
|
||||
}
|
||||
return cy.mhGetMailsByRecipient(serverStoredEmail).should(mails => {
|
||||
return cy.mhGetMailsByRecipient(serverStoredEmail).then(mails => {
|
||||
if (!mails.length) {
|
||||
cy.wait(10000);
|
||||
getMailActivationLinkForUserAndSubject(serverStoredEmail, subject, i + 1);
|
||||
} else {
|
||||
cy.wrap(mails)
|
||||
.mhGetMailsBySubject(subject)
|
||||
.should(mailsWithSubject => {
|
||||
.then(mailsWithSubject => {
|
||||
if (!mailsWithSubject.length) {
|
||||
cy.wait(10000);
|
||||
getMailActivationLinkForUserAndSubject(
|
||||
|
@ -98,13 +98,19 @@ export function getMailWithResetPasswordLink(email, subject, i = 0) {
|
|||
`There is no email with reset password for user ${serverStoredEmail}`,
|
||||
);
|
||||
}
|
||||
return cy.mhGetMailsByRecipient(serverStoredEmail).should(mails => {
|
||||
return cy.mhGetMailsByRecipient(serverStoredEmail).then(mails => {
|
||||
if (!mails.length) {
|
||||
cy.wait(3000);
|
||||
getMailWithResetPasswordLink(serverStoredEmail, subject, i + 1);
|
||||
} else {
|
||||
cy.mhGetMailsBySubject(subject);
|
||||
return mails;
|
||||
cy.mhGetMailsBySubject(subject).then(resetPasswordMails => {
|
||||
if (!resetPasswordMails.length) {
|
||||
cy.wait(3000);
|
||||
getMailWithResetPasswordLink(serverStoredEmail, subject, i + 1);
|
||||
} else {
|
||||
cy.wrap(resetPasswordMails);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -117,7 +123,7 @@ export function getMailsForUser(email, i = 0) {
|
|||
`There is no email invitation for user ${serverStoredEmail}`,
|
||||
);
|
||||
}
|
||||
return cy.mhGetMailsByRecipient(serverStoredEmail).should(mails => {
|
||||
return cy.mhGetMailsByRecipient(serverStoredEmail).then(mails => {
|
||||
if (!mails.length) {
|
||||
cy.wait(3000);
|
||||
getMailsForUser(serverStoredEmail, i + 1);
|
||||
|
@ -136,7 +142,7 @@ export function getMailWithGiftCardExportWithAttachment(
|
|||
if (i > 5) {
|
||||
throw new Error(`There is no email Gift Card export for user ${email}`);
|
||||
}
|
||||
return cy.mhGetMailsByRecipient(email).should(mails => {
|
||||
return cy.mhGetMailsByRecipient(email).then(mails => {
|
||||
if (!mails.length) {
|
||||
cy.wait(3000);
|
||||
getMailWithGiftCardExportWithAttachment(
|
||||
|
@ -146,7 +152,7 @@ export function getMailWithGiftCardExportWithAttachment(
|
|||
i + 1,
|
||||
);
|
||||
} else {
|
||||
cy.mhGetMailsBySubject(subject).should(mailsWithSubject => {
|
||||
cy.mhGetMailsBySubject(subject).then(mailsWithSubject => {
|
||||
if (!mailsWithSubject.length) {
|
||||
cy.wait(10000);
|
||||
getMailWithGiftCardExportWithAttachment(
|
||||
|
|
|
@ -3,9 +3,13 @@ Cypress.Commands.add("getTextFromElement", element =>
|
|||
);
|
||||
|
||||
Cypress.Commands.add("clearAndType", { prevSubject: true }, (subject, text) => {
|
||||
cy.wrap(subject)
|
||||
.clear()
|
||||
.type(text);
|
||||
cy.wrap(subject).then(subject => {
|
||||
if (subject.find("[contenteditable]").length > 0) {
|
||||
cy.wrap(subject).find("[contenteditable]").clear().type(text);
|
||||
} else {
|
||||
cy.wrap(subject).clear().type(text);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("waitForRequestAndCheckIfNoErrors", alias => {
|
||||
|
|
|
@ -35,6 +35,7 @@ Cypress.Commands.add("fillBaseSelect", (selectSelector, value) => {
|
|||
});
|
||||
|
||||
Cypress.Commands.add("fillAutocompleteSelect", (selectSelector, option) => {
|
||||
let selectedOption = option;
|
||||
cy.get(selectSelector)
|
||||
.click()
|
||||
.get(BUTTON_SELECTORS.selectOption)
|
||||
|
@ -43,25 +44,36 @@ Cypress.Commands.add("fillAutocompleteSelect", (selectSelector, option) => {
|
|||
cy.get(BUTTON_SELECTORS.selectOption)
|
||||
.first()
|
||||
.then(detachedOption => {
|
||||
cy.get(selectSelector).clear();
|
||||
cy.get(selectSelector).type(option, { delay: 10 });
|
||||
cy.get(selectSelector).then(select => {
|
||||
if (select.find("input").length > 0) {
|
||||
cy.get(selectSelector)
|
||||
.find("input")
|
||||
.clear()
|
||||
.type(option, { delay: 10 });
|
||||
} else {
|
||||
cy.get(selectSelector).clear().type(option, { delay: 10 });
|
||||
}
|
||||
});
|
||||
cy.wrap(detachedOption).should(det => {
|
||||
Cypress.dom.isDetached(det);
|
||||
});
|
||||
cy.contains(BUTTON_SELECTORS.selectOption, option)
|
||||
.should("be.visible")
|
||||
.click({ force: true });
|
||||
cy.wrap(option).as("option");
|
||||
.click({ force: true })
|
||||
.then(() => selectedOption);
|
||||
});
|
||||
} else {
|
||||
cy.get(BUTTON_SELECTORS.selectOption)
|
||||
.wait(1000)
|
||||
.first()
|
||||
.invoke("text")
|
||||
.as("option")
|
||||
.then(text => {
|
||||
selectedOption = text;
|
||||
});
|
||||
return cy
|
||||
.get(BUTTON_SELECTORS.selectOption)
|
||||
.first()
|
||||
.click();
|
||||
.click()
|
||||
.then(() => selectedOption);
|
||||
}
|
||||
return cy.get("@option");
|
||||
});
|
||||
|
|
|
@ -35,7 +35,8 @@ export function createVariant({
|
|||
cy.get(VARIANTS_SELECTORS.saveButton)
|
||||
.click()
|
||||
.get(VARIANTS_SELECTORS.skuTextField)
|
||||
.and("be.enabled")
|
||||
.find("input")
|
||||
.should("be.enabled")
|
||||
.get(BUTTON_SELECTORS.back)
|
||||
.click()
|
||||
.get(PRODUCT_DETAILS.productNameInput)
|
||||
|
|
32
package-lock.json
generated
32
package-lock.json
generated
|
@ -179,7 +179,7 @@
|
|||
"@types/jest": "^26.0.14",
|
||||
"@types/setup-polly-jest": "^0.5.0",
|
||||
"@types/storybook__react": "^4.0.2",
|
||||
"cypress": "^10.0.2",
|
||||
"cypress": "^12.4.0",
|
||||
"cypress-file-upload": "^5.0.8",
|
||||
"cypress-mailhog": "^1.3.0",
|
||||
"cypress-mochawesome-reporter": "^2.3.0",
|
||||
|
@ -15084,9 +15084,9 @@
|
|||
"optional": true
|
||||
},
|
||||
"node_modules/cypress": {
|
||||
"version": "10.0.2",
|
||||
"resolved": "https://registry.npmjs.org/cypress/-/cypress-10.0.2.tgz",
|
||||
"integrity": "sha512-7+C4KHYBcfZrawss+Gt5PlS35rfc6ySc59JcHDVsIMm1E/J35dqE41UEXpdtwIq3549umCerNWnFADzqib4kcA==",
|
||||
"version": "12.4.0",
|
||||
"resolved": "https://registry.npmjs.org/cypress/-/cypress-12.4.0.tgz",
|
||||
"integrity": "sha512-//h93K/yGC/7pxv1KamlkADbKHLp5h3f9rZDE2McRjXZDagMETH0sXowOOanvhsH8cFt/JWspIcK+p9cuaoAqg==",
|
||||
"hasInstallScript": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
|
@ -15109,7 +15109,7 @@
|
|||
"dayjs": "^1.10.4",
|
||||
"debug": "^4.3.2",
|
||||
"enquirer": "^2.3.6",
|
||||
"eventemitter2": "^6.4.3",
|
||||
"eventemitter2": "6.4.7",
|
||||
"execa": "4.1.0",
|
||||
"executable": "^4.1.1",
|
||||
"extract-zip": "2.0.1",
|
||||
|
@ -15137,7 +15137,7 @@
|
|||
"cypress": "bin/cypress"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
"node": "^14.0.0 || ^16.0.0 || >=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/cypress-file-upload": {
|
||||
|
@ -18796,9 +18796,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/eventemitter2": {
|
||||
"version": "6.4.5",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.5.tgz",
|
||||
"integrity": "sha512-bXE7Dyc1i6oQElDG0jMRZJrRAn9QR2xyyFGmBdZleNmyQX0FqGYmhZIrIrpPfm/w//LTo4tVQGOGQcGCb5q9uw==",
|
||||
"version": "6.4.7",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz",
|
||||
"integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/eventemitter3": {
|
||||
|
@ -51045,9 +51045,9 @@
|
|||
"optional": true
|
||||
},
|
||||
"cypress": {
|
||||
"version": "10.0.2",
|
||||
"resolved": "https://registry.npmjs.org/cypress/-/cypress-10.0.2.tgz",
|
||||
"integrity": "sha512-7+C4KHYBcfZrawss+Gt5PlS35rfc6ySc59JcHDVsIMm1E/J35dqE41UEXpdtwIq3549umCerNWnFADzqib4kcA==",
|
||||
"version": "12.4.0",
|
||||
"resolved": "https://registry.npmjs.org/cypress/-/cypress-12.4.0.tgz",
|
||||
"integrity": "sha512-//h93K/yGC/7pxv1KamlkADbKHLp5h3f9rZDE2McRjXZDagMETH0sXowOOanvhsH8cFt/JWspIcK+p9cuaoAqg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"@cypress/request": "^2.88.10",
|
||||
|
@ -51069,7 +51069,7 @@
|
|||
"dayjs": "^1.10.4",
|
||||
"debug": "^4.3.2",
|
||||
"enquirer": "^2.3.6",
|
||||
"eventemitter2": "^6.4.3",
|
||||
"eventemitter2": "6.4.7",
|
||||
"execa": "4.1.0",
|
||||
"executable": "^4.1.1",
|
||||
"extract-zip": "2.0.1",
|
||||
|
@ -53709,9 +53709,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"eventemitter2": {
|
||||
"version": "6.4.5",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.5.tgz",
|
||||
"integrity": "sha512-bXE7Dyc1i6oQElDG0jMRZJrRAn9QR2xyyFGmBdZleNmyQX0FqGYmhZIrIrpPfm/w//LTo4tVQGOGQcGCb5q9uw==",
|
||||
"version": "6.4.7",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz",
|
||||
"integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==",
|
||||
"optional": true
|
||||
},
|
||||
"eventemitter3": {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
"@editorjs/list": "^1.7.0",
|
||||
"@editorjs/paragraph": "^2.8.0",
|
||||
"@editorjs/quote": "^2.4.0",
|
||||
"@floating-ui/react-dom-interactions": "^0.5.0",
|
||||
"@glideapps/glide-data-grid": "^5.0.0",
|
||||
"@graphiql/plugin-explorer": "^0.1.12",
|
||||
"@graphiql/react": "^0.15.0",
|
||||
|
@ -182,7 +183,7 @@
|
|||
"@types/jest": "^26.0.14",
|
||||
"@types/setup-polly-jest": "^0.5.0",
|
||||
"@types/storybook__react": "^4.0.2",
|
||||
"cypress": "^10.0.2",
|
||||
"cypress": "^12.4.0",
|
||||
"cypress-file-upload": "^5.0.8",
|
||||
"cypress-mailhog": "^1.3.0",
|
||||
"cypress-mochawesome-reporter": "^2.3.0",
|
||||
|
@ -204,6 +205,7 @@
|
|||
"husky": "^8.0.0",
|
||||
"jest": "^27.5.1",
|
||||
"jest-canvas-mock": "^2.4.0",
|
||||
"jest-environment-jsdom": "^27.5.1",
|
||||
"jest-file": "^1.0.0",
|
||||
"jest-localstorage-mock": "^2.4.3",
|
||||
"lint-staged": "^10.5.1",
|
||||
|
@ -213,8 +215,7 @@
|
|||
"mochawesome-report-generator": "^6.0.1",
|
||||
"prettier": "^2.8.3",
|
||||
"setup-polly-jest": "^0.9.1",
|
||||
"ts-jest": "^27.1.5",
|
||||
"jest-environment-jsdom": "^27.5.1"
|
||||
"ts-jest": "^27.1.5"
|
||||
},
|
||||
"jest": {
|
||||
"resetMocks": false,
|
||||
|
|
Loading…
Reference in a new issue