diff --git a/testing/cypress/e2e/tests/nvrfForm.cy.js b/testing/cypress/e2e/tests/nvrfForm.cy.js
index 4519f7eb..be60c769 100644
--- a/testing/cypress/e2e/tests/nvrfForm.cy.js
+++ b/testing/cypress/e2e/tests/nvrfForm.cy.js
@@ -1,348 +1,498 @@
/* eslint-disable no-undef */
///
const data = require("../../fixtures/data.json");
+import { pageObjects } from '../../support/pageObjects.js'
+
describe('Validate In Person', () => {
beforeEach('login to app', () => {
cy.visit('/', {
- onBeforeLoad (win) {
+ onBeforeLoad(win) {
cy.stub(win, 'open').as('open')
}
})
-})
-
-it('Validate Update Registration', () => {
-// check eligibility page
-// verify that user CANNOT move forward with out checking box
-cy.get('[data-test="nextBtn"]').click()
-cy.get('[data-test="errorText"]').should('contain.text', 'Confirm eligibility to continue.')
-
-// verify user CAN move forward after checking box
-cy.get('[data-test="checkBox"]').click()
-// todo: come back after fix
-// cy.get('[data-test="errorText"]').should('not.exist')
-
-cy.get('[data-test="nextBtn"]').click()
-
-// select registration option
-cy.get('[data-test="pathBtn"]').then(btn => {
- cy.get(btn[0]).click({force: true})
-})
-
-// fill out personal information
-// * check that user can not move forward without filling out fields
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('exist')
-
-cy.get('[data-test="select"]').then(dropdown => {
- // title
- cy.get(dropdown[0]).select(data.personalInformationTitle)
- cy.get(dropdown[0]).should('contain', data.personalInformationTitle)
- // suffix
- cy.get(dropdown[1]).select(data.personalInformationSuffix)
- cy.get(dropdown[1]).should('contain', data.personalInformationSuffix)
-})
-
-cy.get('[data-test="firstName"]').type(data.personalInformationName)
-cy.get('[data-test="middleName"]').type(data.personalInformationMiddle)
-cy.get('[data-test="lastName"]').type(data.personalInformationLast)
-cy.get('[data-test="phoneNumber"]').type(data.personalInformationNumber)
-// Validate text box has correct text
-cy.get('[data-test="firstName"]').should('have.value', data.personalInformationName)
-cy.get('[data-test="middleName"]').should('have.value', data.personalInformationMiddle)
-cy.get('[data-test="lastName"]').should('have.value', data.personalInformationLast)
-cy.get('[data-test="phoneNumber"]').should('contain.value', data.personalInformationNumber2)
-
-// * check previous name fields
-cy.get('[data-test="checkBox"]').click({force: true})
-cy.get('[data-test="prevFirstName"]').type(data.personalInformationName)
-cy.get('[data-test="prevMiddleName"]').type(data.personalInformationMiddle)
-cy.get('[data-test="prevLastName"]').type(data.personalInformationLast)
-// Validate text box has correct text
-cy.get('[data-test="prevFirstName"]').should('have.value', data.personalInformationName)
-cy.get('[data-test="prevMiddleName"]').should('have.value', data.personalInformationMiddle)
-cy.get('[data-test="prevLastName"]').should('have.value', data.personalInformationLast)
-
-// * check date of birth fields
-cy.get('[data-test="dobMonth"]').type(data.personalInformationMonth)
-cy.get('[data-test="dobDay"]').type(data.personalInformationDay)
-cy.get('[data-test="dobYear"]').type(data.personalInformationYear)
-// Validate text box has correct text
-cy.get('[data-test="dobMonth"]').should('have.value', data.personalInformationDay)
-cy.get('[data-test="dobDay"]').should('have.value', data.personalInformationDay)
-cy.get('[data-test="dobYear"]').should('have.value', data.personalInformationYear)
-
-cy.get('[data-test="nextBtn"]').click()
-
-// address and location page
-// * check that user can not move forward without filling out fields
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('be.visible')
-
-// * check that current address works
-cy.get('[data-test="street"]').type(data.addressStreet)
-cy.get('[data-test="aptNumber"]').type(data.addressApt)
-cy.get('[data-test="city"]').type(data.addressTown)
-cy.get('[data-test="zip"]').type(data.addressZip)
- // Validate text box has correct text
-cy.get('[data-test="street"]').should('have.value', data.addressStreet)
-cy.get('[data-test="aptNumber"]').should('have.value', data.addressApt)
-cy.get('[data-test="city"]').should('have.value', data.addressTown)
-cy.get('[data-test="zip"]').should('have.value', data.addressZip)
-
-// * check that mailing address work
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[1]).click({force: true})
-})
-
-cy.get('[data-test="mailStreet"]').type(data.addressStreet)
-cy.get('[data-test="mailCity"]').type(data.addressTown)
-cy.get('[data-test="mailZip"]').type(data.addressZip)
- // Validate text box has correct text
-cy.get('[data-test="mailStreet"]').should('have.value', data.addressStreet)
-cy.get('[data-test="mailCity"]').should('have.value', data.addressTown)
-cy.get('[data-test="mailZip"]').should('have.value', data.addressZip)
-
-// * uncheck mailing address block
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[1]).click({force: true})
-})
-
-// * check recently moved option
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[0]).click({force: true})
-})
-
-cy.get('[data-test="prevStreet"]').type(data.addressStreet)
-cy.get('[data-test="prevAptNumber"]').type(data.addressApt)
-cy.get('[data-test="prevCity"]').type(data.addressTown)
-cy.get('[data-test="prevZip"]').type(data.addressZip)
- // Validate text box has correct text
-cy.get('[data-test="prevStreet"]').should('have.value', data.addressStreet)
-cy.get('[data-test="prevAptNumber"]').should('have.value', data.addressApt)
-cy.get('[data-test="prevCity"]').should('have.value', data.addressTown)
-cy.get('[data-test="prevZip"]').should('have.value', data.addressZip)
-
- // * uncheck recently moved block
- cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[0]).click({force: true})
})
- // * check does not have permanent option
- cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[1]).click({force: true})
- })
-
- cy.get('[data-testid="Select"]').select(data.addressState)
+ it('Validate Update Registration', () => {
+ // check eligibility page
+ // verify that user CANNOT move forward with out checking box
+ pageObjects
+ .nextBtn().click()
+ pageObjects
+ .errorText().should('contain.text', 'Confirm eligibility to continue.')
+
+ // verify user CAN move forward after checking box
+ pageObjects
+ .checkBox().click()
+ // todo: come back after fix
+ // pageObjects
+ // .errorText().should('not.exist')
+ pageObjects
+ .nextBtn().click()
+
+ // select registration option
+ pageObjects
+ .pathBtn().then(btn => {
+ cy.get(btn[0]).click({ force: true })
+ })
+
+ // fill out personal information
+ // * check that user can not move forward without filling out fields
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('exist')
+
+ pageObjects
+ .select().then(dropdown => {
+ // title
+ cy.get(dropdown[0]).select(data.personalInformationTitle)
+ cy.get(dropdown[0]).should('contain', data.personalInformationTitle)
+ // suffix
+ cy.get(dropdown[1]).select(data.personalInformationSuffix)
+ cy.get(dropdown[1]).should('contain', data.personalInformationSuffix)
+ })
+
+ pageObjects
+ .firstName().type(data.personalInformationName)
+ pageObjects
+ .middleName().type(data.personalInformationMiddle)
+ pageObjects
+ .lastName().type(data.personalInformationLast)
+ pageObjects
+ .phoneNumber().type(data.personalInformationNumber)
+ // Validate text box has correct text
+ pageObjects
+ .firstName().should('have.value', data.personalInformationName)
+ pageObjects
+ .middleName().should('have.value', data.personalInformationMiddle)
+ pageObjects
+ .lastName().should('have.value', data.personalInformationLast)
+ pageObjects
+ .phoneNumber().should('contain.value', data.personalInformationNumber2)
+
+ // * check previous name fields
+ pageObjects
+ .checkBox().click({ force: true })
+ pageObjects
+ .prevFirstName().type(data.personalInformationName)
+ pageObjects
+ .prevMiddleName().type(data.personalInformationMiddle)
+ pageObjects
+ .prevLastName().type(data.personalInformationLast)
+ // Validate text box has correct text
+ pageObjects
+ .prevFirstName().should('have.value', data.personalInformationName)
+ pageObjects
+ .prevMiddleName().should('have.value', data.personalInformationMiddle)
+ pageObjects
+ .prevLastName().should('have.value', data.personalInformationLast)
+
+ // * check date of birth fields
+ pageObjects
+ .dobMonth().type(data.personalInformationMonth)
+ pageObjects
+ .dobDay().type(data.personalInformationDay)
+ pageObjects
+ .dobYear().type(data.personalInformationYear)
+ // Validate text box has correct text
+ pageObjects
+ .dobMonth().should('have.value', data.personalInformationDay)
+ pageObjects
+ .dobDay().should('have.value', data.personalInformationDay)
+ pageObjects
+ .dobYear().should('have.value', data.personalInformationYear)
+
+ pageObjects
+ .nextBtn().click()
+
+ // address and location page
+ // * check that user can not move forward without filling out fields
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('be.visible')
+
+ // * check that current address works
+ pageObjects
+ .street().type(data.addressStreet)
+ pageObjects
+ .aptNumber().type(data.addressApt)
+ pageObjects
+ .city().type(data.addressTown)
+ pageObjects
+ .zip().type(data.addressZip)
+ // Validate text box has correct text
+ pageObjects
+ .street().should('have.value', data.addressStreet)
+ pageObjects
+ .aptNumber().should('have.value', data.addressApt)
+ pageObjects
+ .city().should('have.value', data.addressTown)
+ pageObjects
+ .zip().should('have.value', data.addressZip)
+
+ // * check that mailing address work
+ pageObjects
+ .checkBox().then(checkBox => {
+ cy.get(checkBox[1]).click({ force: true })
+ })
+
+ pageObjects
+ .mailStreet().type(data.addressStreet)
+ pageObjects
+ .mailCity().type(data.addressTown)
+ pageObjects
+ .mailZip().type(data.addressZip)
+ // Validate text box has correct text
+ pageObjects
+ .mailStreet().should('have.value', data.addressStreet)
+ pageObjects
+ .mailCity().should('have.value', data.addressTown)
+ pageObjects
+ .mailZip().should('have.value', data.addressZip)
+
+ // * uncheck mailing address block
+ pageObjects
+ .checkBox().then(checkBox => {
+ cy.get(checkBox[1]).click({ force: true })
+ })
+
+ // * check recently moved option
+ pageObjects
+ .checkBox().then(checkBox => {
+ cy.get(checkBox[0]).click({ force: true })
+ })
+
+ pageObjects
+ .prevStreet().type(data.addressStreet)
+ pageObjects
+ .prevAptNumber().type(data.addressApt)
+ pageObjects
+ .prevCity().type(data.addressTown)
+ pageObjects
+ .prevZip().type(data.addressZip)
+ // Validate text box has correct text
+ pageObjects
+ .prevStreet().should('have.value', data.addressStreet)
+ pageObjects
+ .prevAptNumber().should('have.value', data.addressApt)
+ pageObjects
+ .prevCity().should('have.value', data.addressTown)
+ pageObjects
+ .prevZip().should('have.value', data.addressZip)
+
+ // * uncheck recently moved block
+ pageObjects
+ .checkBox().then(checkBox => {
+ cy.get(checkBox[0]).click({ force: true })
+ })
+
+ // * check does not have permanent option
+ pageObjects
+ .checkBox().then(checkBox => {
+ cy.get(checkBox[1]).click({ force: true })
+ })
+ pageObjects
+ .select().select(data.addressState)
// Validate text box has correct text for mailing address
- cy.get('[data-test="mailStreet"]').should('have.value', data.addressStreet)
- cy.get('[data-test="mailCity"]').should('have.value', data.addressTown)
- cy.get('[data-test="mailZip"]').should('have.value', data.addressZip)
-
-cy.get('[data-test="nextBtn"]').click()
-
-// identification
-// * check that user can not move forward without selecting an option
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('be.visible')
-
-// * state driver's license number
-cy.get('[data-test="dropDown"]').select("State driver's license number")
-cy.get('[data-test="driverId"]').type(data.idNumber)
-
-// Validate that fields have correct data
-cy.get('[data-test="driverId"]').should('have.value', data.idNumber)
-
-// * social security number (last 4 digits)
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("Social security number (last 4 digits)")
-})
-cy.get('[data-test="ssn"]').type(data.ssn)
-// Validate fields have correct data
-cy.get('[data-test="dropDown"]').should('have.value', data.ssnValue)
-cy.get('[data-test="ssn"]').should('have.value', data.ssn)
-
-// * no id
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("I do not have a valid ID.")
-})
-cy.get('p').should('contain.text', '"None" will appear on your completed form.')
-
-cy.get('[data-test="nextBtn"]').click()
-
- // political party
- cy.get('[data-test="politicalParty"]').type(data.politicalParty)
-
-cy.get('[data-test="nextBtn"]').click()
-
-// confirmation page
-cy.get('[data-test="confirm"]').click({force: true})
-cy.get('[data-test="nextBtn"]').click()
-
-cy.get('[data-test="addressConfirm"]').should('contain.text', 'Your Alabama mail-in registration form is complete and ready to print.')
-// * check that download opens in new window
-cy.get('[data-test="pdfBtnNewTab"]').click()
-cy.get('@open').should('have.been.calledOnce')
-
-})
-
-it('Validate New Registration', () => {
-// go to next page
-cy.get('[data-test="nextBtn"]').click()
-
-// check eligibility page
-// verify that user CANNOT move forward with out checking box
-cy.get('[data-test="nextBtn"]').click()
-cy.get('[data-test="errorText"]').should('contain.text', 'Confirm eligibility to continue.')
-
-// verify user CAN move forward after checking box
-cy.get('[data-test="checkBox"]').click()
-// todo: come back when fixed
-// cy.get('[data-test="errorText"]').should('not.exist')
-
-
-cy.get('[data-test="nextBtn"]').click()
-
-// select registration option
-cy.get('[data-test="pathBtn"]').then(btn => {
- cy.get(btn[1]).click({force: true})
-})
-
-// fill out personal information
-// * check that user can not move forward without filling out fields
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('exist')
-
-cy.get('[data-test="select"]').then(dropdown => {
- // title
- cy.get(dropdown[0]).select(data.personalInformationTitle)
- cy.get(dropdown[0]).should('contain', data.personalInformationTitle)
- // suffix
- cy.get(dropdown[1]).select(data.personalInformationSuffix)
- cy.get(dropdown[1]).should('contain', data.personalInformationSuffix)
-})
-
-cy.get('[data-test="firstName"]').type(data.personalInformationName)
-cy.get('[data-test="middleName"]').type(data.personalInformationMiddle)
-cy.get('[data-test="lastName"]').type(data.personalInformationLast)
-cy.get('[data-test="phoneNumber"]').type(data.personalInformationNumber)
-// Validate text box has correct text
-cy.get('[data-test="firstName"]').should('have.value', data.personalInformationName)
-cy.get('[data-test="middleName"]').should('have.value', data.personalInformationMiddle)
-cy.get('[data-test="lastName"]').should('have.value', data.personalInformationLast)
-cy.get('[data-test="phoneNumber"]').should('contain.value', data.personalInformationNumber2)
-
-cy.get('[data-test="dobMonth"]').type(data.personalInformationMonth)
-cy.get('[data-test="dobDay"]').type(data.personalInformationDay)
-cy.get('[data-test="dobYear"]').type(data.personalInformationYear)
-// Validate text box has correct text
-cy.get('[data-test="dobMonth"]').should('have.value', data.personalInformationDay)
-cy.get('[data-test="dobDay"]').should('have.value', data.personalInformationDay)
-cy.get('[data-test="dobYear"]').should('have.value', data.personalInformationYear)
-
-cy.get('[data-test="nextBtn"]').click()
-
-
-// address and location page
-// * check that user can not move forward without filling out fields
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('be.visible')
-
-// * check that current address works
-cy.get('[data-test="street"]').type(data.addressStreet)
-cy.get('[data-test="aptNumber"]').type(data.addressApt)
-cy.get('[data-test="city"]').type(data.addressTown)
-cy.get('[data-test="zip"]').type(data.addressZip)
- // Validate text box has correct text
-cy.get('[data-test="street"]').should('have.value', data.addressStreet)
-cy.get('[data-test="aptNumber"]').should('have.value', data.addressApt)
-cy.get('[data-test="city"]').should('have.value', data.addressTown)
-cy.get('[data-test="zip"]').should('have.value', data.addressZip)
-
-// * check that mailing address work
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[1]).click({force: true})
-})
-cy.get('[data-test="mailStreet"]').type(data.addressStreet)
-cy.get('[data-test="mailCity"]').type(data.addressTown)
-cy.get('[data-test="mailZip"]').type(data.addressZip)
- // Validate text box has correct text
-cy.get('[data-test="mailStreet"]').should('have.value', data.addressStreet)
-cy.get('[data-test="mailCity"]').should('have.value', data.addressTown)
-cy.get('[data-test="mailZip"]').should('have.value', data.addressZip)
-
-// * uncheck mailing address block
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[1]).click({force: true})
-})
-
-// * check does not have permanent option
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[0]).click({force: true})
-})
-
-cy.get('[data-test="mailStreet"]').type(data.addressStreet)
-cy.get('[data-test="mailCity"]').type(data.addressTown)
-cy.get('[data-test="mailZip"]').type(data.addressZip)
- cy.get('[class="usa-select radius-md"]').select(data.addressState)
-
- // Validate text box has correct text
-cy.get('[data-test="mailStreet"]').should('have.value', data.addressStreet)
-cy.get('[data-test="mailCity"]').should('have.value', data.addressTown)
-cy.get('[data-test="mailZip"]').should('have.value', data.addressZip)
-
-cy.get('[data-test="nextBtn"]').click()
-
-// identification
-// * check that user can not move forward without selecting an option
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('be.visible')
-
-// * state driver's license number
-cy.get('[data-test="dropDown"]').select("State driver's license number")
-cy.get('[data-test="driverId"]').type(data.idNumber)
-
-// Validate that fields have correct data
- cy.get('[data-test="driverId"]').should('have.value', data.idNumber)
-// * state id number
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("State non-driver ID")
-})
-cy.get('[data-test="stateId"]').type(data.idNumber)
-
-// Validate that fields have correct data
- cy.get('[data-test="stateId"]').should('have.value', data.idNumber)
-// * social security number (last 4 digits)
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("Social security number (last 4 digits)")
-})
-cy.get('[data-test="ssn"]').type(data.ssn)
-// Validate fields have correct data
-cy.get('[data-test="dropDown"]').should('have.value', data.ssnValue)
-cy.get('[data-test="ssn"]').should('have.value', data.ssn)
-
-// * no id
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("I do not have a valid ID.")
-})
-cy.get('p').should('contain.text', '"None" will appear on your completed form.')
-
-cy.get('[data-test="nextBtn"]').click()
-
- // political party
- cy.get('[data-test="politicalParty"]').type(data.politicalParty)
-
- cy.get('[data-test="nextBtn"]').click()
-
-// confirmation page
-cy.get('[data-test="confirm"]').click({force: true})
-cy.get('[data-test="nextBtn"]').click()
+ pageObjects
+ .mailStreet().should('have.value', data.addressStreet)
+ pageObjects
+ .mailCity().should('have.value', data.addressTown)
+ pageObjects
+ .mailZip().should('have.value', data.addressZip)
+
+ pageObjects
+ .nextBtn().click()
+
+ // identification
+ // * check that user can not move forward without selecting an option
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('be.visible')
+
+ // * state driver's license number
+ pageObjects
+ .dropDown().select("State driver's license number")
+ pageObjects
+ .driverId().type(data.idNumber)
+
+ // Validate that fields have correct data
+ pageObjects
+ .driverId().should('have.value', data.idNumber)
+
+ // * social security number (last 4 digits)
+ pageObjects
+ .dropDown().then(dropDown => {
+ cy.get(dropDown[0]).select("Social security number (last 4 digits)")
+ })
+ pageObjects
+ .ssn().type(data.ssn)
+ // Validate fields have correct data
+ pageObjects
+ .dropDown().should('have.value', data.ssnValue)
+ pageObjects
+ .ssn().should('have.value', data.ssn)
+
+ // * no id
+ pageObjects
+ .dropDown().then(dropDown => {
+ cy.get(dropDown[0]).select("I do not have a valid ID.")
+ })
+ cy.get('p').should('contain.text', '"None" will appear on your completed form.')
+
+ pageObjects
+ .nextBtn().click()
+
+ // political party
+ pageObjects
+ .politicalParty().type(data.politicalParty)
+
+ pageObjects
+ .nextBtn().click()
+
+ // confirmation page
+ pageObjects
+ .confirm().click({ force: true })
+ pageObjects
+ .nextBtn().click()
+
+ pageObjects
+ .addressConfirm().should('contain.text', 'Your Alabama mail-in registration form is complete and ready to print.')
+ // * check that download opens in new window
+ pageObjects
+ .pdfBtnNewTab().click()
+ cy.get('@open').should('have.been.calledOnce')
+ })
-cy.get('[data-test="addressConfirm"]').should('contain.text', 'Your Alabama mail-in registration form is complete and ready to print.')
-// * check that download opens in new window
-cy.get('[data-test="pdfBtnNewTab"]').click()
-cy.get('@open').should('have.been.calledOnce')
+ it('Validate New Registration', () => {
+ // go to next page
+ pageObjects
+ .nextBtn().click()
+
+ // check eligibility page
+ // verify that user CANNOT move forward with out checking box
+ pageObjects
+ .nextBtn().click()
+ pageObjects
+ .errorText().should('contain.text', 'Confirm eligibility to continue.')
+
+ // verify user CAN move forward after checking box
+ pageObjects
+ .checkBox().click()
+
+ pageObjects
+ .nextBtn().click()
+
+ // select registration option
+ pageObjects
+ .pathBtn().then(btn => {
+ cy.get(btn[1]).click({ force: true })
+ })
+
+ // fill out personal information
+ // * check that user can not move forward without filling out fields
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('exist')
+
+ pageObjects
+ .select().then(dropdown => {
+ // title
+ cy.get(dropdown[0]).select(data.personalInformationTitle)
+ cy.get(dropdown[0]).should('contain', data.personalInformationTitle)
+ // suffix
+ cy.get(dropdown[1]).select(data.personalInformationSuffix)
+ cy.get(dropdown[1]).should('contain', data.personalInformationSuffix)
+ })
+
+ pageObjects
+ .firstName().type(data.personalInformationName)
+ pageObjects
+ .middleName().type(data.personalInformationMiddle)
+ pageObjects
+ .lastName().type(data.personalInformationLast)
+ pageObjects
+ .phoneNumber().type(data.personalInformationNumber)
+ // Validate text box has correct text
+ pageObjects
+ .firstName().should('have.value', data.personalInformationName)
+ pageObjects
+ .middleName().should('have.value', data.personalInformationMiddle)
+ pageObjects
+ .lastName().should('have.value', data.personalInformationLast)
+ pageObjects
+ .phoneNumber().should('contain.value', data.personalInformationNumber2)
+
+ pageObjects
+ .dobMonth().type(data.personalInformationMonth)
+ pageObjects
+ .dobDay().type(data.personalInformationDay)
+ pageObjects
+ .dobYear().type(data.personalInformationYear)
+ // Validate text box has correct text
+ pageObjects
+ .dobMonth().should('have.value', data.personalInformationDay)
+ pageObjects
+ .dobDay().should('have.value', data.personalInformationDay)
+ pageObjects
+ .dobYear().should('have.value', data.personalInformationYear)
+
+ pageObjects
+ .nextBtn().click()
+
+
+ // address and location page
+ // * check that user can not move forward without filling out fields
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('be.visible')
+
+ // * check that current address works
+ pageObjects
+ .street().type(data.addressStreet)
+ pageObjects
+ .aptNumber().type(data.addressApt)
+ pageObjects
+ .city().type(data.addressTown)
+ pageObjects
+ .zip().type(data.addressZip)
+ // Validate text box has correct text
+ pageObjects
+ .street().should('have.value', data.addressStreet)
+ pageObjects
+ .aptNumber().should('have.value', data.addressApt)
+ pageObjects
+ .city().should('have.value', data.addressTown)
+ pageObjects
+ .zip().should('have.value', data.addressZip)
+
+ // * check that mailing address work
+ pageObjects
+ .checkBox().then(checkBox => {
+ cy.get(checkBox[1]).click({ force: true })
+ })
+ pageObjects
+ .mailStreet().type(data.addressStreet)
+ pageObjects
+ .mailCity().type(data.addressTown)
+ pageObjects
+ .mailZip().type(data.addressZip)
+ // Validate text box has correct text
+ pageObjects
+ .mailStreet().should('have.value', data.addressStreet)
+ pageObjects
+ .mailCity().should('have.value', data.addressTown)
+ pageObjects
+ .mailZip().should('have.value', data.addressZip)
+
+ // * uncheck mailing address block
+ pageObjects
+ .checkBox().then(checkBox => {
+ cy.get(checkBox[1]).click({ force: true })
+ })
+
+ // * check does not have permanent option
+ pageObjects
+ .checkBox().then(checkBox => {
+ cy.get(checkBox[0]).click({ force: true })
+ })
+
+ pageObjects
+ .mailStreet().type(data.addressStreet)
+ pageObjects
+ .mailCity().type(data.addressTown)
+ pageObjects
+ .mailZip().type(data.addressZip)
+ cy.get('[class="usa-select radius-md"]').select(data.addressState)
+
+ // Validate text box has correct text
+ pageObjects
+ .mailStreet().should('have.value', data.addressStreet)
+ pageObjects
+ .mailCity().should('have.value', data.addressTown)
+ pageObjects
+ .mailZip().should('have.value', data.addressZip)
+
+ pageObjects
+ .nextBtn().click()
+
+ // identification
+ // * check that user can not move forward without selecting an option
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('be.visible')
+
+ // * state driver's license number
+ pageObjects
+ .dropDown().select("State driver's license number")
+ pageObjects
+ .driverId().type(data.idNumber)
+
+ // Validate that fields have correct data
+ pageObjects
+ .driverId().should('have.value', data.idNumber)
+ // * state id number
+ pageObjects
+ .dropDown().then(dropDown => {
+ cy.get(dropDown[0]).select("State non-driver ID")
+ })
+
+ pageObjects
+ .stateId().type(data.idNumber)
+
+ // Validate that fields have correct data
+ pageObjects
+ .stateId().should('have.value', data.idNumber)
+ // * social security number (last 4 digits)
+ pageObjects
+ .dropDown().then(dropDown => {
+ cy.get(dropDown[0]).select("Social security number (last 4 digits)")
+ })
+ pageObjects
+ .ssn().type(data.ssn)
+ // Validate fields have correct data
+ pageObjects
+ .dropDown().should('have.value', data.ssnValue)
+ pageObjects
+ .ssn().should('have.value', data.ssn)
+
+ // * no id
+ pageObjects
+ .dropDown().then(dropDown => {
+ cy.get(dropDown[0]).select("I do not have a valid ID.")
+ })
+ cy.get('p').should('contain.text', '"None" will appear on your completed form.')
+
+ pageObjects
+ .nextBtn().click()
+
+ // political party
+ pageObjects
+ .politicalParty().type(data.politicalParty)
+
+ pageObjects
+ .nextBtn().click()
+
+ // confirmation page
+ pageObjects
+ .confirm().click({ force: true })
+ pageObjects
+ .nextBtn().click()
+
+
+ pageObjects
+ .addressConfirm().should('contain.text', 'Your Alabama mail-in registration form is complete and ready to print.')
+ // * check that download opens in new window
+ pageObjects
+ .pdfBtnNewTab().click()
+ cy.get('@open').should('have.been.calledOnce')
})
})
diff --git a/testing/cypress/e2e/tests/verifyErrors.cy.js b/testing/cypress/e2e/tests/verifyErrors.cy.js
index 44cc54b4..001465a1 100644
--- a/testing/cypress/e2e/tests/verifyErrors.cy.js
+++ b/testing/cypress/e2e/tests/verifyErrors.cy.js
@@ -1,85 +1,130 @@
/* eslint-disable no-undef */
///
const data = require("../../fixtures/data.json");
+import { pageObjects } from '../../support/pageObjects.js'
describe('Validate Errors', () => {
beforeEach('login to app', () => {
cy.visit('/')
})
-it('Check Error Functions', () => {
-// Move forward in test
-cy.get('[data-test="nextBtn"]').click()
-cy.get('[data-test="nextBtn"]').click()
-cy.get('[data-test="checkBox"]').click()
-cy.get('[data-test="nextBtn"]').click()
+ it('Check Error Functions', () => {
+ // Move forward in test
+ pageObjects
+ .nextBtn().click()
+ pageObjects
+ .nextBtn().click()
+ pageObjects
+ .checkBox().click()
+ pageObjects
+ .nextBtn().click()
-// select registration option
-cy.get('[data-test="pathBtn"]').then(btn => {
- cy.get(btn[1]).click()
-})
+ // select registration option
+ pageObjects
+ .pathBtn().then(btn => {
+ cy.get(btn[1]).click()
+ })
-// check errors on personal information are working
-// * testing required fields are filled out before user can move forward
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('contain.text', 'First name must be filled out.')
-cy.get('[data-test="firstName"]').type(data.personalInformationName)
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('contain.text', 'Last name must be filled out.')
-cy.get('[data-test="lastName"]').type(data.personalInformationLast)
+ // check errors on personal information are working
+ // * testing required fields are filled out before user can move forward
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('contain.text', 'First name must be filled out.')
+ pageObjects
+ .firstName().type(data.personalInformationName)
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('contain.text', 'Last name must be filled out.')
+ pageObjects
+ .lastName().type(data.personalInformationLast)
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('contain.text', 'Date of birth must follow the format of 01 19 2000.')
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('contain.text', 'Date of birth must follow the format of 01 19 2000.')
-cy.get('[data-test="dobMonth"]').type(data.personalInformationMonth)
-cy.get('[data-test="dobDay"]').type(data.personalInformationDay)
-cy.get('[data-test="dobYear"]').type(data.personalInformationYear)
+ pageObjects
+ .dobMonth().type(data.personalInformationMonth)
+ pageObjects
+ .dobDay().type(data.personalInformationDay)
+ pageObjects
+ .dobYear().type(data.personalInformationYear)
-cy.get('[data-test="nextBtn"]').click()
+ pageObjects
+ .nextBtn().click()
-// address and location page
-// * check that errors for required fields are working
- cy.get('[data-test="nextBtn"]').click().click()
- cy.get('[data-test="errorText"]').should('contain.text', 'Street address must be filled out.')
- cy.get('[data-test="street"]').type(data.addressStreet)
- cy.get('[data-test="nextBtn"]').click().click()
- cy.get('[data-test="errorText"]').should('contain.text', 'City name must be filled out.')
- cy.get('[data-test="city"]').type(data.addressTown)
- cy.get('[data-test="nextBtn"]').click().click()
- cy.get('[data-test="errorText"]').should('contain.text', 'ZIP code must be 5 digits.')
- cy.get('[data-test="zip"]').type(data.addressZip)
+ // address and location page
+ // * check that errors for required fields are working
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('contain.text', 'Street address must be filled out.')
+ pageObjects
+ .street().type(data.addressStreet)
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('contain.text', 'City name must be filled out.')
+ pageObjects
+ .city().type(data.addressTown)
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('contain.text', 'ZIP code must be 5 digits.')
+ pageObjects
+ .zip().type(data.addressZip)
-cy.get('[data-test="nextBtn"]').click()
+ pageObjects
+ .nextBtn().click()
-// identification
-// * state driver's license number required fields are needed to move forward
-cy.get('[data-test="dropDown"]').select("State driver's license number")
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('contain.text', 'ID number must be filled out.')
-cy.get('[data-test="driverId"]').type(data.idNumber)
-// * state id number
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("State non-driver ID")
-})
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('contain.text', 'ID number must be filled out.')
-cy.get('[data-test="stateId"]').type(data.idNumber)
+ // identification
+ // * state driver's license number required fields are needed to move forward
+ pageObjects
+ .dropDown().select("State driver's license number")
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('contain.text', 'ID number must be filled out.')
+ pageObjects
+ .driverId().type(data.idNumber)
+ // * state id number
+ pageObjects
+ .dropDown().then(dropDown => {
+ cy.get(dropDown[0]).select("State non-driver ID")
+ })
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('contain.text', 'ID number must be filled out.')
+ pageObjects
+ .stateId().type(data.idNumber)
-// * social security number (last 4 digits)
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("Social security number (last 4 digits)")
-})
+ // * social security number (last 4 digits)
+ pageObjects
+ .dropDown().then(dropDown => {
+ cy.get(dropDown[0]).select("Social security number (last 4 digits)")
+ })
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('contain.text', 'Social security number must be 4 digits.')
-cy.get('[data-test="ssn"]').type(data.ssn)
-cy.get('[data-test="nextBtn"]').click()
+ pageObjects
+ .nextBtn().click().click()
+ pageObjects
+ .errorText().should('contain.text', 'Social security number must be 4 digits.')
+ pageObjects
+ .ssn().type(data.ssn)
+ pageObjects
+ .nextBtn().click()
-// political party
- cy.get('[data-test="nextBtn"]').click()
+ // political party
+ pageObjects
+ .nextBtn().click()
-// confirmation page
-cy.get('[data-test="nextBtn"]').click()
-cy.get('[data-test="errorText"]').should('contain.text', 'Checkbox must be checked to continue.')
-cy.get('[data-test="confirm"]').click({force: true})
-})
+ // confirmation page
+ pageObjects
+ .nextBtn().click()
+ pageObjects
+ .errorText().should('contain.text', 'Checkbox must be checked to continue.')
+ pageObjects
+ .confirm().click({ force: true })
+ })
})
diff --git a/testing/cypress/e2e/tests/workflows.cy.js b/testing/cypress/e2e/tests/workflows.cy.js
index dab73ce5..98da86d4 100644
--- a/testing/cypress/e2e/tests/workflows.cy.js
+++ b/testing/cypress/e2e/tests/workflows.cy.js
@@ -1,6 +1,7 @@
/* eslint-disable no-undef */
///
const data = require("../../fixtures/data.json");
+import { pageObjects } from '../../support/pageObjects.js'
describe('Verify Flow Within Form', () => {
beforeEach('login to app', () => {
@@ -9,61 +10,73 @@ describe('Verify Flow Within Form', () => {
})
it('Verify Back Buttons', () => {
// check that the form back buttons will take user back to the correct page
- cy.get('[data-test="backBtn"]').should('contain.text', 'Edit registration information')
+ pageObjects
+ .backBtn().should('contain.text', 'Edit registration information')
- cy.get('[data-test="backBtn"]').click()
- cy.get('[data-test="backBtn"]').should('contain.text', 'Back to identification')
+ pageObjects
+ .backBtn().click()
+ pageObjects
+ .backBtn().should('contain.text', 'Back to identification')
- cy.get('[data-test="backBtn"]').click()
- cy.get('[data-test="backBtn"]').should('contain.text', 'Back to address and location')
+ pageObjects
+ .backBtn().click()
+ pageObjects
+ .backBtn().should('contain.text', 'Back to address and location')
- cy.get('[data-test="backBtn"]').click()
- cy.get('[data-test="backBtn"]').should('contain.text', 'Back to personal information')
+ pageObjects
+ .backBtn().click()
+ pageObjects
+ .backBtn().should('contain.text', 'Back to personal information')
- cy.get('[data-test="backBtn"]').click()
- cy.get('[data-test="backBtn"]').should('contain.text', 'Back to registration options')
-
- cy.get('[data-test="backBtn"]').click()
- cy.get('[data-test="backBtn"]').should('contain.text', 'Back to state eligibility requirements')
-
- // cy.get('[data-test="backBtn"]').click()
- // cy.get('[data-test="backBtn"]').should('contain.text', 'Go back to state registration options')
-
- // cy.get('[data-test="backBtn"]').click()
- // cy.get('[data-test="backBtn"]').should('contain.text', 'Go back to select your state')
+ pageObjects
+ .backBtn().click()
+ pageObjects
+ .backBtn().should('contain.text', 'Back to registration options')
+ pageObjects
+ .backBtn().click()
+ pageObjects
+ .backBtn().should('contain.text', 'Back to state eligibility requirements')
})
it('Verify Edit Buttons', () => {
// personal information
- cy.get('[data-test="editBtn"]').then(editBtn => {
- cy.get(editBtn[0]).click()
- cy.get('[data-testid="form"]').find('h2').should('contain.text', 'Personal information')
- cy.get('[data-test="nextBtn"]').click().click().click().click()
- })
+ pageObjects
+ .editBtn().then(editBtn => {
+ cy.get(editBtn[0]).click()
+ cy.get('[data-testid="form"]').find('h2').should('contain.text', 'Personal information')
+ pageObjects
+ .nextBtn().click().click().click().click()
+ })
// address
- cy.get('[data-test="editBtn"]').then(editBtn => {
- cy.get(editBtn[1]).click({force: true})
- cy.get('[data-testid="form"]').find('h2').should('contain.text', 'Address and location')
- cy.get('[data-test="nextBtn"]').click().click().click()
-
- })
+ pageObjects
+ .editBtn().then(editBtn => {
+ cy.get(editBtn[1]).click({ force: true })
+ cy.get('[data-testid="form"]').find('h2').should('contain.text', 'Address and location')
+ pageObjects
+ .nextBtn().click().click().click()
+
+ })
// identification
- cy.get('[data-test="editBtn"]').then(editBtn => {
- cy.get(editBtn[2]).click({force: true})
- cy.get('[data-testid="form"]').find('h2').should('contain.text', 'Identification')
- cy.get('h2').should('contain.text', 'Identification')
- cy.get('[data-test="nextBtn"]').click().click()
- })
+ pageObjects
+ .editBtn().then(editBtn => {
+ cy.get(editBtn[2]).click({ force: true })
+ cy.get('[data-testid="form"]').find('h2').should('contain.text', 'Identification')
+ cy.get('h2').should('contain.text', 'Identification')
+ pageObjects
+ .nextBtn().click().click()
+ })
// political party
- cy.get('[data-test="editBtn"]').then(editBtn => {
- cy.get(editBtn[3]).click({force: true})
- cy.get('[data-testid="form"]').find('h2').should('contain.text', 'Political party')
-
- cy.get('[data-test="nextBtn"]').click()
- })
+ pageObjects
+ .editBtn().then(editBtn => {
+ cy.get(editBtn[3]).click({ force: true })
+ cy.get('[data-testid="form"]').find('h2').should('contain.text', 'Political party')
+
+ pageObjects
+ .nextBtn().click()
+ })
})
it('Verify Fields are correct', () => {
@@ -100,11 +113,11 @@ describe('Verify Flow Within Form', () => {
cy.get(li[2]).should('contain.text', data.addressState)
cy.get(li[3]).should('contain.text', data.addressZip)
})
- // political party
- cy.get(ul[7]).find('li').then(li => {
- cy.get(li[0]).should('contain.text', data.politicalParty)
+ // political party
+ cy.get(ul[7]).find('li').then(li => {
+ cy.get(li[0]).should('contain.text', data.politicalParty)
- })
-})
+ })
+ })
})
})
\ No newline at end of file
diff --git a/testing/cypress/support/commands.js b/testing/cypress/support/commands.js
index 0ff8d33f..de7f20d9 100644
--- a/testing/cypress/support/commands.js
+++ b/testing/cypress/support/commands.js
@@ -1,3 +1,5 @@
+import { pageObjects } from './pageObjects'
+
/* eslint-disable no-undef */
Cypress.Commands.add('signin', (username, password) => {
@@ -17,27 +19,35 @@ Cypress.Commands.add('completeForm', () => {
const data = require("../fixtures/data.json");
// go to next page
-cy.get('[data-test="nextBtn"]').click()
+pageObjects
+.nextBtn().click()
// check eligibility page
// verify that user CANNOT move forward with out checking box
-cy.get('[data-test="nextBtn"]').click()
-cy.get('[data-test="errorText"]').should('contain.text', 'Confirm eligibility to continue.')
+pageObjects
+.nextBtn().click()
+pageObjects
+.errorText().should('contain.text', 'Confirm eligibility to continue.')
// verify user CAN move forward after checking box
-cy.get('[data-test="checkBox"]').click()
+pageObjects
+.checkBox().click()
// todo: come back after fix
-// cy.get('[data-test="errorText"]').should('not.exist')
+// pageObjects
+// .errorText().should('not.exist')
-cy.get('[data-test="nextBtn"]').click()
+pageObjects
+.nextBtn().click()
// select registration option
-cy.get('[data-test="pathBtn"]').then(btn => {
+pageObjects
+.pathBtn().then(btn => {
cy.get(btn[0]).click({force: true})
})
// fill out personal information
-cy.get('[data-test="select"]').then(dropdown => {
+pageObjects
+.select().then(dropdown => {
// title
cy.get(dropdown[0]).select(data.personalInformationTitle)
cy.get(dropdown[0]).should('contain', data.personalInformationTitle)
@@ -46,18 +56,27 @@ cy.get('[data-test="select"]').then(dropdown => {
cy.get(dropdown[1]).should('contain', data.personalInformationSuffix)
})
-cy.get('[data-test="firstName"]').type(data.personalInformationName)
-cy.get('[data-test="middleName"]').type(data.personalInformationMiddle)
-cy.get('[data-test="lastName"]').type(data.personalInformationLast)
-cy.get('[data-test="phoneNumber"]').type(data.personalInformationNumber)
+pageObjects
+.firstName().type(data.personalInformationName)
+pageObjects
+.middleName().type(data.personalInformationMiddle)
+pageObjects
+.lastName().type(data.personalInformationLast)
+pageObjects
+.phoneNumber().type(data.personalInformationNumber)
-cy.get('[data-test="dobMonth"]').type(data.personalInformationMonth)
-cy.get('[data-test="dobDay"]').type(data.personalInformationDay)
-cy.get('[data-test="dobYear"]').type(data.personalInformationYear)
+pageObjects
+.dobMonth().type(data.personalInformationMonth)
+pageObjects
+.dobDay().type(data.personalInformationDay)
+pageObjects
+.dobYear().type(data.personalInformationYear)
-cy.get('[data-testid="checkbox"]').click()
+pageObjects
+.checkBox().click({force: true})
-cy.get('[data-test="select"]').then(dropdown => {
+pageObjects
+.select().then(dropdown => {
// title
cy.get(dropdown[3]).select(data.personalInformationTitle)
@@ -67,93 +86,131 @@ cy.get('[data-test="select"]').then(dropdown => {
cy.get(dropdown[4]).should('contain', data.personalInformationSuffix)
})
-cy.get('[data-test="firstName"]').type(data.personalInformationName)
-cy.get('[data-test="middleName"]').type(data.personalInformationMiddle)
-cy.get('[data-test="lastName"]').type(data.personalInformationLast)
+pageObjects
+.firstName().type(data.personalInformationName)
+pageObjects
+.middleName().type(data.personalInformationMiddle)
+pageObjects
+.lastName().type(data.personalInformationLast)
-cy.get('[data-test="prevFirstName"]').type(data.personalInformationName)
-cy.get('[data-test="prevMiddleName"]').type(data.personalInformationMiddle)
-cy.get('[data-test="prevLastName"]').type(data.personalInformationLast)
+pageObjects
+.prevFirstName().type(data.personalInformationName)
+pageObjects
+.prevMiddleName().type(data.personalInformationMiddle)
+pageObjects
+.prevLastName().type(data.personalInformationLast)
-cy.get('[data-test="nextBtn"]').click()
+pageObjects
+.nextBtn().click()
// address and location page
// * check that current address works
-cy.get('[data-test="street"]').type(data.addressStreet)
-cy.get('[data-test="aptNumber"]').type(data.addressApt)
-cy.get('[data-test="city"]').type(data.addressTown)
-cy.get('[data-test="zip"]').type(data.addressZip)
+pageObjects
+.street().type(data.addressStreet)
+pageObjects
+.aptNumber().type(data.addressApt)
+pageObjects
+.city().type(data.addressTown)
+pageObjects
+.zip().type(data.addressZip)
// * check that mailing address work
-cy.get('[data-test="checkBox"]').then(checkBox => {
+pageObjects
+.checkBox().then(checkBox => {
cy.get(checkBox[2]).click({force: true})
})
-cy.get('[data-test="mailStreet"]').type(data.addressStreet)
-cy.get('[data-test="mailCity"]').type(data.addressTown)
-cy.get('[data-test="mailZip"]').type(data.addressZip)
+pageObjects
+.mailStreet().type(data.addressStreet)
+pageObjects
+.mailCity().type(data.addressTown)
+pageObjects
+.mailZip().type(data.addressZip)
// * uncheck mailing address block
-cy.get('[data-test="checkBox"]').then(checkBox => {
+pageObjects
+.checkBox().then(checkBox => {
cy.get(checkBox[2]).click({force: true})
})
// * check recently moved option
-cy.get('[data-test="checkBox"]').then(checkBox => {
+pageObjects
+.checkBox().then(checkBox => {
cy.get(checkBox[0]).click({force: true})
})
-cy.get('[data-test="prevStreet"]').type(data.addressStreet)
-cy.get('[data-test="prevAptNumber"]').type(data.addressApt)
-cy.get('[data-test="prevCity"]').type(data.addressTown)
-cy.get('[data-test="prevZip"]').type(data.addressZip)
+pageObjects
+.prevStreet().type(data.addressStreet)
+pageObjects
+.prevAptNumber().type(data.addressApt)
+pageObjects
+.prevCity().type(data.addressTown)
+pageObjects
+.prevZip().type(data.addressZip)
// * uncheck recently moved block
-cy.get('[data-test="checkBox"]').then(checkBox => {
+pageObjects
+.checkBox().then(checkBox => {
cy.get(checkBox[0]).click({force: true})
})
// * check does not have permanent option
-cy.get('[data-test="checkBox"]').then(checkBox => {
+pageObjects
+.checkBox().then(checkBox => {
cy.get(checkBox[1]).click({force: true})
})
-cy.get('[data-test="mailStreet"]').type(data.addressStreet)
-cy.get('[data-test="mailCity"]').type(data.addressTown)
-cy.get('[data-test="mailZip"]').type(data.addressZip)
-cy.get('[data-testid="Select"]').select(data.addressState)
+pageObjects
+.mailStreet().type(data.addressStreet)
+pageObjects
+.mailCity().type(data.addressTown)
+pageObjects
+.mailZip().type(data.addressZip)
+pageObjects
+.select().select(data.addressState)
-cy.get('[data-test="nextBtn"]').click()
+pageObjects
+.nextBtn().click()
// identification
// * state driver's license number
-cy.get('[data-test="dropDown"]').select("State driver's license number")
-cy.get('[data-test="driverId"]').type(data.idNumber)
+pageObjects
+.dropDown().select("State driver's license number")
+pageObjects
+.driverId().type(data.idNumber)
// * social security number (last 4 digits)
-cy.get('[data-test="dropDown"]').then(dropDown => {
+pageObjects
+.dropDown().then(dropDown => {
cy.get(dropDown[0]).select("Social security number (last 4 digits)")
})
-cy.get('[data-test="ssn"]').type(data.ssn)
+pageObjects
+.ssn().type(data.ssn)
// * no id
-cy.get('[data-test="dropDown"]').then(dropDown => {
+pageObjects
+.dropDown().then(dropDown => {
cy.get(dropDown[0]).select("I do not have a valid ID.")
})
cy.get('p').should('contain.text', '"None" will appear on your completed form.')
// * state id number
-cy.get('[data-test="dropDown"]').then(dropDown => {
+pageObjects
+.dropDown().then(dropDown => {
cy.get(dropDown[0]).select("State non-driver ID")
})
-cy.get('[data-test="stateId"]').type(data.idNumber)
+pageObjects
+.stateId().type(data.idNumber)
-cy.get('[data-test="nextBtn"]').click()
+pageObjects
+.nextBtn().click()
// political party
- cy.get('[data-test="politicalParty"]').type(data.politicalParty)
+ pageObjects
+.politicalParty().type(data.politicalParty)
- cy.get('[data-test="nextBtn"]').click()
+ pageObjects
+.nextBtn().click()
})
diff --git a/testing/cypress/support/not-needed.cy.js b/testing/cypress/support/not-needed.cy.js
deleted file mode 100644
index a7203322..00000000
--- a/testing/cypress/support/not-needed.cy.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/* eslint-disable no-undef */
-///
-const data = require("../../fixtures/data.json");
-
-describe('Validate Not Needed', () => {
- beforeEach('login to app', () => {
- cy.visit('/')
- cy.signin(Cypress.env('username'), Cypress.env('password'))
- // cy.get('[data-test="dropDown"]').select(data.notNeeded)
- })
- it('Validate Workflow', () => {
- // cy.get('[data-test="nextBtn"]').click()
-
- // // Validate that state selections takes you to the not needed page
- // cy.get('h1').should('contain', 'does not require voter registration before voting')
-
- // // Validate that external links open in new tab
- // cy.get('[class="usa-button"]').then(link => {
- // expect(link[1]).to.have.attr('target','_blank')
- // })
- })
-})
\ No newline at end of file
diff --git a/testing/cypress/support/online.cy.js b/testing/cypress/support/online.cy.js
deleted file mode 100644
index edf2c9a1..00000000
--- a/testing/cypress/support/online.cy.js
+++ /dev/null
@@ -1,369 +0,0 @@
-/* eslint-disable no-undef */
-///
-const data = require("../../fixtures/data.json");
-
-describe('Validate Online', () => {
- beforeEach('login to app', () => {
- cy.visit('/')
- })
-it('Validate Update Registration', () => {
-// go to next page
-// cy.get('[data-test="nextBtn"]').click()
-
-// check eligibility page
-// verify that user CANNOT move forward with out checking box
-cy.get('[data-test="nextBtn"]').click()
-cy.get('[data-test="errorText"]').should('contain.text', 'Confirm eligibility to continue.')
-
-// verify user CAN move forward after checking box
-cy.get('[data-test="checkBox"]').click()
-// todo: come back after fix
-// cy.get('[data-test="errorText"]').should('not.exist')
-
-cy.get('[data-test="nextBtn"]').click()
-
-// select registration option
-cy.get('[data-test="pathBtn"]').then(btn => {
- cy.get(btn[0]).click({force: true})
-})
-
-// fill out personal information
-// * check that user can not move forward without filling out fields
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('exist')
-
-cy.get('[data-test="select"]').then(dropdown => {
- // title
- cy.get(dropdown[0]).select(data.personalInformationTitle)
- cy.get(dropdown[0]).should('contain', data.personalInformationTitle)
- // suffix
- cy.get(dropdown[1]).select(data.personalInformationSuffix)
- cy.get(dropdown[1]).should('contain', data.personalInformationSuffix)
-})
-
-cy.get('[data-test="firstName"]').type(data.personalInformationName)
-cy.get('[data-test="middleName"]').type(data.personalInformationMiddle)
-cy.get('[data-test="lastName"]').type(data.personalInformationLast)
-cy.get('[data-test="phoneNumber"]').type(data.personalInformationNumber)
-// Validate text box has correct text
-cy.get('[data-test="firstName"]').should('have.value', data.personalInformationName)
-cy.get('[data-test="middleName"]').should('have.value', data.personalInformationMiddle)
-cy.get('[data-test="lastName"]').should('have.value', data.personalInformationLast)
-cy.get('[data-test="phoneNumber"]').should('contain.value', data.personalInformationNumber2)
-
-// * check previous name fields
-cy.get('[data-test="checkBox"]').click({force: true})
-cy.get('[data-test="prevFirstName"]').type(data.personalInformationName)
-cy.get('[data-test="prevMiddleName"]').type(data.personalInformationMiddle)
-cy.get('[data-test="prevLastName"]').type(data.personalInformationLast)
-// Validate text box has correct text
-cy.get('[data-test="prevFirstName"]').should('have.value', data.personalInformationName)
-cy.get('[data-test="prevMiddleName"]').should('have.value', data.personalInformationMiddle)
-cy.get('[data-test="prevLastName"]').should('have.value', data.personalInformationLast)
-
-cy.get('[data-test="dobMonth"]').type(data.personalInformationMonth)
-cy.get('[data-test="dobDay"]').type(data.personalInformationDay)
-cy.get('[data-test="dobYear"]').type(data.personalInformationYear)
-// Validate text box has correct text
-cy.get('[data-test="dobMonth"]').should('have.value', data.personalInformationDay)
-cy.get('[data-test="dobDay"]').should('have.value', data.personalInformationDay)
-cy.get('[data-test="dobYear"]').should('have.value', data.personalInformationYear)
-
-cy.get('[data-test="nextBtn"]').click()
-
-
-// address and location page
-// * check that user can not move forward without filling out fields
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('be.visible')
-
-// * check that current address works
-cy.get('[data-test="street"]').type(data.addressStreet)
-cy.get('[data-test="aptNumber"]').type(data.addressApt)
-cy.get('[data-test="city"]').type(data.addressTown)
-cy.get('[data-test="zip"]').type(data.addressZip)
- // Validate text box has correct text
-cy.get('[data-test="street"]').should('have.value', data.addressStreet)
-cy.get('[data-test="aptNumber"]').should('have.value', data.addressApt)
-cy.get('[data-test="city"]').should('have.value', data.addressTown)
-cy.get('[data-test="zip"]').should('have.value', data.addressZip)
-
-// * check that mailing address work
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[1]).click({force: true})
-})
-
-cy.get('[data-test="mailStreet"]').type(data.addressStreet)
-cy.get('[data-test="mailCity"]').type(data.addressTown)
-cy.get('[data-test="mailZip"]').type(data.addressZip)
- // Validate text box has correct text
-cy.get('[data-test="mailStreet"]').should('have.value', data.addressStreet)
-cy.get('[data-test="mailCity"]').should('have.value', data.addressTown)
-cy.get('[data-test="mailZip"]').should('have.value', data.addressZip)
-
-// * uncheck mailing address block
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[1]).click({force: true})
-})
-
-// * check recently moved option
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[0]).click({force: true})
-})
-
-cy.get('[data-test="prevStreet"]').type(data.addressStreet)
-cy.get('[data-test="prevCity"]').type(data.addressTown)
-cy.get('[data-test="prevZip"]').type(data.addressZip)
- // Validate text box has correct text
-cy.get('[data-test="prevStreet"]').should('have.value', data.addressStreet)
-cy.get('[data-test="prevCity"]').should('have.value', data.addressTown)
-cy.get('[data-test="prevZip"]').should('have.value', data.addressZip)
-// * uncheck recently moved block
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[0]).click({force: true})
-})
-
-// * check does not have permanent option
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[1]).click({force: true})
-})
-
- cy.get('[data-testid="Select"]').select(data.addressState)
- // Validate text box has correct text for mailing address
-cy.get('[data-test="mailStreet"]').should('have.value', data.addressStreet)
-cy.get('[data-test="mailCity"]').should('have.value', data.addressTown)
-cy.get('[data-test="mailZip"]').should('have.value', data.addressZip)
-
-cy.get('[data-test="nextBtn"]').click()
-
-// identification
-// * check that user can not move forward without selecting an option
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('be.visible')
-
-// * state driver's license number
-cy.get('[data-test="dropDown"]').select("State driver's license number")
-cy.get('[data-test="driverId"]').type(data.idNumber)
-
-// Validate that fields have correct data
- cy.get('[data-test="driverId"]').should('have.value', data.idNumber)
-// * state id number
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("State non-driver ID")
-})
-cy.get('[data-test="stateId"]').type(data.idNumber)
-
-// Validate that fields have correct data
- cy.get('[data-test="stateId"]').should('have.value', data.idNumber)
-// * social security number (last 4 digits)
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("Social security number (last 4 digits)")
-})
-cy.get('[data-test="ssn"]').type(data.ssn)
-// Validate fields have correct data
-cy.get('[data-test="dropDown"]').should('have.value', data.ssnValue)
-cy.get('[data-test="ssn"]').should('have.value', data.ssn)
-
-// * no id
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("I do not have a valid ID.")
-})
-cy.get('p').should('contain.text', '"None" will appear on your completed form.')
-
-cy.get('[data-test="nextBtn"]').click()
-
- // political party
- cy.get('[data-test="politicalParty"]').type(data.politicalParty)
-
- cy.get('[data-test="nextBtn"]').click()
-
-// confirmation page
-cy.get('[data-test="confirm"]').click({force: true})
-cy.get('[data-test="nextBtn"]').click()
-
-cy.get('[data-test="addressConfirm"]').should('contain.text', 'Your Alabama mail-in registration form is complete and ready to print.')
-// * check that download opens in new window
-cy.get('[data-test="pdfBtnNewTab"]').click()
-
-cy.get('@open').should('have.been.calledOnce')
-
-})
-
-it('Validate New Registration', () => {
- // check that state link opens in new tab
- // * will need to add this back in when links are updated
- // cy.get('[class="usa-link usa-link--external"]').should('have.attr','target','_blank')
-
-// go to next page
-cy.get('[data-test="nextBtn"]').click()
-
-// check eligibility page
-// verify that user CANNOT move forward with out checking box
-cy.get('[data-test="nextBtn"]').click()
-cy.get('[data-test="errorText"]').should('contain.text', 'Confirm eligibility to continue.')
-
-// verify user CAN move forward after checking box
-cy.get('[data-test="checkBox"]').click()
-// todo: come back after fixed
-// cy.get('[data-test="errorText"]').should('not.exist')
-
-cy.get('[data-test="nextBtn"]').click()
-
-// select registration option
-cy.get('[data-test="pathBtn"]').then(btn => {
- cy.get(btn[1]).click({force: true})
-})
-
-// fill out personal information
-// * check that user can not move forward without filling out fields
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('exist')
-
-cy.get('[data-test="select"]').then(dropdown => {
- // title
- cy.get(dropdown[0]).select(data.personalInformationTitle)
- cy.get(dropdown[0]).should('contain', data.personalInformationTitle)
- // suffix
- cy.get(dropdown[1]).select(data.personalInformationSuffix)
- cy.get(dropdown[1]).should('contain', data.personalInformationSuffix)
-})
-
-cy.get('[data-test="firstName"]').type(data.personalInformationName)
-cy.get('[data-test="middleName"]').type(data.personalInformationMiddle)
-cy.get('[data-test="lastName"]').type(data.personalInformationLast)
-cy.get('[data-test="phoneNumber"]').type(data.personalInformationNumber)
-// Validate text box has correct text
-cy.get('[data-test="firstName"]').should('have.value', data.personalInformationName)
-cy.get('[data-test="middleName"]').should('have.value', data.personalInformationMiddle)
-cy.get('[data-test="lastName"]').should('have.value', data.personalInformationLast)
-cy.get('[data-test="phoneNumber"]').should('contain.value', data.personalInformationNumber2)
-
-cy.get('[data-test="dobMonth"]').type(data.personalInformationMonth)
-cy.get('[data-test="dobDay"]').type(data.personalInformationDay)
-cy.get('[data-test="dobYear"]').type(data.personalInformationYear)
-// Validate text box has correct text
-cy.get('[data-test="dobMonth"]').should('have.value', data.personalInformationDay)
-cy.get('[data-test="dobDay"]').should('have.value', data.personalInformationDay)
-cy.get('[data-test="dobYear"]').should('have.value', data.personalInformationYear)
-
-cy.get('[data-test="nextBtn"]').click()
-
-
-// address and location page
-// * check that user can not move forward without filling out fields
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('be.visible')
-
-// * check that current address works
-cy.get('[data-test="street"]').type(data.addressStreet)
-cy.get('[data-test="aptNumber"]').type(data.addressApt)
-cy.get('[data-test="city"]').type(data.addressTown)
-cy.get('[data-test="zip"]').type(data.addressZip)
- // Validate text box has correct text
-cy.get('[data-test="street"]').should('have.value', data.addressStreet)
-cy.get('[data-test="aptNumber"]').should('have.value', data.addressApt)
-cy.get('[data-test="city"]').should('have.value', data.addressTown)
-cy.get('[data-test="zip"]').should('have.value', data.addressZip)
-
-// * check that mailing address work
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[1]).click({force: true})
-})
-cy.get('[data-test="mailStreet"]').type(data.addressStreet)
-cy.get('[data-test="mailCity"]').type(data.addressTown)
-cy.get('[data-test="mailZip"]').type(data.addressZip)
- // Validate text box has correct text
-cy.get('[data-test="mailStreet"]').should('have.value', data.addressStreet)
-cy.get('[data-test="mailCity"]').should('have.value', data.addressTown)
-cy.get('[data-test="mailZip"]').should('have.value', data.addressZip)
-// * uncheck mailing address block
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[1]).click({force: true})
-})
-
-// * check recently moved option
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[0]).click({force: true})
-})
-
-cy.get('[data-test="mailStreet"]').type(data.addressStreet)
-cy.get('[data-test="mailCity"]').type(data.addressTown)
-cy.get('[data-test="mailZip"]').type(data.addressZip)
- // Validate text box has correct text
-cy.get('[data-test="mailStreet"]').should('have.value', data.addressStreet)
-cy.get('[data-test="mailCity"]').should('have.value', data.addressTown)
-cy.get('[data-test="mailZip"]').should('have.value', data.addressZip)
-
-// * uncheck recently moved block
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[0]).click({force: true})
-})
-
-// * check does not have permanent option
-cy.get('[data-test="checkBox"]').then(checkBox => {
- cy.get(checkBox[0]).click({force: true})
-})
-
- cy.get('[class="usa-select radius-md"]').select(data.addressState)
-
- // Validate text box has correct text
-cy.get('[data-test="mailStreet"]').should('have.value', data.addressStreet)
-cy.get('[data-test="mailCity"]').should('have.value', data.addressTown)
-cy.get('[data-test="mailZip"]').should('have.value', data.addressZip)
-
-cy.get('[data-test="nextBtn"]').click()
-
-// identification
-// * check that user can not move forward without selecting an option
-cy.get('[data-test="nextBtn"]').click().click()
-cy.get('[data-test="errorText"]').should('be.visible')
-
-// * state driver's license number
-cy.get('[data-test="dropDown"]').select("State driver's license number")
-cy.get('[data-test="driverId"]').type(data.idNumber)
-
-// Validate that fields have correct data
- cy.get('[data-test="driverId"]').should('have.value', data.idNumber)
-// * state id number
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("State non-driver ID")
-})
-cy.get('[data-test="stateId"]').type(data.idNumber)
-
-// Validate that fields have correct data
- cy.get('[data-test="stateId"]').should('have.value', data.idNumber)
-// * social security number (last 4 digits)
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("Social security number (last 4 digits)")
-})
-cy.get('[data-test="ssn"]').type(data.ssn)
-// Validate fields have correct data
-cy.get('[data-test="dropDown"]').should('have.value', data.ssnValue)
-cy.get('[data-test="ssn"]').should('have.value', data.ssn)
-
-// * no id
-cy.get('[data-test="dropDown"]').then(dropDown => {
- cy.get(dropDown[0]).select("I do not have a valid ID.")
-})
-cy.get('p').should('contain.text', '"None" will appear on your completed form.')
-
-cy.get('[data-test="nextBtn"]').click()
-
- // political party
- cy.get('[data-test="politicalParty"]').type(data.politicalParty)
-
- cy.get('[data-test="nextBtn"]').click()
-
-// confirmation page
-cy.get('[data-test="confirm"]').click({force: true})
-cy.get('[data-test="nextBtn"]').click()
-
-cy.get('[data-test="addressConfirm"]').should('contain.text', 'Your Alabama mail-in registration form is complete and ready to print.')
-
-// * check that download opens in new window
-cy.get('[data-test="pdfBtnNewTab"]').click()
-
-cy.get('@open').should('have.been.calledOnce')
-
- })
-})
diff --git a/testing/cypress/support/pageObjects.js b/testing/cypress/support/pageObjects.js
new file mode 100644
index 00000000..3ee041ed
--- /dev/null
+++ b/testing/cypress/support/pageObjects.js
@@ -0,0 +1,153 @@
+class PageObjects {
+
+ nextBtn() {
+ return cy.get('[data-test="nextBtn"]')
+ }
+
+ errorText() {
+ return cy.get('[data-test="errorText"]')
+ }
+
+ checkBox() {
+ return cy.get('[data-test="checkBox"]')
+ }
+
+ pathBtn() {
+ return cy.get('[data-test="pathBtn"]')
+ }
+
+ select() {
+ return cy.get('[data-test="select"]')
+ }
+
+ firstName() {
+ return cy.get('[data-test="firstName"]')
+ }
+
+ middleName() {
+ return cy.get('[data-test="middleName"]')
+ }
+
+ lastName() {
+ return cy.get('[data-test="lastName"]')
+ }
+
+ phoneNumber() {
+ return cy.get('[data-test="phoneNumber"]')
+ }
+
+ checkBox() {
+ return cy.get('[data-test="checkBox"]')
+ }
+
+ prevFirstName() {
+ return cy.get('[data-test="prevFirstName"]')
+ }
+
+ prevMiddleName() {
+ return cy.get('[data-test="prevMiddleName"]')
+ }
+
+ prevLastName() {
+ return cy.get('[data-test="prevLastName"]')
+ }
+
+ dobMonth() {
+ return cy.get('[data-test="dobMonth"]')
+ }
+
+ dobDay() {
+ return cy.get('[data-test="dobDay"]')
+ }
+
+ dobYear() {
+ return cy.get('[data-test="dobYear"]')
+ }
+
+ street() {
+ return cy.get('[data-test="street"]')
+ }
+
+ aptNumber() {
+ return cy.get('[data-test="aptNumber"]')
+ }
+
+ city() {
+ return cy.get('[data-test="city"]')
+ }
+
+ zip() {
+ return cy.get('[data-test="zip"]')
+ }
+
+ mailStreet() {
+ return cy.get('[data-test="mailStreet"]')
+ }
+
+ mailCity() {
+ return cy.get('[data-test="mailCity"]')
+ }
+
+ mailZip() {
+ return cy.get('[data-test="mailZip"]')
+ }
+
+ prevStreet() {
+ return cy.get('[data-test="prevStreet"]')
+ }
+
+ prevCity() {
+ return cy.get('[data-test="prevCity"]')
+ }
+
+ prevZip() {
+ return cy.get('[data-test="prevZip"]')
+ }
+
+ prevAptNumber() {
+ return cy.get('[data-test="prevAptNumber"]')
+ }
+
+ dropDown() {
+ return cy.get('[data-test="dropDown"]')
+ }
+
+ driverId() {
+ return cy.get('[data-test="driverId"]')
+ }
+
+ stateId() {
+ return cy.get(('[data-test="stateId"]'))
+ }
+
+ ssn() {
+ return cy.get('[data-test="ssn"]')
+ }
+
+ politicalParty() {
+ return cy.get('[data-test="politicalParty"]')
+ }
+
+ confirm() {
+ return cy.get('[data-test="confirm"]')
+ }
+
+ addressConfirm() {
+ return cy.get('[data-test="addressConfirm"]')
+ }
+
+ pdfBtnNewTab() {
+ return cy.get('[data-test="pdfBtnNewTab"]')
+ }
+
+ backBtn() {
+ return cy.get('[data-test="backBtn"]')
+ }
+
+ editBtn() {
+ return cy.get('[data-test="editBtn"]')
+ }
+
+}
+
+export const pageObjects = new PageObjects()
\ No newline at end of file