-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tab-stops-details-view): add accessibility check e2e test for ne…
…w tabstops details view (#4822)
- Loading branch information
1 parent
9e724b4
commit 58c568d
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import { FeatureFlags } from 'common/feature-flags'; | ||
import { getAutomationIdSelector } from 'tests/common/get-automation-id-selector'; | ||
import { BackgroundPage } from 'tests/end-to-end/common/page-controllers/background-page'; | ||
import { Browser } from '../../common/browser'; | ||
import { launchBrowser } from '../../common/browser-factory'; | ||
import { DetailsViewPage } from '../../common/page-controllers/details-view-page'; | ||
import { TargetPage } from '../../common/page-controllers/target-page'; | ||
import { scanForAccessibilityIssues } from '../../common/scan-for-accessibility-issues'; | ||
|
||
const tabStopsNavDataAutomationId: string = getAutomationIdSelector('TabStops'); | ||
|
||
describe('Details View -> FastPass -> TabStops', () => { | ||
let browser: Browser; | ||
let targetPage: TargetPage; | ||
let detailsViewPage: DetailsViewPage; | ||
let backgroundPage: BackgroundPage; | ||
|
||
beforeAll(async () => { | ||
browser = await launchBrowser({ suppressFirstTimeDialog: true }); | ||
targetPage = await browser.newTargetPage(); | ||
await browser.newPopupPage(targetPage); // Required for the details view to register as having permissions/being open | ||
detailsViewPage = await openTabStopsPage(browser, targetPage); | ||
backgroundPage = await browser.backgroundPage(); | ||
await backgroundPage.enableFeatureFlag(FeatureFlags.newTabStopsDetailsView); | ||
}); | ||
|
||
afterAll(async () => { | ||
await browser?.close(); | ||
}); | ||
|
||
it.each([true, false])( | ||
'should pass accessibility validation with highContrastMode=%s', | ||
async highContrastMode => { | ||
await browser.setHighContrastMode(highContrastMode); | ||
await detailsViewPage.waitForHighContrastMode(highContrastMode); | ||
|
||
const results = await scanForAccessibilityIssues(detailsViewPage, '*'); | ||
expect(results).toHaveLength(0); | ||
}, | ||
); | ||
}); | ||
|
||
async function openTabStopsPage( | ||
browser: Browser, | ||
targetPage: TargetPage, | ||
): Promise<DetailsViewPage> { | ||
const detailsViewPage = await browser.newDetailsViewPage(targetPage); | ||
await detailsViewPage.switchToFastPass(); | ||
await detailsViewPage.waitForSelector(tabStopsNavDataAutomationId); | ||
await detailsViewPage.clickSelector(tabStopsNavDataAutomationId); | ||
|
||
return detailsViewPage; | ||
} |