Files
mostlymatter/e2e-tests/playwright/tests/accessibility/common/reset_password.spec.ts
Saturnino Abril 6746857ee7 MM-52642 CLD-6352 MM-54007 Prepare setup for Playwright pipeline (#24647)
* pipeline(playwright): prepare setup for playwright

* feedback address

* clean up readme

* Fix docker-compose command and definition for dashboard

* fix the dashboard

* ignore dashboard when formatting

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Mario Vitale <mvitale1989@hotmail.com>
2023-10-14 07:02:32 +08:00

56 строки
2.2 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {expect, test} from '@e2e-support/test_fixture';
test('/reset_password accessibility quick check', async ({pages, page, axe}) => {
// # Go to reset password page
const resetPasswordPage = new pages.ResetPasswordPage(page);
await resetPasswordPage.goto();
await resetPasswordPage.toBeVisible();
// # Analyze the page
const accessibilityScanResults = await axe.builder(resetPasswordPage.page, {disableColorContrast: true}).analyze();
// * Should have no violation
expect(accessibilityScanResults.violations).toHaveLength(0);
});
test('/reset_password accessibility tab support', async ({pages, page}) => {
// # Go to reset password page
const resetPasswordPage = new pages.ResetPasswordPage(page);
await resetPasswordPage.goto();
await resetPasswordPage.toBeVisible();
// * Should have focused at email input on page load
expect(await resetPasswordPage.emailInput).toBeFocused();
// * Should move focus to reset button after tab
await resetPasswordPage.emailInput.press('Tab');
expect(await resetPasswordPage.resetButton).toBeFocused();
// * Should move focus to about link after tab
await resetPasswordPage.resetButton.press('Tab');
expect(await resetPasswordPage.footer.aboutLink).toBeFocused();
// * Should move focus to privacy policy link after tab
await resetPasswordPage.footer.aboutLink.press('Tab');
expect(await resetPasswordPage.footer.privacyPolicyLink).toBeFocused();
// * Should move focus to terms link after tab
await resetPasswordPage.footer.privacyPolicyLink.press('Tab');
expect(await resetPasswordPage.footer.termsLink).toBeFocused();
// * Should move focus to help link after tab
await resetPasswordPage.footer.termsLink.press('Tab');
expect(await resetPasswordPage.footer.helpLink).toBeFocused();
// # Move focus to email input
await resetPasswordPage.emailInput.focus();
expect(await resetPasswordPage.emailInput).toBeFocused();
// * Should move focus to back button after shift+tab
await resetPasswordPage.emailInput.press('Shift+Tab');
expect(await resetPasswordPage.header.backButton).toBeFocused();
});