Skip to content

Commit

Permalink
feat(tab-stops-details-view): add accessibility check e2e test for ne…
Browse files Browse the repository at this point in the history
…w tabstops details view (#4822)
  • Loading branch information
brocktaylor7 committed Oct 25, 2021
1 parent 9e724b4 commit 58c568d
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/tests/end-to-end/tests/details-view/tabstops.test.ts
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;
}

0 comments on commit 58c568d

Please sign in to comment.