Skip to content

Commit

Permalink
Merge pull request #1563 from GSA/1562-restructure-results-view-b
Browse files Browse the repository at this point in the history
1562 restructure results view
  • Loading branch information
scottqueen-bixal authored Jul 16, 2024
2 parents 3924e17 + f406a42 commit eecc30a
Show file tree
Hide file tree
Showing 38 changed files with 1,339 additions and 970 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/test-cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
uses: cypress-io/github-action@v6
with:
working-directory: ./benefit-finder
build: npx playwright install-deps webkit
build: npx playwright-webkit install-deps
runTests: false

- name: Cypress run (WebKit)
Expand All @@ -123,6 +123,13 @@ jobs:
build: "npm run cy:build:storybook"
start: "npm run cy:run:pipeline"

- name: Artifact(s)
if: failure()
uses: actions/upload-artifact@v3
with:
name: cypress screenshots
path: ./benefit-finder/cypress/screenshots

tests-components:
runs-on: ubuntu-latest
steps:
Expand Down
48 changes: 34 additions & 14 deletions benefit-finder/cypress/e2e/storybook/benefitAccordionGroup.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,56 @@ beforeEach(() => {
})

describe('BenefitAccordionGroup component tests', () => {
it('Validate opening individual accordion only expands the clicked accordion and clicking it again closes it', () => {
cy.get('.bf-usa-accordion__button.usa-accordion__button').eq(0).click()
cy.get('.bf-usa-accordion__button.usa-accordion__button')
it('Validate all accordions are closed on load', () => {
cy.get('.bf-usa-accordion:visible').each(accordion => {
cy.wrap(accordion)
.find('.bf-usa-accordion__button')
.should('have.attr', 'aria-expanded', 'false')
})
})

it('Validate opening individual accordion expands the clicked accordion and clicking it again closes it', () => {
cy.wait(2500)
// get the first visible accordion and check if it is expanded
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(0)
.should('have.attr', 'aria-expanded', 'false')
// get the first visible accordion and click it
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button').eq(0).click()
// get the first visible accordion and check if it is expanded
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(0)
.should('have.attr', 'aria-expanded', 'true')
cy.get('.bf-usa-accordion__button.usa-accordion__button')
// get the second visible accordion and check if it is expanded
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(1)
.should('have.attr', 'aria-expanded', 'false')
cy.get('.bf-usa-accordion__button.usa-accordion__button').eq(0).click()
cy.get('.bf-usa-accordion__button.usa-accordion__button').each(
accordion => {
cy.wrap(accordion).should('have.attr', 'aria-expanded', 'false')
}
)
// get the first visible accordion and click it
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button').eq(0).click()
// get the first visible accordion and check if it is expanded
cy.get('.bf-usa-accordion:visible .bf-usa-accordion__button')
.eq(0)
.should('have.attr', 'aria-expanded', 'false')
})

it('Validate clicking Expand all opens all accordions', () => {
cy.get('.bf-expand-all').click()
cy.get('.bf-expand-all').should('contain.text', 'Close all')
cy.get('.usa-accordion__button').each(accordion => {
cy.wrap(accordion).should('have.attr', 'aria-expanded', 'true')
cy.get('.bf-usa-accordion:visible').each(accordion => {
cy.wrap(accordion)
.find('.bf-usa-accordion__button')
.should('have.attr', 'aria-expanded', 'true')
})
})

it('Validate clicking Collapse all closes all accordions', () => {
cy.get('.bf-expand-all').click()
cy.get('.bf-expand-all').click()
cy.get('.bf-expand-all').should('contain.text', 'Open all')
cy.get('.usa-accordion__button').each(accordion => {
cy.wrap(accordion).should('have.attr', 'aria-expanded', 'false')
cy.get('.bf-usa-accordion:visible').each(accordion => {
cy.wrap(accordion)
.find('.bf-usa-accordion__button')
.should('have.attr', 'aria-expanded', 'false')
})
})
})
30 changes: 15 additions & 15 deletions benefit-finder/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions benefit-finder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@vitest/coverage-v8": "^1.6.0",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"cypress": "^13.10.0",
"cypress": "^13.13.0",
"cypress-axe": "^1.5.0",
"cypress-plugin-tab": "^1.0.5",
"eslint": "^8.57.0",
Expand All @@ -79,7 +79,7 @@
"husky": "^9.0.11",
"jsdom": "^24.1.0",
"lint-staged": "^15.2.5",
"playwright-webkit": "^1.44.1",
"playwright-webkit": "^1.45.2",
"plop": "^4.0.1",
"postcss": "^8.4.38",
"prettier": "^3.3.0",
Expand Down
Loading

0 comments on commit eecc30a

Please sign in to comment.