Skip to content

Commit

Permalink
Merge pull request #1756 from GSA/1567-data-attributes-in-selectors
Browse files Browse the repository at this point in the history
PXBF-1567-data-attributes-in-selectors: 1567 data attributes in selectors
  • Loading branch information
scottqueen-bixal authored Nov 5, 2024
2 parents e8e5f54 + 42e6f5a commit 1e6257c
Show file tree
Hide file tree
Showing 43 changed files with 521 additions and 313 deletions.
27 changes: 18 additions & 9 deletions benefit-finder/cypress/e2e/storybook/aria-attribute-state.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference types="cypress" />
/// <reference types="Cypress" />

import * as utils from '../../support/utils.js'
import * as EN_LOCALE_DATA from '../../../src/shared/locales/en/en.json'
Expand All @@ -9,6 +9,9 @@ const dob = utils.getDateByOffset(-(18 * 365.2425 - 1))
const relation =
EN_DOLO_MOCK_DATA.data.lifeEventForm.sectionsEligibilityCriteria[0].section
.fieldsets[1].fieldset.inputs[0].inputCriteria.values[1].value
const relationshipId =
EN_DOLO_MOCK_DATA.data.lifeEventForm.sectionsEligibilityCriteria[0].section
.fieldsets[1].fieldset.inputs[0].inputCriteria.id
const status =
EN_DOLO_MOCK_DATA.data.lifeEventForm.sectionsEligibilityCriteria[0].section
.fieldsets[2].fieldset.inputs[0].inputCriteria.values[1].value
Expand All @@ -21,12 +24,12 @@ describe('Validate state of aria-invalid attribute', () => {

it('Should have default state of "false" for select, input, and radio', () => {
pageObjects
.selectField()
.fieldsetById(relationshipId)
.invoke('attr', 'aria-invalid')
.should('eq', 'false')

pageObjects
.inputField()
.benefitMemorableDateById('day')
.invoke('attr', 'aria-invalid')
.should('eq', 'false')

Expand All @@ -40,31 +43,37 @@ describe('Validate state of aria-invalid attribute', () => {
pageObjects.button().contains(EN_LOCALE_DATA.buttonGroup[1].value).click()

pageObjects
.selectField()
.fieldsetById(relationshipId)
.invoke('attr', 'aria-invalid')
.should('eq', 'true')

pageObjects.inputField().invoke('attr', 'aria-invalid').should('eq', 'true')
pageObjects
.benefitMemorableDateById('day')
.invoke('attr', 'aria-invalid')
.should('eq', 'true')
})

it('Should have state of "false" when previous was true but error has been resolved', () => {
pageObjects.button().contains(EN_LOCALE_DATA.buttonGroup[1].value).click()

pageObjects
.selectField()
.fieldsetById(relationshipId)
.invoke('attr', 'aria-invalid')
.should('eq', 'true')
pageObjects
.benefitMemorableDateById('day')
.invoke('attr', 'aria-invalid')
.should('eq', 'true')
pageObjects.inputField().invoke('attr', 'aria-invalid').should('eq', 'true')

utils.dataInputs({ dob, relation, status })

pageObjects
.selectField()
.fieldsetById(relationshipId)
.invoke('attr', 'aria-invalid')
.should('eq', 'false')

pageObjects
.inputField()
.benefitMemorableDateById('day')
.invoke('attr', 'aria-invalid')
.should('eq', 'false')
})
Expand Down
4 changes: 2 additions & 2 deletions benefit-finder/cypress/e2e/storybook/axe-a11y.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ describe(`Validate code passes axe scanning`, () => {
.should('eq', 'bf-result-view')

pageObjects
.accordion(
.accordionByTitle(
`${accordionItems[0].getAttribute('data-test-accordion-title')}`
)
.click()
Expand All @@ -149,7 +149,7 @@ describe(`Validate code passes axe scanning`, () => {
// get the heading of the first in the list
cy.get(`[data-testid="bf-usa-accordion"]`).then(accordionItems => {
pageObjects
.accordion(
.accordionByTitle(
`${accordionItems[0].getAttribute('data-test-accordion-title')}`
)
.click()
Expand Down
Loading

0 comments on commit 1e6257c

Please sign in to comment.