From 39163091c9a95014929834cced9323bda782f9b1 Mon Sep 17 00:00:00 2001 From: Dmytro Asieiev Date: Wed, 27 Mar 2024 18:52:34 +0300 Subject: [PATCH 1/3] Retry error. --- cypress/support/pages/mp/mp-page.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cypress/support/pages/mp/mp-page.ts b/cypress/support/pages/mp/mp-page.ts index 7a9f444e..2c2f957e 100644 --- a/cypress/support/pages/mp/mp-page.ts +++ b/cypress/support/pages/mp/mp-page.ts @@ -14,7 +14,11 @@ export class MpPage extends AbstractPage { const interceptAlias = this.faker.string.uuid(); cy.intercept('GET', params.url).as(interceptAlias); - cy.wait(`@${interceptAlias}`).its('response.body.total').should('eq', expectedCount); + cy.wait(`@${interceptAlias}`) + .its('response.body.total') + .should((total) => { + assert.isAtMost(total, expectedCount + Cypress.currentRetry); + }); }; } From 7f308683590d91ab0e4d2a37cf57171f353e5b0b Mon Sep 17 00:00:00 2001 From: Dmytro Asieiev Date: Thu, 28 Mar 2024 12:37:18 +0300 Subject: [PATCH 2/3] Fixed flaky tests. --- .../agent-dashboard.cy.ts | 24 ++++++++++++++----- cypress/support/pages/mp/mp-page.ts | 3 ++- package.json | 3 ++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/mp/marketplace-agent-assist/agent-dashboard.cy.ts b/cypress/e2e/mp/marketplace-agent-assist/agent-dashboard.cy.ts index 7bb00339..81b4aca4 100644 --- a/cypress/e2e/mp/marketplace-agent-assist/agent-dashboard.cy.ts +++ b/cypress/e2e/mp/marketplace-agent-assist/agent-dashboard.cy.ts @@ -58,7 +58,7 @@ describe('agent dashboard', { tags: ['@marketplace-agent-assist'] }, (): void => mpAgentDashboardPage.find({ query: dynamicFixtures.merchantUser.username }).should('exist'); }); - it('agent should be able to see/assist inactive merchant user in a table', (): void => { + it('agent should be able to see and assist inactive merchant user in a table', (): void => { mpAgentLoginPage.visit(); mpAgentLoginPage.login({ username: dynamicFixtures.merchantAgentUser.username, @@ -69,12 +69,14 @@ describe('agent dashboard', { tags: ['@marketplace-agent-assist'] }, (): void => mpAgentDashboardPage.find({ query: dynamicFixtures.deactivatedMerchantUser.username }).should('exist'); mpAgentDashboardPage.visit(); + const alias = mpDashboardPage.interceptRequest(); mpAgentDashboardPage.assist({ query: dynamicFixtures.deactivatedMerchantUser.username }); + cy.wait(`@${alias}`); mpDashboardPage.assertPageLocation(); }); - it('agent should be able to see/assist deleted merchant user in a table', (): void => { + it('agent should be able to see and assist deleted merchant user in a table', (): void => { mpAgentLoginPage.visit(); mpAgentLoginPage.login({ username: dynamicFixtures.merchantAgentUser.username, @@ -85,12 +87,14 @@ describe('agent dashboard', { tags: ['@marketplace-agent-assist'] }, (): void => mpAgentDashboardPage.find({ query: dynamicFixtures.deletedMerchantUser.username }).should('exist'); mpAgentDashboardPage.visit(); + const alias = mpDashboardPage.interceptRequest(); mpAgentDashboardPage.assist({ query: dynamicFixtures.deletedMerchantUser.username }); + cy.wait(`@${alias}`); mpDashboardPage.assertPageLocation(); }); - it('agent should be able to see/assist merchant users from active (without approved access) merchant', (): void => { + it('agent should be able to see and assist merchant users from active (without approved access) merchant', (): void => { mpAgentLoginPage.visit(); mpAgentLoginPage.login({ username: dynamicFixtures.merchantAgentUser.username, @@ -101,12 +105,14 @@ describe('agent dashboard', { tags: ['@marketplace-agent-assist'] }, (): void => mpAgentDashboardPage.find({ query: dynamicFixtures.merchantUserFromActiveDeniedMerchant.username }).should('exist'); mpAgentDashboardPage.visit(); + const alias = mpDashboardPage.interceptRequest(); mpAgentDashboardPage.assist({ query: dynamicFixtures.merchantUserFromActiveDeniedMerchant.username }); + cy.wait(`@${alias}`); mpDashboardPage.assertPageLocation(); }); - it('agent should be able to see/assist merchant users from inactive (with approved access) merchant', (): void => { + it('agent should be able to see and assist merchant users from inactive (with approved access) merchant', (): void => { mpAgentLoginPage.visit(); mpAgentLoginPage.login({ username: dynamicFixtures.merchantAgentUser.username, @@ -119,12 +125,14 @@ describe('agent dashboard', { tags: ['@marketplace-agent-assist'] }, (): void => .should('exist'); mpAgentDashboardPage.visit(); + const alias = mpDashboardPage.interceptRequest(); mpAgentDashboardPage.assist({ query: dynamicFixtures.merchantUserFromInactiveApprovedMerchant.username }); + cy.wait(`@${alias}`); mpDashboardPage.assertPageLocation(); }); - it('agent should be able to see/assist merchant users from inactive (without approved access) merchant', (): void => { + it('agent should be able to see and assist merchant users from inactive (without approved access) merchant', (): void => { mpAgentLoginPage.visit(); mpAgentLoginPage.login({ username: dynamicFixtures.merchantAgentUser.username, @@ -137,12 +145,14 @@ describe('agent dashboard', { tags: ['@marketplace-agent-assist'] }, (): void => .should('exist'); mpAgentDashboardPage.visit(); + const alias = mpDashboardPage.interceptRequest(); mpAgentDashboardPage.assist({ query: dynamicFixtures.merchantUserFromInactiveDeniedMerchant.username }); + cy.wait(`@${alias}`); mpDashboardPage.assertPageLocation(); }); - it('agent should be able to see/assist merchant users from active (with approved access) merchant', (): void => { + it('agent should be able to see and assist merchant users from active (with approved access) merchant', (): void => { mpAgentLoginPage.visit(); mpAgentLoginPage.login({ username: dynamicFixtures.merchantAgentUser.username, @@ -153,8 +163,10 @@ describe('agent dashboard', { tags: ['@marketplace-agent-assist'] }, (): void => mpAgentDashboardPage.find({ query: dynamicFixtures.merchantUser.username }).should('exist'); mpAgentDashboardPage.visit(); + const alias = mpDashboardPage.interceptRequest(); mpAgentDashboardPage.assist({ query: dynamicFixtures.merchantUser.username }); + cy.wait(`@${alias}`); mpDashboardPage.assertPageLocation(); }); }); diff --git a/cypress/support/pages/mp/mp-page.ts b/cypress/support/pages/mp/mp-page.ts index 2c2f957e..235bbab5 100644 --- a/cypress/support/pages/mp/mp-page.ts +++ b/cypress/support/pages/mp/mp-page.ts @@ -17,7 +17,8 @@ export class MpPage extends AbstractPage { cy.wait(`@${interceptAlias}`) .its('response.body.total') .should((total) => { - assert.isAtMost(total, expectedCount + Cypress.currentRetry); + const valueToBeAtMost = expectedCount + Cypress.currentRetry; + assert.isAtMost(total, valueToBeAtMost); }); }; } diff --git a/package.json b/package.json index be74794f..1896e6d3 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "prettier:check": "prettier . --check", "prettier:write": "prettier . --write", "cy:open": "cypress open", - "cy:run": "cypress run --headless --browser chrome", + "cy:run": "cypress run", + "cy:ci": "cypress run --headless --browser chrome", "cy:yves": "cypress run --spec cypress/e2e/yves/* --headless --browser chrome", "cy:backoffice": "cypress run --spec cypress/e2e/backoffice/* --headless --browser chrome", "cy:mp": "cypress run --spec cypress/e2e/mp/* --headless --browser chrome", From ca68e35479b147364897f26fe375923dea26e94f Mon Sep 17 00:00:00 2001 From: Dmytro Asieiev Date: Thu, 28 Mar 2024 15:02:17 +0300 Subject: [PATCH 3/3] Swap tests due to email issues in helper. --- .../dynamic-request-management.json | 24 +++++++++---------- .../dynamic-request-management.json | 24 +++++++++---------- .../dynamic-request-creation.json | 24 +++++++++---------- .../dynamic-request-management.json | 24 +++++++++---------- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/cypress/fixtures/suite/backoffice/merchant-b2b-contract-requests/dynamic-request-management.json b/cypress/fixtures/suite/backoffice/merchant-b2b-contract-requests/dynamic-request-management.json index f2bb3a78..c7832f35 100644 --- a/cypress/fixtures/suite/backoffice/merchant-b2b-contract-requests/dynamic-request-management.json +++ b/cypress/fixtures/suite/backoffice/merchant-b2b-contract-requests/dynamic-request-management.json @@ -214,18 +214,6 @@ "name": "haveCountry", "key": "country" }, - { - "type": "helper", - "name": "haveCustomer", - "key": "customer", - "arguments": [{ "locale": "#localeEN", "password": "change123" }] - }, - { - "type": "helper", - "name": "confirmCustomer", - "key": "confirmedCustomer", - "arguments": ["#customer"] - }, { "type": "helper", "name": "haveCompany", @@ -238,6 +226,18 @@ "key": "company2", "arguments": [{ "isActive": true, "status": "approved" }] }, + { + "type": "helper", + "name": "haveCustomer", + "key": "customer", + "arguments": [{ "locale": "#localeEN", "password": "change123" }] + }, + { + "type": "helper", + "name": "confirmCustomer", + "key": "confirmedCustomer", + "arguments": ["#customer"] + }, { "type": "helper", "name": "haveCompanyBusinessUnit", diff --git a/cypress/fixtures/suite/mp/merchant-b2b-contract-requests/dynamic-request-management.json b/cypress/fixtures/suite/mp/merchant-b2b-contract-requests/dynamic-request-management.json index 00467923..620490f5 100644 --- a/cypress/fixtures/suite/mp/merchant-b2b-contract-requests/dynamic-request-management.json +++ b/cypress/fixtures/suite/mp/merchant-b2b-contract-requests/dynamic-request-management.json @@ -347,18 +347,6 @@ "name": "haveCountry", "key": "country" }, - { - "type": "helper", - "name": "haveCustomer", - "key": "customer", - "arguments": [{ "locale": "#localeEN", "password": "change123" }] - }, - { - "type": "helper", - "name": "confirmCustomer", - "key": "confirmedCustomer", - "arguments": ["#customer"] - }, { "type": "helper", "name": "haveCompany", @@ -371,6 +359,18 @@ "key": "company2", "arguments": [{ "isActive": true, "status": "approved" }] }, + { + "type": "helper", + "name": "haveCustomer", + "key": "customer", + "arguments": [{ "locale": "#localeEN", "password": "change123" }] + }, + { + "type": "helper", + "name": "confirmCustomer", + "key": "confirmedCustomer", + "arguments": ["#customer"] + }, { "type": "helper", "name": "haveCompanyBusinessUnit", diff --git a/cypress/fixtures/suite/yves/merchant-b2b-contract-requests/dynamic-request-creation.json b/cypress/fixtures/suite/yves/merchant-b2b-contract-requests/dynamic-request-creation.json index 0660af56..75835843 100644 --- a/cypress/fixtures/suite/yves/merchant-b2b-contract-requests/dynamic-request-creation.json +++ b/cypress/fixtures/suite/yves/merchant-b2b-contract-requests/dynamic-request-creation.json @@ -303,18 +303,6 @@ "name": "haveCountry", "key": "country" }, - { - "type": "helper", - "name": "haveCustomer", - "key": "customer", - "arguments": [{ "locale": "#localeEN", "password": "change123" }] - }, - { - "type": "helper", - "name": "confirmCustomer", - "key": "confirmedCustomer", - "arguments": ["#customer"] - }, { "type": "helper", "name": "haveCompany", @@ -327,6 +315,18 @@ "key": "company2", "arguments": [{ "isActive": true, "status": "approved" }] }, + { + "type": "helper", + "name": "haveCustomer", + "key": "customer", + "arguments": [{ "locale": "#localeEN", "password": "change123" }] + }, + { + "type": "helper", + "name": "confirmCustomer", + "key": "confirmedCustomer", + "arguments": ["#customer"] + }, { "type": "helper", "name": "haveCompanyBusinessUnit", diff --git a/cypress/fixtures/suite/yves/merchant-b2b-contract-requests/dynamic-request-management.json b/cypress/fixtures/suite/yves/merchant-b2b-contract-requests/dynamic-request-management.json index 0a6e5ca5..46676b6b 100644 --- a/cypress/fixtures/suite/yves/merchant-b2b-contract-requests/dynamic-request-management.json +++ b/cypress/fixtures/suite/yves/merchant-b2b-contract-requests/dynamic-request-management.json @@ -303,18 +303,6 @@ "name": "haveCountry", "key": "country" }, - { - "type": "helper", - "name": "haveCustomer", - "key": "customer", - "arguments": [{ "locale": "#localeEN", "password": "change123" }] - }, - { - "type": "helper", - "name": "confirmCustomer", - "key": "confirmedCustomer", - "arguments": ["#customer"] - }, { "type": "helper", "name": "haveCompany", @@ -327,6 +315,18 @@ "key": "company2", "arguments": [{ "isActive": true, "status": "approved" }] }, + { + "type": "helper", + "name": "haveCustomer", + "key": "customer", + "arguments": [{ "locale": "#localeEN", "password": "change123" }] + }, + { + "type": "helper", + "name": "confirmCustomer", + "key": "confirmedCustomer", + "arguments": ["#customer"] + }, { "type": "helper", "name": "haveCompanyBusinessUnit",