Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vote-2364: Test coverage for accessibility toolbar #862

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions testing/cypress/e2e/frontEndTests/accessability-toolbar.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/// <reference types="cypress" />

describe('check accessability tool bar', () => {
beforeEach('visit site', () => {
cy.visit('/')
})

it('verify that tool bar is present', () => {
cy.get('[data-test="themeSwitcher"]').should('be.visible')
})

it('verify page switches themes', () => {
cy.get('[data-test="themeContrast"]').click()
cy.get('[data-theme="contrast"]').should('exist')
cy.get('[data-test="themeContrast"]').click()
cy.get('[data-theme="default"]').should('exist')
})

it('verify text enlarges', () => {
cy.get('[data-test="themeText"]').click()
cy.get('[data-scale="large"]').should('exist')
cy.get('[data-test="themeText"]').click()
cy.get('[data-scale="x-large"]').should('exist')
cy.get('[data-test="themeText"]').click()
cy.get('[data-scale="default"]').should('exist')

})

it.only('verify theme presents across pages', () => {
// verify contrast theme
cy.get('[data-test="themeContrast"]').click()
cy.visit('/about-us').get('[data-theme="contrast"]').should('exist')
cy.get('[data-test="themeContrast"]').click()
cy.visit('/').get('[data-theme="default"]').should('exist')

// verify text enlargement
cy.get('[data-test="themeText"]').click()
cy.visit('/about-us').get('[data-scale="large"]').should('exist')
cy.get('[data-test="themeText"]').click()
cy.visit('/').get('[data-scale="x-large"]').should('exist')
})

})
2 changes: 0 additions & 2 deletions testing/cypress/e2e/frontEndTests/state-pages.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/// <reference types="cypress" />

// * data-test="registration-info"

describe('test state pages', () => {
it('test - online', () => {
cy.visit('/register/ak')
Expand Down
4 changes: 3 additions & 1 deletion web/themes/custom/votegov/templates/layout/page.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,22 @@
{% endif %}

{{ attach_library('votegov/theme_switcher') }}
<div class="vote-theme-options">
<div class="vote-theme-options" data-test="themeSwitcher">
<button
class="vote-theme-options__button vote-theme-options__button--scale"
data-ui-switch-id="scale"
data-values="default,large,x-large"
type="button"
title="Switch font size preset"
data-test="themeText"
><span class="usa-sr-only">Switch font size preset</span></button>
<button
class="vote-theme-options__button vote-theme-options__button--theme"
data-ui-switch-id="theme"
data-values="default,contrast"
type="button"
title="Switch display preset"
data-test="themeContrast"
><span class="usa-sr-only">Switch display preset</span></button>
</div>

Expand Down