Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
add cross browser testing under Cypress run
Browse files Browse the repository at this point in the history
  • Loading branch information
nehemiah-abuga committed Jul 19, 2023
1 parent 080ad2f commit 7c01fc5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 53 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ jobs:
cat cypress.config.js
- name: Cypress run
uses: cypress-io/github-action@v3
uses: cypress-io/github-action@v5
with:
browser: chrome
headless: true
command: npm run cy:run:cross-browser
start: npm run federalist

- uses: actions/upload-artifact@v3
Expand Down
36 changes: 12 additions & 24 deletions cypress/e2e/ui/accordions.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ describe("Validate opening and closing of accordion cards", () => {
pages
.accordions()
.contains(EN_BENEFITS_COVID_19["fema-covid-19-funeral-assistance.title"])
.invoke("prop", "ariaExpanded")
.should("eq", "true")
.should("have.attr", "aria-expanded", "true")
pages.accordions().contains(EN_BENEFITS_COVID_19["fema-covid-19-funeral-assistance.title"]).click()
pages
.accordions()
.contains(EN_BENEFITS_COVID_19["fema-covid-19-funeral-assistance.title"])
.invoke("prop", "ariaExpanded")
.should("eq", "false")
.should("have.attr", "aria-expanded", "false")
})

it("Validate opening and closing of Veteran's Burial Allowance accordion card in Death of a loved one Spanish page", () => {
Expand All @@ -36,14 +34,12 @@ describe("Validate opening and closing of accordion cards", () => {
pages
.accordions()
.contains(ES_BENEFITS_VA_BURIAL_ALLOWANCE["va-burial-allowance.title"])
.invoke("prop", "ariaExpanded")
.should("eq", "true")
.should("have.attr", "aria-expanded", "true")
pages.accordions().contains(ES_BENEFITS_VA_BURIAL_ALLOWANCE["va-burial-allowance.title"]).click()
pages
.accordions()
.contains(ES_BENEFITS_VA_BURIAL_ALLOWANCE["va-burial-allowance.title"])
.invoke("prop", "ariaExpanded")
.should("eq", "false")
.should("have.attr", "aria-expanded", "false")
})

it("Validate opening and closing of Tax Relief Programs for People with Disabilites accordion card in Disabilites English page", () => {
Expand All @@ -52,14 +48,12 @@ describe("Validate opening and closing of accordion cards", () => {
pages
.accordions()
.contains(EN_BENEFITS_IRS_TAX_HELP_DISABILITY["irs-tax-help-disability.title"])
.invoke("prop", "ariaExpanded")
.should("eq", "true")
.should("have.attr", "aria-expanded", "true")
pages.accordions().contains(EN_BENEFITS_IRS_TAX_HELP_DISABILITY["irs-tax-help-disability.title"]).click()
pages
.accordions()
.contains(EN_BENEFITS_IRS_TAX_HELP_DISABILITY["irs-tax-help-disability.title"])
.invoke("prop", "ariaExpanded")
.should("eq", "false")
.should("have.attr", "aria-expanded", "false")
})

it("Validate opening and closing of Social Security Disability Insurance for Spouse accordion card in Disabilites Spanish page", () => {
Expand All @@ -72,17 +66,15 @@ describe("Validate opening and closing of accordion cards", () => {
pages
.accordions()
.contains(ES_BENEFITS_SSA_DISABILITY_INSURANCE_SPOUSE["ssa-disability-insurance-spouse.title"])
.invoke("prop", "ariaExpanded")
.should("eq", "true")
.should("have.attr", "aria-expanded", "true")
pages
.accordions()
.contains(ES_BENEFITS_SSA_DISABILITY_INSURANCE_SPOUSE["ssa-disability-insurance-spouse.title"])
.click()
pages
.accordions()
.contains(ES_BENEFITS_SSA_DISABILITY_INSURANCE_SPOUSE["ssa-disability-insurance-spouse.title"])
.invoke("prop", "ariaExpanded")
.should("eq", "false")
.should("have.attr", "aria-expanded", "false")
})

it("Validate opening and closing of Veteran's Pension accordion card in Retirement English page", () => {
Expand All @@ -91,14 +83,12 @@ describe("Validate opening and closing of accordion cards", () => {
pages
.accordions()
.contains(EN_BENEFITS_VA_PENSION["va-pension.title"])
.invoke("prop", "ariaExpanded")
.should("eq", "true")
.should("have.attr", "aria-expanded", "true")
pages.accordions().contains(EN_BENEFITS_VA_PENSION["va-pension.title"]).click()
pages
.accordions()
.contains(EN_BENEFITS_VA_PENSION["va-pension.title"])
.invoke("prop", "ariaExpanded")
.should("eq", "false")
.should("have.attr", "aria-expanded", "false")
})

it("Validate opening and closing of Retirement Benefits for Child with Disabilities accordion card in Retirement Spanish page", () => {
Expand All @@ -111,16 +101,14 @@ describe("Validate opening and closing of accordion cards", () => {
pages
.accordions()
.contains(ES_BENEFITS_SSA_RETIREMENT_BENEFITS_CHILD_DISABLED["ssa-retirement-benefits-child-disabled.title"])
.invoke("prop", "ariaExpanded")
.should("eq", "true")
.should("have.attr", "aria-expanded", "true")
pages
.accordions()
.contains(ES_BENEFITS_SSA_RETIREMENT_BENEFITS_CHILD_DISABLED["ssa-retirement-benefits-child-disabled.title"])
.click()
pages
.accordions()
.contains(ES_BENEFITS_SSA_RETIREMENT_BENEFITS_CHILD_DISABLED["ssa-retirement-benefits-child-disabled.title"])
.invoke("prop", "ariaExpanded")
.should("eq", "false")
.should("have.attr", "aria-expanded", "false")
})
})
4 changes: 2 additions & 2 deletions cypress/e2e/ui/open-all-close-all-button.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("Validate Open All button functionality", () => {
cy.visit({ url: sitePage.route })
pages.openAllButton().click()
pages.accordions().each((accordion) => {
cy.wrap(accordion).invoke("prop", "ariaExpanded").should("eq", "true")
cy.wrap(accordion).should("have.attr", "aria-expanded", "true")
})
})
})
Expand All @@ -24,7 +24,7 @@ describe("Validate Close All button functionality", () => {
pages.openAllButton().click()
pages.closeAllButton().click()
pages.accordions().each((accordion) => {
cy.wrap(accordion).invoke("prop", "ariaExpanded").should("eq", "false")
cy.wrap(accordion).should("have.attr", "aria-expanded", "false")
})
})
})
Expand Down
34 changes: 17 additions & 17 deletions package-lock.json

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

16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@
"federalist:local": "gulp && nuxt generate && cd ./_site/_nuxt/css && perl -pi -e 's/url\\(\\/fonts/url\\(..\\/fonts/g' *.css && cd ../../.. && ls -lhR _site && nuxt start",
"federalist": "gulp && nuxt generate ; cd ./_site/_nuxt/css && if [ \"${BRANCH}\" = \"prod\" ] || [ \"${BRANCH}\" = \"release\" ]; then sed -i~ -Ee 's|(/?)fonts/|\\1../fonts/|g' *.css; else perl -pi -e 's/\\/fonts\\//\\/_nuxt\\/fonts\\//g' *.css; fi && cd ../../.. && ls -lhR _site",
"format": "prettier --write \"./**/*.{js,jsx,json,vue,md,css}\"",
"cypress:run_chrome": "npx cypress run --browser chrome",
"cypress:open": "npx cypress open"
"cy:run:chrome": "npx cypress run --browser chrome",
"cy:run:edge": "npx cypress run --browser edge",
"cy:run:firefox": "npx cypress run --browser firefox",
"cy:run:cross-browser": "npm run cy:run:chrome && npm run cy:run:edge && npm run cy:run:firefox",
"cy:open": "npx cypress open"
},
"dependencies": {},
"devDependencies": {
"@babel/eslint-parser": "^7.17.0",
"@braintree/sanitize-url": "^6.0.0",
"@lokidb/loki": "^2.1.0",
"@nuxtjs/axios": "^5.13.6",
"@nuxt/content": "^1.15.1",
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/dotenv": "^1.4.1",
"@nuxtjs/eslint-config": "^10.0.0",
"@nuxtjs/eslint-module": "^3.0.2",
Expand All @@ -42,16 +44,16 @@
"@vue/test-utils": "^1.3.0",
"ansi-html": "^0.0.9",
"ansi-regex": ">=6.0.1",
"axios": "^0.27.2",
"axe-core": "^4.4.1",
"axios": "^0.27.2",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^28.0.2",
"core-js": "^3.23.5",
"cypress": "^12.11.0",
"cypress": "^12.17.1",
"date-fns": "^2.28.0",
"eslint": "8.20.0",
"eslint-plugin-jest": "^26.2.2",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^26.2.2",
"eslint-plugin-nuxt": "^3.2.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-sonarjs": "^0.13.0",
Expand Down

0 comments on commit 7c01fc5

Please sign in to comment.