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(FSADT1-998): adding new individual document types and client notes #644

Merged
merged 18 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ public Mono<Integer> submit(
.submissionStatus(SubmissionStatusEnum.N)
.submissionType(SubmissionTypeCodeEnum.SPP)
.submissionDate(LocalDateTime.now())
.createdBy(userName)
.updatedBy(userName)
.createdBy(userId)
.updatedBy(userId)
.build()
)
//Save submission to begin with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void shouldListAndSearch(
.jsonPath("$.[0].requestType").isEqualTo("Submission pending processing")
.jsonPath("$.[0].status").isEqualTo("New")
.jsonPath("$.[0].clientType").isEqualTo("General Partnership")
.jsonPath("$.[0].user").isEqualTo("Test User");
.jsonPath("$.[0].user").isEqualTo("testUserId");
}
}

Expand All @@ -227,7 +227,7 @@ void shouldGetSubmissionDetails() {
.expectStatus().isOk()
.expectBody()
.jsonPath("$.submissionId").isEqualTo(1)
.jsonPath("$.updateUser").isEqualTo("Test User")
.jsonPath("$.updateUser").isEqualTo("testUserId")
.jsonPath("$.submissionType").isEqualTo("Submission pending processing");
}

Expand Down
199 changes: 199 additions & 0 deletions frontend/cypress/e2e/FormBCSCPage.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
/* eslint-disable no-undef */
describe("BCSC Form", () => {
beforeEach(() => {
cy.intercept("http://localhost:8080/api/clients/name/*", {
fixture: "business.json",
}).as("searchCompany");

cy.intercept("GET", "/api/clients/XX9016140", {
fixture: "example.json",
}).as("selectCompany");

cy.intercept("GET","/api/clients/getCountryByCode/CA",{
fixture: "countryCodeCA.json",
}).as("getCanadaByCode");

cy.intercept("POST", "/api/clients/submissions", {
statusCode: 201,
headers: {
location: "http://localhost:8080/api/clients/submissions/1",
"x-sub-id": "123456"
},
}).as("submitForm");

cy.visit("/");
cy.wait(500);

cy.get("#landing-title").should("contain", "Client Management System");

cy.get("#landing-subtitle").should(
"contain",
"Create and manage client accounts"
);


cy.login("[email protected]", "Uat Test", "ca.bc.gov.flnr.fam.dev",
{
address: {
formatted: "{\"street_address\":\"4000 SEYMOUR PLACE\",\"country\":\"CA\",\"locality\":\"VICTORIA\",\"region\":\"BC\",\"postal_code\":\"V8Z 1C8\"}"
},
given_name: "James",
family_name: "Baxter",
birthdate: "1986-11-12"
}
);
});

it("should submit the form with a phone number", () => {

cy
.get('#phoneNumberId')
.should("be.visible")
.shadow()
.find("input")
.should("have.value", "")
.type('2503008326');

cy
.get('#phoneNumberId')
.blur();

cy.get('[data-test="wizard-submit-button"]')
.click();

cy.get('.fluid-heading-05').should('contain', 'Application submitted!');
});

it("should add a new contact", () => {

cy
.get('#phoneNumberId')
.should("be.visible")
.shadow()
.find("input")
.should("have.value", "")
.type('2503008326');

cy
.get('.form-steps-section > [kind="tertiary"]')
.should("be.visible")
.click();

cy
.get('#role_1')
.should("be.visible")
.shadow()
.find("input")
.click();

cy
.get('cds-combo-box-item')
.should("be.visible")
.click();

cy
.get('#firstName_1')
.should("be.visible")
.shadow()
.find("input")
.should("have.value", "")
.type('James');

cy.get('#lastName_1')
.should("be.visible")
.shadow()
.find("input")
.should("have.value", "")
.type('McCloud');

cy.get('#email_1')
.should("be.visible")
.shadow()
.find("input")
.should("have.value", "")
.type('[email protected]');

cy.get('#phoneNumber_1')
.should("be.visible")
.shadow()
.find("input")
.should("have.value", "")
.type('2773008326');

cy.get('[data-test="wizard-submit-button"]')
.click();

cy.get('.fluid-heading-05').should('contain', 'Application submitted!');

});

it("should add a new contact, then remove it", () => {

cy
.get('#phoneNumberId')
.should("be.visible")
.shadow()
.find("input")
.should("have.value", "")
.type('2503008326');

cy
.get('.form-steps-section > [kind="tertiary"]')
.should("be.visible")
.click();

cy
.get('#role_1')
.should("be.visible")
.shadow()
.find("input")
.click();

cy
.get('cds-combo-box-item')
.should("be.visible")
.click();

cy
.get('#firstName_1')
.should("be.visible")
.shadow()
.find("input")
.should("have.value", "")
.type('James');

cy.get('#lastName_1')
.should("be.visible")
.shadow()
.find("input")
.should("have.value", "")
.type('McCloud');

cy.get('#email_1')
.should("be.visible")
.shadow()
.find("input")
.should("have.value", "")
.type('[email protected]');

cy.get('#phoneNumber_1')
.should("be.visible")
.shadow()
.find("input")
.should("have.value", "")
.type('2773008326');

cy.get('#deleteContact_1').click();

cy.wait(150);

cy.get('#modal-global > cds-modal-footer > .cds--modal-submit-btn').click();

cy.get('[data-test="wizard-submit-button"]')
.click();

cy.get('.fluid-heading-05').should('contain', 'Application submitted!');
});


});
4 changes: 4 additions & 0 deletions frontend/cypress/fixtures/countryCodeCA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"code": "CA",
"name": "Canada"
}
10 changes: 8 additions & 2 deletions frontend/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,23 @@ Cypress.Commands.add('expireLocalStorage', (key: string) => {
})
})

Cypress.Commands.add('login', (email: string, name: string, provider: string) => {
Cypress.Commands.add('login', (
email: string,
name: string,
provider: string,
extra:any = '{}') => {
cy.get('.landing-button').should('be.visible')
const jwtBody = {
'custom:idp_display_name': name,
'custom:idp_name': provider,
'custom:idp_user_id': generateRandomHex(32),
email,
firstName: 'UAT',
lastName: 'Test'
lastName: 'Test',
...extra
}


const payloadString = btoa(JSON.stringify(jwtBody))
.replace(/\+/g, '-')
.replace(/\//g, '_')
Expand Down
19 changes: 9 additions & 10 deletions frontend/cypress/support/cypress.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
declare namespace Cypress {
interface Chainable<Subject> {
login(email: string, name: string): Chainable<void>;
addCookie(name: string, value: string): Chainable<void>;
addToLocalStorage(key: string, value: any): Chainable<void>;
expireLocalStorage(key: string): Chainable<void>;
addToSessionStorage(key: string, value: any): Chainable<void>;
expireSessionStorage(key: string): Chainable<void>;
expireCookie(name: string): Chainable<void>;
login(email: string, name: string, provider: string): Chainable<void>;
logout(): Chainable<void>;
getMany(names: string[]): Chainable<any[]>;
addCookie(name: string, value: string): Chainable<void>;
addToLocalStorage(key: string, value: any): Chainable<void>;
expireLocalStorage(key: string): Chainable<void>;
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>;
logout(): Chainable<void>;
getMany(names: string[]): Chainable<any[]>;
}
}
Loading
Loading