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

feat(fe:FSADT1-1573): create client detail skeleton #1324

Merged
merged 24 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
87907d9
feat: add client details page skeleton
fterra-encora Nov 18, 2024
74f89c5
chore: add stub for predictive search error
fterra-encora Nov 18, 2024
bfcacc5
Merge branch 'main' into feat/FSADT1-1573
fterra-encora Nov 18, 2024
749303d
feat: update roles allowed
fterra-encora Nov 18, 2024
8179e7c
feat: update redirect url from client search
fterra-encora Nov 18, 2024
a3c93e8
test: redirect on click according to feature flag value
fterra-encora Nov 18, 2024
8e2847e
Merge branch 'main' into feat/FSADT1-1573
fterra-encora Nov 18, 2024
08de1cb
chore: set the feature flag on environments dev and test
fterra-encora Nov 18, 2024
dcb3d07
Merge branch 'main' into feat/FSADT1-1573
fterra-encora Nov 18, 2024
ae8e378
chore: fix script coverage command
fterra-encora Nov 18, 2024
52d1b45
chore: set feature flag value on test setup
fterra-encora Nov 19, 2024
a23939c
chore: add stub for non-individual client creation
fterra-encora Nov 19, 2024
5f8a627
refactor: setup feature flag value for tests
fterra-encora Nov 19, 2024
58f974c
Merge branch 'main' into feat/FSADT1-1573
fterra-encora Nov 19, 2024
4e11538
docs: comment code
fterra-encora Nov 19, 2024
ee600a2
docs: replace "detail" with "details"
fterra-encora Nov 19, 2024
ab93103
test: render client details page skeleton
fterra-encora Nov 19, 2024
5207aef
chore: remove unused code
fterra-encora Nov 19, 2024
2dda52d
chore: remove more unused code
fterra-encora Nov 19, 2024
8ce395f
test: render without crashing
fterra-encora Nov 20, 2024
bb7ae90
chore: skip sonar scanning on code block
fterra-encora Nov 20, 2024
2c2b730
Merge branch 'main' into feat/FSADT1-1573
fterra-encora Nov 21, 2024
05a91c5
test: remove tests where FF is off
fterra-encora Nov 21, 2024
3a6e142
Revert "test: remove tests where FF is off"
fterra-encora Nov 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions frontend/cypress/e2e/pages/ClientDetailsPage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe("Client Details Page", () => {
beforeEach(() => {
cy.visit("/");

cy.login("[email protected]", "Uat Test", "idir", {
given_name: "James",
family_name: "Baxter",
"cognito:groups": ["CLIENT_VIEWER"],
});

cy.visit("/clients/0");
});

it("renders the page skeleton", () => {
cy.get("cds-breadcrumb").should("contain", "Client search");
cy.contains("h2", "Client summary");
cy.contains("cds-tab", "Client locations");
cy.contains("cds-tab", "Client contacts");
cy.contains("cds-tab", "Related clients");
cy.contains("cds-tab", "Activity log");
});
});
50 changes: 45 additions & 5 deletions frontend/cypress/e2e/pages/SearchPage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,25 @@ describe("Search Page", () => {
});
};

beforeEach(() => {
const setupFeatureFlag = (ctx: Mocha.Context) => {
fterra-encora marked this conversation as resolved.
Show resolved Hide resolved
const titlePath = ctx.currentTest.titlePath();
for (const title of titlePath.reverse()) {
const ffName = "STAFF_CLIENT_DETAIL";

if (!title.includes(ffName)) continue;

const suffix = title.split(ffName)[1];
const words = suffix.split(" ");
const value = !!words.find((cur) => ["on", "true"].includes(cur));

cy.addToLocalStorage("VITE_FEATURE_FLAGS", JSON.stringify({ [ffName]: value }));

// No need to continue looking up in the titlePath
break;
}
};

beforeEach(function () {
// reset counters
predictiveSearchCounter.count = 0;
fullSearchCounter.count = 0;
Expand Down Expand Up @@ -74,6 +92,8 @@ describe("Search Page", () => {
},
).as("fullSearch");

setupFeatureFlag(this);

cy.viewport(1920, 1080);
cy.visit("/");

Expand Down Expand Up @@ -160,14 +180,24 @@ describe("Search Page", () => {
cy.get("#search-box").find(`cds-combo-box-item[data-id="${clientNumber}"]`).click();
});
it("navigates to the client details", () => {
const greenDomain = "green-domain.com";
cy.get("@windowOpen").should(
"be.calledWith",
`https://${greenDomain}/int/client/client02MaintenanceAction.do?bean.clientNumber=${clientNumber}`,
`/clients/${clientNumber}`,
"_blank",
"noopener",
);
});
describe("and STAFF_CLIENT_DETAIL is turned off", () => {
it("navigates to the client details in the legacy application", () => {
const greenDomain = "green-domain.com";
cy.get("@windowOpen").should(
"be.calledWith",
`https://${greenDomain}/int/client/client02MaintenanceAction.do?bean.clientNumber=${clientNumber}`,
"_blank",
"noopener",
);
});
});
});

describe("and clicks the Search button", () => {
Expand Down Expand Up @@ -207,14 +237,24 @@ describe("Search Page", () => {
cy.get("cds-table").contains("cds-table-row", clientNumber).click();
});
it("navigates to the client details", () => {
const greenDomain = "green-domain.com";
cy.get("@windowOpen").should(
"be.calledWith",
`https://${greenDomain}/int/client/client02MaintenanceAction.do?bean.clientNumber=${clientNumber}`,
`/clients/${clientNumber}`,
"_blank",
"noopener",
);
});
describe("and STAFF_CLIENT_DETAIL is turned off", () => {
it("navigates to the client details in the legacy application", () => {
const greenDomain = "green-domain.com";
cy.get("@windowOpen").should(
"be.calledWith",
`https://${greenDomain}/int/client/client02MaintenanceAction.do?bean.clientNumber=${clientNumber}`,
"_blank",
"noopener",
);
});
});
});

describe("and clicks the Next page button on the table footer", () => {
Expand Down
13 changes: 4 additions & 9 deletions frontend/cypress/support/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,20 @@ declare namespace Cypress {
addToSessionStorage(key: string, value: any): Chainable<void>;
expireSessionStorage(key: string): Chainable<void>;
expireCookie(name: string): Chainable<void>;
login(email: string, name: string, provider: string, extras: any = "{}"): Chainable<void>;
login(email: string, name: string, provider: string, extras?: any): Chainable<void>;
logout(): Chainable<void>;
getMany(names: string[]): Chainable<any[]>;
fillFormEntry(
field: string,
value: string,
delayMS: number = 10,
area: boolean = false,
): Chainable<void>;
fillFormEntry(field: string, value: string, delayMS?: number, area?: boolean): Chainable<void>;
fillFormEntry(field: string, value: string, options: FillFormEntryOptions): Chainable<void>;
clearFormEntry(field: string, area: boolean = false): Chainable<void>;
clearFormEntry(field: string, area?: boolean): Chainable<void>;
selectFormEntry(field: string, value: string, box: boolean): Chainable<void>;
markCheckbox(field: string): Chainable<void>;
unmarkCheckbox(field: string): Chainable<void>;
selectAutocompleteEntry(
field: string,
value: string,
dataid: string,
delayTarget: string = "",
delayTarget?: string,
): Chainable<void>;
checkInputErrorMessage(field: string, message: string): Chainable<void>;
checkAutoCompleteErrorMessage(field: string, message: string): Chainable<void>;
Expand Down
2 changes: 1 addition & 1 deletion frontend/openshift.configmap.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ objects:
name: ${NAME}-${ZONE}-${COMPONENT}-config
data:
params.js: |
window.localStorage.setItem('VITE_FEATURE_FLAGS','{}');
window.localStorage.setItem('VITE_FEATURE_FLAGS','{"STAFF_CLIENT_DETAIL":true}');
2 changes: 1 addition & 1 deletion frontend/openshift.configmap.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ objects:
name: ${NAME}-${ZONE}-${COMPONENT}-config
data:
params.js: |
window.localStorage.setItem('VITE_FEATURE_FLAGS','{}');
window.localStorage.setItem('VITE_FEATURE_FLAGS','{"STAFF_CLIENT_DETAIL":true}');
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"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 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} start-server-and-test preview http://127.0.0.1:3000 'cypress run --headless'",
"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
Loading
Loading