Skip to content

Commit

Permalink
test: use related clients tab
Browse files Browse the repository at this point in the history
  • Loading branch information
fterra-encora committed Jan 2, 2025
1 parent 74f4adb commit ccd459f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
3 changes: 3 additions & 0 deletions frontend/cypress.env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"VITE_GREEN_DOMAIN": "green-domain.com"
}
44 changes: 39 additions & 5 deletions frontend/cypress/e2e/pages/ClientDetailsPage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe("Client Details Page", () => {
cy.get("#location-00 [slot='title']").click();
cy.get("#location-02 [slot='title']").click();

// Switch to tab another tab (Contacts)
// Switch to another tab (Contacts)
cy.get("#tab-contacts").click();

// Make sure the current tab panel was effectively switched
Expand All @@ -205,7 +205,7 @@ describe("Client Details Page", () => {
before(() => {
cy.visit("/clients/details/g");

// Switch to tab another tab (Contacts)
// Switch to the Contacts tab
cy.get("#tab-contacts").click();

// Make sure the current tab panel was effectively switched
Expand Down Expand Up @@ -247,7 +247,7 @@ describe("Client Details Page", () => {
beforeEach(() => {
cy.visit("/clients/details/g");

// Switch to tab another tab (Contacts)
// Switch to the Contacts tab
cy.get("#tab-contacts").click();

// Make sure the current tab panel was effectively switched
Expand All @@ -265,7 +265,7 @@ describe("Client Details Page", () => {
// Expand first and third contacts, leave second one collapsed
cy.get("#contact-00 [slot='title']").click();
cy.get("#contact-02 [slot='title']").click();
// Switch to tab another tab (Locations)
// Switch to another tab (Locations)
cy.get("#tab-locations").click();
// Make sure the current tab panel was effectively switched
cy.get("#panel-contacts").should("have.attr", "hidden");
Expand All @@ -284,7 +284,7 @@ describe("Client Details Page", () => {
beforeEach(() => {
cy.visit("/clients/details/gd");

// Switch to tab another tab (Contacts)
// Switch to the Contacts tab
cy.get("#tab-contacts").click();

// Make sure the current tab panel was effectively switched
Expand Down Expand Up @@ -323,4 +323,38 @@ describe("Client Details Page", () => {
});
});
});

describe("related clients tab", () => {
const clientNumber = "12321";
beforeEach(() => {
cy.visit(`/clients/details/${clientNumber}`);

cy.window().then((win) => {
cy.stub(win, "open").as("windowOpen");
});

// Switch to the Related Clients tab
cy.get("#tab-related").click();

// Make sure the current tab panel was effectively switched
cy.get("#panel-locations").should("have.attr", "hidden");
cy.get("#panel-related").should("not.have.attr", "hidden");
});

it("should display the Under construction message", () => {
cy.get("#panel-related").contains("Under construction").should("be.visible");
});

const greenDomain = Cypress.env("VITE_GREEN_DOMAIN");

it("should open the Related Client page in the legacy application", () => {
cy.get("#open-related-clients-btn").click();
cy.get("@windowOpen").should(
"be.calledWith",
`https://${greenDomain}/int/client/client04RelatedClientListAction.do?bean.clientNumber=${clientNumber}`,
"_blank",
"noopener",
);
});
});
});
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"posttest:component": "mv reports/.nyc_report reports/component",
"test:unit": "cross-env VITE_NODE_ENV=test NODE_ENV=test vitest run --coverage",
"posttest:unit": "mv reports/.vite_report reports/unit",
"test:e2e": "cross-env VITE_NODE_ENV=test VITE_GREEN_DOMAIN=green-domain.com VITE_FEATURE_FLAGS={\\\"STAFF_CLIENT_DETAIL\\\":true} start-server-and-test preview http://127.0.0.1:3000 'cypress run --headless'",
"test:e2e": "cross-env VITE_NODE_ENV=test VITE_GREEN_DOMAIN=green-domain.com VITE_FEATURE_FLAGS={\\\"STAFF_CLIENT_DETAIL\\\":true} npm run test:e2e:child",
"test:e2e:child": "cross-env-shell \"start-server-and-test preview http://127.0.0.1:3000 'cypress run --headless --env VITE_GREEN_DOMAIN=$VITE_GREEN_DOMAIN'\"",
"posttest:e2e": "mv reports/.nyc_report reports/e2e",
"pretest:report:merge": "rm -rf reports-merge && mkdir -p reports-merge && for name in component e2e unit; do cp reports/$name/coverage-final.json reports-merge/$name.json; done",
"test:report:merge": "mkdir -p .nyc_output && rm -rf coverage && nyc --config nyc.config.json merge reports-merge && mv coverage.json .nyc_output/out.json && nyc --config nyc.config.json report --reporter lcov --reporter text-summary --report-dir coverage --temp-dir .nyc_output",
Expand Down

0 comments on commit ccd459f

Please sign in to comment.