diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index c92ee3cf7..b1d3e5e70 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -4,34 +4,6 @@ on: workflow_dispatch: jobs: - test-frontend: - runs-on: ubuntu-latest - steps: - - name: Checkout the release branch - uses: actions/checkout@v4 - with: - repository: "GSA/px-benefit-finder" - ref: "release" # Specify the branch name here - - - name: Install Node - uses: actions/setup-node@v4 - with: - node-version-file: "./benefit-finder/package.json" - - - name: Install Submodule - run: | - cd benefit-finder - git submodule init && git submodule update - - - name: Install Dependencies - run: | - cd benefit-finder - npm ic - - - name: Test Frontend - run: | - cd benefit-finder - npm run test:coverage tests-chrome: runs-on: ubuntu-latest @@ -52,6 +24,11 @@ jobs: cd benefit-finder git submodule init && git submodule update + - name: Checkout usagov-2021 working branch + run: | + cd usagov-2021 + git switch dev + - name: Cypress run (Chrome) uses: cypress-io/github-action@v6 with: @@ -87,6 +64,11 @@ jobs: cd benefit-finder git submodule init && git submodule update + - name: Checkout usagov-2021 working branch + run: | + cd usagov-2021 + git switch ${{ github.ref_name }} + - name: Cypress run (Firefox) uses: cypress-io/github-action@v6 with: @@ -122,6 +104,11 @@ jobs: cd benefit-finder git submodule init && git submodule update + - name: Checkout usagov-2021 working branch + run: | + cd usagov-2021 + git switch ${{ github.ref_name }} + - name: Cypress run (Edge) uses: cypress-io/github-action@v6 with: @@ -157,6 +144,11 @@ jobs: cd benefit-finder git submodule init && git submodule update + - name: Checkout usagov-2021 working branch + run: | + cd usagov-2021 + git switch ${{ github.ref_name }} + - name: Install dependencies uses: cypress-io/github-action@v6 with: @@ -180,39 +172,3 @@ jobs: with: name: Webkit cypress screenshots path: ./benefit-finder/cypress/screenshots - - tests-components: - runs-on: ubuntu-latest - steps: - - name: Checkout the release branch - uses: actions/checkout@v4 - with: - repository: "GSA/px-benefit-finder" - ref: "release" # Specify the branch name here - - - name: Install Node - uses: actions/setup-node@v4 - with: - node-version-file: "./benefit-finder/package.json" - - - name: Install Submodule - run: | - cd benefit-finder - git submodule init && git submodule update - - - name: Cypress run (Chrome) - uses: cypress-io/github-action@v6 - with: - # working-directory: ./benefit-finder - working-directory: ./benefit-finder - component: true - browser: chrome - env: NODE_ENV=test - build: "npm run cy:prebuild:storybook" - - - name: Component Artifact(s) - if: failure() - uses: actions/upload-artifact@v4 - with: - name: Component cypress screenshots - path: ./benefit-finder/cypress/screenshots diff --git a/benefit-finder/.eslintrc.json b/benefit-finder/.eslintrc.json index 77113558b..94b5f99f3 100644 --- a/benefit-finder/.eslintrc.json +++ b/benefit-finder/.eslintrc.json @@ -7,6 +7,7 @@ "plugin:react/jsx-runtime", "plugin:storybook/recommended", "plugin:cypress/recommended", + "plugin:json/recommended-legacy", "prettier" ], "plugins": ["@stylistic/js"], @@ -15,7 +16,7 @@ "sourceType": "module" }, "settings": { - "react": { "version": "18.2" } + "react": { "version": "18.3" } }, "overrides": [ { diff --git a/benefit-finder/.nvmrc b/benefit-finder/.nvmrc index b8e593f52..8ce703082 100644 --- a/benefit-finder/.nvmrc +++ b/benefit-finder/.nvmrc @@ -1 +1 @@ -20.15.1 +20.16.0 diff --git a/benefit-finder/cypress/e2e/storybook/error-message-display.cy.js b/benefit-finder/cypress/e2e/storybook/error-message-display.cy.js index 85e85357e..32fe80695 100644 --- a/benefit-finder/cypress/e2e/storybook/error-message-display.cy.js +++ b/benefit-finder/cypress/e2e/storybook/error-message-display.cy.js @@ -157,4 +157,63 @@ describe('Validate correct error messages display for negative scenarios', () => }) }) }) + + it('Should include error count in alert', () => { + pageObjects.button().contains(EN_LOCALE_DATA.buttonGroup[1].value).click() + pageObjects + .bfAlertList() + .find('li') + .its('length') // Get the count of 'li' elements using the base element + .then(count => { + // Assert that the heading contains the count + pageObjects.alertHeading().should('include.text', count) + }) + }) + + it('Should include list of error links and clicking on a link navigates to a specific field', () => { + pageObjects.button().contains(EN_LOCALE_DATA.buttonGroup[1].value).click() + + pageObjects + .bfAlertList() + .find('a') + .each($el => { + cy.wrap($el) + .should('have.attr', 'href') // Check that each element has an 'href' attribute + .and('not.be.empty') // Ensure the 'href' attribute is not empty + }) + + pageObjects + .bfAlertList() + .find('a') + .each($el => { + cy.wrap($el).then($link => { + const href = $link.attr('href') // Get the href attribute value + cy.get(href).focus() + cy.get(href).should('have.focus') // Focus should be on the element + }) + }) + }) + + it('Should validate error label content overrides', () => { + pageObjects.button().contains(EN_LOCALE_DATA.buttonGroup[1].value).click() + + const labelErrorMessage = + EN_DOLO_MOCK_DATA.data.lifeEventForm.sectionsEligibilityCriteria[0] + .section.fieldsets[1].fieldset.errorMessage + pageObjects + .relationshipToDeceasedError() + .should('be.visible') + .and('contain.text', labelErrorMessage) + + pageObjects.dateOfBirthError().should('not.contain.text', labelErrorMessage) + pageObjects + .dateOfBirthMonthError() + .should('not.contain.text', labelErrorMessage) + pageObjects + .dateOfBirthDayError() + .should('not.contain.text', labelErrorMessage) + pageObjects + .dateOfBirthYearError() + .should('not.contain.text', labelErrorMessage) + }) }) diff --git a/benefit-finder/cypress/support/pageObjects.js b/benefit-finder/cypress/support/pageObjects.js index 68e621e1c..fb6b68357 100644 --- a/benefit-finder/cypress/support/pageObjects.js +++ b/benefit-finder/cypress/support/pageObjects.js @@ -49,6 +49,10 @@ class PageObjects { return cy.get('div#bf-section > div[role="alert"]') } + alertHeading() { + return cy.get('[data-testid="bf-alert-heading"]') + } + bfAlertList() { return cy.get('[data-testid="bf-errors-list"]') } @@ -135,6 +139,34 @@ class PageObjects { return cy.get('.bf-step-back-button') } + dateOfBirthError() { + return cy.get('[data-testid="error-description-applicant_date_of_birth"]') + } + + dateOfBirthMonthError() { + return cy.get( + '[data-testid="month-error-description-applicant_date_of_birth_0"]' + ) + } + + dateOfBirthDayError() { + return cy.get( + '[data-testid="day-error-description-applicant_date_of_birth_0"]' + ) + } + + dateOfBirthYearError() { + return cy.get( + '[data-testid="year-error-description-applicant_date_of_birth_0"]' + ) + } + + relationshipToDeceasedError() { + return cy.get( + '[data-testid="error-description-applicant_relationship_to_the_deceased"]' + ) + } + zeroBenefitsViewHeading() { return cy.get('[data-testid="zero-benefits-view-heading"]') } diff --git a/benefit-finder/index.html b/benefit-finder/index.html index 7c3a69198..a462f8b09 100644 --- a/benefit-finder/index.html +++ b/benefit-finder/index.html @@ -32,6 +32,22 @@ json-data-file-path="/s3/files/benefit-finder/api/life-event/death.json" draft-json-data-file-path="/s3/files/benefit-finder/api/life-event/death.json" > +