Skip to content

Commit

Permalink
add cypress checks to make sure fileuploader works correctly before p…
Browse files Browse the repository at this point in the history
…roceeding
  • Loading branch information
skylermcnamee-hibc committed Jul 18, 2024
1 parent fa96668 commit 07c8ba3
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions jha/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,20 @@ Cypress.Commands.add("fillPersonalInfoPage", (options) => {
cy.get('label[for=gender-matches-no]').click();

cy.get('input#citizenship-support-documents').selectFile(samplePDF, { force: true });
cy.get("#citizenship-support-documents").parent().within(() => {
cy.get(".thumbnail-image-container", { timeout: 20000 })
.first()
.should("exist");
});
cy.get('label[for=name-change-yes]').click();

cy.get('select#name-change-doc-type').select(SupportDocumentTypes.MarriageCertificate);
cy.get('#name-change-support-documents').selectFile(samplePDF, { force: true });
cy.get("#name-change-support-documents").parent().within(() => {
cy.get(".thumbnail-image-container", { timeout: 20000 })
.first()
.should("exist");
});

cy.get('label[for=is-moved-to-bc-permanently-yes]').click();

Expand Down Expand Up @@ -185,10 +195,20 @@ Cypress.Commands.add('fillSpousePage', (options) => {
cy.get('label[for=spouse-gender-matches-no]').click();

cy.get('input#spouse-citizenship-support-documents').selectFile(samplePDF, { force: true });
cy.get("#spouse-citizenship-support-documents").parent().within(() => {
cy.get(".thumbnail-image-container", { timeout: 20000 })
.first()
.should("exist");
});
cy.get('label[for=name-change-yes]').click();
cy.get('select#name-change-doc-type').select(SupportDocumentTypes.MarriageCertificate);

cy.get('input#spouse-name-change-support-documents').selectFile(samplePDF, { force: true });
cy.get("#spouse-name-change-support-documents").parent().within(() => {
cy.get(".thumbnail-image-container", { timeout: 20000 })
.first()
.should("exist");
});

cy.get('label[for=permanent-move-yes]').click();

Expand Down Expand Up @@ -236,6 +256,11 @@ Cypress.Commands.add('fillChildPage', (options) => {
cy.get('label[for=gender-matches-0-yes]').click()

cy.get('input#child-citizenship-support-documents-0').selectFile(samplePDF, { force: true });
cy.get("#child-citizenship-support-documents-0").parent().within(() => {
cy.get(".thumbnail-image-container", { timeout: 20000 })
.first()
.should("exist");
});

cy.get('label[for=name-change-0-no]').click()

Expand Down Expand Up @@ -272,6 +297,11 @@ Cypress.Commands.add('fillSBInfoPage', (options) => {
cy.get('label[for=selected-attendant-nursing-recipients-ah').click()

cy.get('input#attendant-nursing-receipts').selectFile(samplePDF, { force: true });
cy.get("#attendant-nursing-receipts").parent().within(() => {
cy.get(".thumbnail-image-container", { timeout: 20000 })
.first()
.should("exist");
});

// wait for file to fully upload
cy.get("#attendant-nursing-receipts").parent().within(() => {
Expand All @@ -284,7 +314,17 @@ Cypress.Commands.add('fillSBInfoPage', (options) => {

Cypress.Commands.add('fillDocumentsPage', () => {
cy.get('input#ah-cra-documents').selectFile(samplePDF, { force: true });
cy.get("#ah-cra-documents").parent().within(() => {
cy.get(".thumbnail-image-container", { timeout: 20000 })
.first()
.should("exist");
});
cy.get('input#spouse-cra-documents').selectFile(samplePDF, { force: true });
cy.get("#spouse-cra-documents").parent().within(() => {
cy.get(".thumbnail-image-container", { timeout: 20000 })
.first()
.should("exist");
});
// wait for file to fully upload
cy.get("#spouse-cra-documents").parent().within(() => {
cy.get(".thumbnail-image-container", { timeout: 20000 })
Expand Down

0 comments on commit 07c8ba3

Please sign in to comment.