Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CC-33200: Enable Cypress CI. #5

Merged
merged 15 commits into from
Mar 27, 2024
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Start the final image
FROM cypress/browsers:latest
FROM cypress/browsers:node-20.11.1-chrome-123.0.6312.58-1-ff-124.0-edge-122.0.2365.92-1

# Set and create the working directory
ENV CYPRESS_TESTS_WORK_DIR /opt/cypress-tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ describe('agent impersonation', { tags: ['@marketplace-agent-assist'] }, (): voi
mpAgentDashboardPage.assertPageLocation();

// Ensure that agent finished assistant session and don't have access to MP dashboard
const alias = mpDashboardPage.interceptRequest();
mpDashboardPage.visit({ failOnStatusCode: false });
cy.get('body').contains('Access Denied.');
mpDashboardPage.assert500StatusCode({ alias: alias });
});

it('agent should be able to fully logout from all sessions', (): void => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('agent merchant portal', { tags: ['@marketplace-agent-assist'] }, (): v
);

productsPage.visit();
productsPage.findProduct(dynamicFixtures.productConcreteForMerchant.abstract_sku).click();
productsPage.findProduct(dynamicFixtures.productConcreteForMerchant.abstract_sku).click({ force: true });
productsPage.getDrawer().find('button:contains("Save")').click();

cy.get('body').contains('The Product is saved.');
Expand All @@ -95,7 +95,7 @@ describe('agent merchant portal', { tags: ['@marketplace-agent-assist'] }, (): v
);

offersPage.visit();
offersPage.findOffer(dynamicFixtures.productOffer.product_offer_reference).click();
offersPage.findOffer(dynamicFixtures.productOffer.product_offer_reference).click({ force: true });
offersPage.getDrawer().find('button:contains("Save")').click();

cy.get('body').contains('The Offer is saved.');
Expand Down
19 changes: 19 additions & 0 deletions cypress/support/pages/mp/dashboard/dashboard-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,23 @@ export class DashboardPage extends MpPage {
this.repository.getUserProfileMenu().click();
this.repository.getLogoutButton().click();
};

interceptRequest = (): string => {
const alias = 'dashboardPageRequest';
cy.intercept({ url: this.PAGE_URL }).as(alias);

return alias;
};

assert500StatusCode = (params: Assert500StatusCodeParams): void => {
cy.wait(`@${params.alias}`).then((interception) => {
if (interception.response) {
expect(interception.response.statusCode).to.equal(500);
}
});
};
}

interface Assert500StatusCodeParams {
alias: string;
}
2 changes: 1 addition & 1 deletion cypress/support/pages/mp/sales/sales-orders-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class SalesOrdersPage extends MpPage {
};

cancelOrder = (query: string): void => {
this.findOrder(query).click();
this.findOrder(query).click({ force: true });
this.repository.getDrawer().find('button:contains("Cancel")').click();
};
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"prettier:check": "prettier . --check",
"prettier:write": "prettier . --write",
"cy:open": "cypress open",
"cy:run": "cypress run --headless --browser electron",
"cy:yves": "cypress run --spec cypress/e2e/yves/* --headless --browser electron",
"cy:backoffice": "cypress run --spec cypress/e2e/backoffice/* --headless --browser electron",
"cy:mp": "cypress run --spec cypress/e2e/mp/* --headless --browser electron",
"cy:feature:comments": "cypress run --env grepTags=@comments --headless --browser electron"
"cy:run": "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",
"cy:feature:comments": "cypress run --env grepTags=@comments --headless --browser chrome"
},
"engines": {
"node": ">=18.0.0",
Expand Down
Loading