Skip to content

Commit

Permalink
Merge pull request #1709 from GSA/dev
Browse files Browse the repository at this point in the history
v0.6.0.beta.1 (Sprint 38)
  • Loading branch information
scottqueen-bixal authored Aug 20, 2024
2 parents f33a975 + d806d06 commit 1e35e98
Show file tree
Hide file tree
Showing 33 changed files with 1,117 additions and 660 deletions.
84 changes: 20 additions & 64 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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
3 changes: 2 additions & 1 deletion benefit-finder/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"plugin:react/jsx-runtime",
"plugin:storybook/recommended",
"plugin:cypress/recommended",
"plugin:json/recommended-legacy",
"prettier"
],
"plugins": ["@stylistic/js"],
Expand All @@ -15,7 +16,7 @@
"sourceType": "module"
},
"settings": {
"react": { "version": "18.2" }
"react": { "version": "18.3" }
},
"overrides": [
{
Expand Down
2 changes: 1 addition & 1 deletion benefit-finder/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.15.1
20.16.0
59 changes: 59 additions & 0 deletions benefit-finder/cypress/e2e/storybook/error-message-display.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})
32 changes: 32 additions & 0 deletions benefit-finder/cypress/support/pageObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]')
}
Expand Down Expand Up @@ -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"]')
}
Expand Down
16 changes: 16 additions & 0 deletions benefit-finder/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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"
></div>
<div
style="
width: 100%;
border: 2px solid red;
height: 200px;
text-align: center;
"
class="bf-qual-survey grid-container"
hidden
>
<div class="additional_body_info">
<div id="pagesurvey-qual-container">
<h2>pagesurvey-qual-container</h2>
</div>
</div>
</div>
</main>
<!--
This HTML file is a template.
Expand Down
Loading

0 comments on commit 1e35e98

Please sign in to comment.