|
| 1 | +import selectors from "../../../support/selectors"; |
| 2 | +import { courseStartDay, courseEndDay, todayDay } from "../../../support/utils"; |
| 3 | + |
| 4 | +describe("Managed Submitted ECE5Year Certification Add New WE Refrence", () => { |
| 5 | + it("should sucessfully create a New ECE 5 Year Application and add new WE reference", () => { |
| 6 | + /** Dashboard */ |
| 7 | + cy.get(selectors.dashboard.applyNowButton).click(); |
| 8 | + |
| 9 | + /** Certification Type */ |
| 10 | + cy.get(selectors.certificationType.applyNowEceFiveYearButton).click(); |
| 11 | + |
| 12 | + /** Application Requirements */ |
| 13 | + cy.get(selectors.certificationType.iteCheckBox).uncheck({ force: true }); |
| 14 | + cy.get(selectors.certificationType.sneCheckBox).uncheck({ force: true }); |
| 15 | + cy.get(selectors.applicationRequirements.applyNowButton).click(); |
| 16 | + |
| 17 | + /** Declaration */ |
| 18 | + cy.get(selectors.declaration.declarationCheckbox).check({ force: true }); |
| 19 | + cy.get(selectors.declaration.continueButton).click(); |
| 20 | + |
| 21 | + /** Contact Information */ |
| 22 | + cy.get(selectors.applicationWizard.saveAndContinueButton).click(); |
| 23 | + |
| 24 | + /** Education */ |
| 25 | + cy.get(selectors.education.addEducationButton).click(); |
| 26 | + |
| 27 | + cy.get(selectors.education.provinceDropDownList).should("exist").type("British Columbia"); |
| 28 | + |
| 29 | + cy.get(selectors.education.postSecondaryInstitutionDropDownList).should("exist").type("Other"); |
| 30 | + cy.get("body").click({ force: true }); |
| 31 | + |
| 32 | + cy.get(selectors.education.institutionNameInput).type("TEST Educational Institution"); |
| 33 | + |
| 34 | + cy.get(selectors.education.programNameInput).type("TEST ECE 5 Year Course"); |
| 35 | + |
| 36 | + /* Start Date - DatePicker*/ |
| 37 | + cy.get(selectors.education.programStartDateInput).click({ force: true }); |
| 38 | + cy.get(selectors.education.programStartDateInput).clear(); |
| 39 | + cy.get(selectors.education.programStartDateInput).type(`${courseStartDay} {enter}`); |
| 40 | + |
| 41 | + /* End Date - DatePicker*/ |
| 42 | + cy.get(selectors.education.programEndDateInput).click({ force: true }); |
| 43 | + cy.get(selectors.education.programEndDateInput).clear(); |
| 44 | + cy.get(selectors.education.programEndDateInput).type(`${courseEndDay} {enter}`); |
| 45 | + |
| 46 | + cy.get(selectors.education.studentIDInput).type("1234"); |
| 47 | + cy.get(selectors.education.nameOnTranscriptRadioDiv).within(() => { |
| 48 | + cy.get(selectors.elementType.radio).first().check({ force: true }); |
| 49 | + }); |
| 50 | + cy.get(selectors.education.transcriptStatusRadioDiv).within(() => { |
| 51 | + cy.get(selectors.elementType.radio).first().check({ force: true }); |
| 52 | + }); |
| 53 | + cy.get(selectors.education.saveEducationButton).click(); |
| 54 | + |
| 55 | + cy.get(selectors.applicationWizard.saveAndContinueButton).click(); |
| 56 | + |
| 57 | + /** Character Reference */ |
| 58 | + cy.get(selectors.characterReference.lastNameInput).type("CharacterReferenceLastName"); |
| 59 | + cy.get(selectors.characterReference.firstNameInput).type("CharacterReferenceFirstName"); |
| 60 | + cy.get(selectors.characterReference.emailInput).type("[email protected]"); |
| 61 | + cy.get(selectors.characterReference.phoneNumberInput).type("1234567890"); |
| 62 | + |
| 63 | + cy.get(selectors.applicationWizard.saveAndContinueButton).click(); |
| 64 | + |
| 65 | + /** Work Experience Reference */ |
| 66 | + cy.document().its("readyState").should("eq", "complete"); |
| 67 | + cy.get(selectors.workExperienceReference.addReferenceButton).click(); |
| 68 | + |
| 69 | + cy.get(selectors.workExperienceReference.lastNameInput).type("WorkReferenceLastName"); |
| 70 | + cy.get(selectors.workExperienceReference.firstNameInput).type("WorkReferenceFirstName"); |
| 71 | + cy.get(selectors.workExperienceReference.emailInput).type("[email protected]"); |
| 72 | + cy.get(selectors.workExperienceReference.phoneNumberInput).type("1234567890"); |
| 73 | + cy.get(selectors.workExperienceReference.hoursInput).type("500"); |
| 74 | + |
| 75 | + cy.get(selectors.workExperienceReference.saveReferenceButton).click(); |
| 76 | + |
| 77 | + cy.get(selectors.applicationWizard.saveAndContinueButton).click(); |
| 78 | + |
| 79 | + /** Application Review and Submit */ |
| 80 | + cy.document().its("readyState").should("eq", "complete"); |
| 81 | + |
| 82 | + cy.contains("Review and submit").should("be.visible"); |
| 83 | + cy.get(selectors.applicationPreview.certificationType).should("be.visible").should("contain.text", "ECE Five Year"); |
| 84 | + cy.get(selectors.applicationPreview.characterReferenceFirstName).should("be.visible").should("contain.text", "CharacterReferenceFirstName"); |
| 85 | + cy.get(selectors.applicationPreview.characterReferenceLastName).should("be.visible").should("contain.text", "CharacterReferenceLastName"); |
| 86 | + cy.get(selectors.applicationPreview.characterReferenceEmail).should("be.visible").should("contain.text", "[email protected]"); |
| 87 | + cy.get(selectors.applicationPreview.educationCountry).should("be.visible").should("contain.text", "Canada"); |
| 88 | + cy.get(selectors.applicationPreview.educationProvince).should("be.visible").should("contain.text", "British Columbia"); |
| 89 | + |
| 90 | + cy.get(selectors.applicationPreview.workReferenceName).should("be.visible").should("contain.text", "WorkReferenceFirstName"); |
| 91 | + cy.get(selectors.applicationPreview.workReferenceName).should("be.visible").should("contain.text", "WorkReferenceLastName"); |
| 92 | + cy.get(selectors.applicationPreview.workReferenceEmail).should("be.visible").should("contain.text", "[email protected]"); |
| 93 | + |
| 94 | + cy.get(selectors.applicationWizard.submitApplicationButton).click(); |
| 95 | + |
| 96 | + /** Application Submitted */ |
| 97 | + cy.document().its("readyState").should("eq", "complete"); |
| 98 | + cy.get(selectors.applicationSubmitted.pageTitle).should("be.visible").should("contain.text", "Application Submitted"); |
| 99 | + cy.get(selectors.applicationSubmitted.applicationSummaryButton).should("be.visible").should("contain.text", "Go to application summary"); |
| 100 | + |
| 101 | + // Manage Submitted Application |
| 102 | + cy.get(selectors.elementType.spanbutton).contains('Home').click(); |
| 103 | + cy.reload(); |
| 104 | + cy.get(selectors.elementType.spanbutton).contains('Manage Application').click(); |
| 105 | + cy.get(selectors.elementType.text_links).contains('500 hours of work experience with reference').click() |
| 106 | + cy.get('body').then($body => { |
| 107 | + if ($body.find('p.text-links:contains("WorkReference")').length > 0) { |
| 108 | + // Element exists → click it |
| 109 | + cy.get(selectors.elementType.text_links).contains('WorkReference').click(); |
| 110 | + } else { |
| 111 | + // Element not found → fallback |
| 112 | + cy.wait(80000); |
| 113 | + cy.contains('a','Back to application summary').click(); |
| 114 | + } |
| 115 | + }); |
| 116 | + cy.get(selectors.elementType.text_links).contains('500 hours of work experience with reference').click() |
| 117 | + cy.get(selectors.elementType.text_links).contains('WorkReferenceFirstName WorkReferenceLastName').click(); |
| 118 | + cy.contains('a','Choose a new reference').click({ force: true }); |
| 119 | + |
| 120 | + |
| 121 | + cy.get('[aria-label="Last name"]').type("WorkReferenceLastName"); |
| 122 | + cy.get('[aria-label="First name"]').type("WorkReferenceLastName"); |
| 123 | + cy.get('[aria-label="Email"]').type("[email protected]"); |
| 124 | + cy.get('[aria-label="Phone number (optional)"]').type("1234567890"); |
| 125 | + cy.get('[aria-label="Work experience hours observed by reference"]').type("500"); |
| 126 | + cy.get(selectors.elementType.spanbutton).contains('Save new reference').click(); |
| 127 | + |
| 128 | + }); |
| 129 | +}); |
0 commit comments