E2E/Playwright: Instantiate page in pw (#29765)
* instantiate page in pw * update spec * fix storage key and require user when logging in via API --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
20e9c6aa3e
Коммит
90e3d2833e
@@ -3,77 +3,77 @@
|
||||
|
||||
import {expect, test} from '@e2e-support/test_fixture';
|
||||
|
||||
test('/login accessibility quick check', async ({pw, pages, page, axe}) => {
|
||||
test('/login accessibility quick check', async ({pw, axe}) => {
|
||||
// Set up the page not to redirect to the landing page
|
||||
await pw.hasSeenLandingPage();
|
||||
|
||||
// # Go to login page
|
||||
const {adminClient} = await pw.getAdminClient();
|
||||
const adminConfig = await adminClient.getConfig();
|
||||
const loginPage = new pages.LoginPage(page, adminConfig);
|
||||
await loginPage.goto();
|
||||
await loginPage.toBeVisible();
|
||||
await pw.loginPage.goto();
|
||||
await pw.loginPage.toBeVisible();
|
||||
|
||||
// # Analyze the page
|
||||
const accessibilityScanResults = await axe.builder(loginPage.page).analyze();
|
||||
const accessibilityScanResults = await axe.builder(pw.loginPage.page).analyze();
|
||||
|
||||
// * Should have no violation
|
||||
expect(accessibilityScanResults.violations).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('/login accessibility tab support', async ({pw, pages, page}) => {
|
||||
test('/login accessibility tab support', async ({pw}) => {
|
||||
// Set up the page not to redirect to the landing page
|
||||
await pw.hasSeenLandingPage();
|
||||
|
||||
// # Go to login page
|
||||
const {adminClient} = await pw.getAdminClient();
|
||||
const adminConfig = await adminClient.getConfig();
|
||||
const loginPage = new pages.LoginPage(page, adminConfig);
|
||||
await loginPage.goto();
|
||||
await loginPage.toBeVisible();
|
||||
await pw.loginPage.goto();
|
||||
await pw.loginPage.toBeVisible();
|
||||
|
||||
// * Should have focused at login input on page load
|
||||
expect(await loginPage.loginInput).toBeFocused();
|
||||
expect(await pw.loginPage.loginInput).toBeFocused();
|
||||
|
||||
// * Should move focus to password input after tab
|
||||
await loginPage.loginInput.press('Tab');
|
||||
expect(await loginPage.passwordInput).toBeFocused();
|
||||
await pw.loginPage.loginInput.press('Tab');
|
||||
expect(await pw.loginPage.passwordInput).toBeFocused();
|
||||
|
||||
// * Should move focus to password toggle button after tab
|
||||
await loginPage.passwordInput.press('Tab');
|
||||
expect(await loginPage.passwordToggleButton).toBeFocused();
|
||||
await pw.loginPage.passwordInput.press('Tab');
|
||||
expect(await pw.loginPage.passwordToggleButton).toBeFocused();
|
||||
|
||||
// * Should move focus to forgot password link after tab
|
||||
await loginPage.passwordToggleButton.press('Tab');
|
||||
expect(await loginPage.forgotPasswordLink).toBeFocused();
|
||||
await pw.loginPage.passwordToggleButton.press('Tab');
|
||||
expect(await pw.loginPage.forgotPasswordLink).toBeFocused();
|
||||
|
||||
// * Should move focus to forgot password link after tab
|
||||
await loginPage.forgotPasswordLink.press('Tab');
|
||||
expect(await loginPage.signInButton).toBeFocused();
|
||||
await pw.loginPage.forgotPasswordLink.press('Tab');
|
||||
expect(await pw.loginPage.signInButton).toBeFocused();
|
||||
|
||||
// * Should move focus to about link after tab
|
||||
await loginPage.signInButton.press('Tab');
|
||||
expect(await loginPage.footer.aboutLink).toBeFocused();
|
||||
await pw.loginPage.signInButton.press('Tab');
|
||||
expect(await pw.loginPage.footer.aboutLink).toBeFocused();
|
||||
|
||||
// * Should move focus to privacy policy link after tab
|
||||
await loginPage.footer.aboutLink.press('Tab');
|
||||
expect(await loginPage.footer.privacyPolicyLink).toBeFocused();
|
||||
await pw.loginPage.footer.aboutLink.press('Tab');
|
||||
expect(await pw.loginPage.footer.privacyPolicyLink).toBeFocused();
|
||||
|
||||
// * Should move focus to terms link after tab
|
||||
await loginPage.footer.privacyPolicyLink.press('Tab');
|
||||
expect(await loginPage.footer.termsLink).toBeFocused();
|
||||
await pw.loginPage.footer.privacyPolicyLink.press('Tab');
|
||||
expect(await pw.loginPage.footer.termsLink).toBeFocused();
|
||||
|
||||
// * Should move focus to help link after tab
|
||||
await loginPage.footer.termsLink.press('Tab');
|
||||
expect(await loginPage.footer.helpLink).toBeFocused();
|
||||
await pw.loginPage.footer.termsLink.press('Tab');
|
||||
expect(await pw.loginPage.footer.helpLink).toBeFocused();
|
||||
|
||||
// # Move focus to login input
|
||||
await loginPage.loginInput.focus();
|
||||
expect(await loginPage.loginInput).toBeFocused();
|
||||
await pw.loginPage.loginInput.focus();
|
||||
expect(await pw.loginPage.loginInput).toBeFocused();
|
||||
|
||||
// * Should move focus to login body after shift+tab
|
||||
await loginPage.loginInput.press('Shift+Tab');
|
||||
expect(await loginPage.bodyCard).toBeFocused();
|
||||
await pw.loginPage.loginInput.press('Shift+Tab');
|
||||
expect(await pw.loginPage.bodyCard).toBeFocused();
|
||||
|
||||
// * Should move focus to create account link after shift+tab
|
||||
await loginPage.bodyCard.press('Shift+Tab');
|
||||
expect(await loginPage.createAccountLink).toBeFocused();
|
||||
await pw.loginPage.bodyCard.press('Shift+Tab');
|
||||
expect(await pw.loginPage.createAccountLink).toBeFocused();
|
||||
|
||||
// * Should move focus to login body after tab
|
||||
await loginPage.createAccountLink.press('Shift+Tab');
|
||||
expect(await loginPage.header.logo).toBeFocused();
|
||||
await pw.loginPage.createAccountLink.press('Shift+Tab');
|
||||
expect(await pw.loginPage.header.logo).toBeFocused();
|
||||
});
|
||||
|
||||
@@ -3,53 +3,59 @@
|
||||
|
||||
import {expect, test} from '@e2e-support/test_fixture';
|
||||
|
||||
test('/reset_password accessibility quick check', async ({pages, page, axe}) => {
|
||||
test('/reset_password accessibility quick check', async ({pw, axe}) => {
|
||||
// Set up the page not to redirect to the landing page
|
||||
await pw.hasSeenLandingPage();
|
||||
|
||||
// # Go to reset password page
|
||||
const resetPasswordPage = new pages.ResetPasswordPage(page);
|
||||
await resetPasswordPage.goto();
|
||||
await resetPasswordPage.toBeVisible();
|
||||
await pw.resetPasswordPage.goto();
|
||||
await pw.resetPasswordPage.toBeVisible();
|
||||
|
||||
// # Analyze the page
|
||||
const accessibilityScanResults = await axe.builder(resetPasswordPage.page, {disableColorContrast: true}).analyze();
|
||||
const accessibilityScanResults = await axe
|
||||
.builder(pw.resetPasswordPage.page, {disableColorContrast: true})
|
||||
.analyze();
|
||||
|
||||
// * Should have no violation
|
||||
expect(accessibilityScanResults.violations).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('/reset_password accessibility tab support', async ({pages, page}) => {
|
||||
test('/reset_password accessibility tab support', async ({pw}) => {
|
||||
// Set up the page not to redirect to the landing page
|
||||
await pw.hasSeenLandingPage();
|
||||
|
||||
// # Go to reset password page
|
||||
const resetPasswordPage = new pages.ResetPasswordPage(page);
|
||||
await resetPasswordPage.goto();
|
||||
await resetPasswordPage.toBeVisible();
|
||||
await pw.resetPasswordPage.goto();
|
||||
await pw.resetPasswordPage.toBeVisible();
|
||||
|
||||
// * Should have focused at email input on page load
|
||||
expect(await resetPasswordPage.emailInput).toBeFocused();
|
||||
expect(await pw.resetPasswordPage.emailInput).toBeFocused();
|
||||
|
||||
// * Should move focus to reset button after tab
|
||||
await resetPasswordPage.emailInput.press('Tab');
|
||||
expect(await resetPasswordPage.resetButton).toBeFocused();
|
||||
await pw.resetPasswordPage.emailInput.press('Tab');
|
||||
expect(await pw.resetPasswordPage.resetButton).toBeFocused();
|
||||
|
||||
// * Should move focus to about link after tab
|
||||
await resetPasswordPage.resetButton.press('Tab');
|
||||
expect(await resetPasswordPage.footer.aboutLink).toBeFocused();
|
||||
await pw.resetPasswordPage.resetButton.press('Tab');
|
||||
expect(await pw.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();
|
||||
await pw.resetPasswordPage.footer.aboutLink.press('Tab');
|
||||
expect(await pw.resetPasswordPage.footer.privacyPolicyLink).toBeFocused();
|
||||
|
||||
// * Should move focus to terms link after tab
|
||||
await resetPasswordPage.footer.privacyPolicyLink.press('Tab');
|
||||
expect(await resetPasswordPage.footer.termsLink).toBeFocused();
|
||||
await pw.resetPasswordPage.footer.privacyPolicyLink.press('Tab');
|
||||
expect(await pw.resetPasswordPage.footer.termsLink).toBeFocused();
|
||||
|
||||
// * Should move focus to help link after tab
|
||||
await resetPasswordPage.footer.termsLink.press('Tab');
|
||||
expect(await resetPasswordPage.footer.helpLink).toBeFocused();
|
||||
await pw.resetPasswordPage.footer.termsLink.press('Tab');
|
||||
expect(await pw.resetPasswordPage.footer.helpLink).toBeFocused();
|
||||
|
||||
// # Move focus to email input
|
||||
await resetPasswordPage.emailInput.focus();
|
||||
expect(await resetPasswordPage.emailInput).toBeFocused();
|
||||
await pw.resetPasswordPage.emailInput.focus();
|
||||
expect(await pw.resetPasswordPage.emailInput).toBeFocused();
|
||||
|
||||
// * Should move focus to back button after shift+tab
|
||||
await resetPasswordPage.emailInput.press('Shift+Tab');
|
||||
expect(await resetPasswordPage.header.backButton).toBeFocused();
|
||||
await pw.resetPasswordPage.emailInput.press('Shift+Tab');
|
||||
expect(await pw.resetPasswordPage.header.backButton).toBeFocused();
|
||||
});
|
||||
|
||||
@@ -3,109 +3,113 @@
|
||||
|
||||
import {expect, test} from '@e2e-support/test_fixture';
|
||||
|
||||
test('/signup_user_complete accessibility quick check', async ({pages, page, axe}) => {
|
||||
test('/signup_user_complete accessibility quick check', async ({pw, axe}) => {
|
||||
// Set up the page not to redirect to the landing page
|
||||
await pw.hasSeenLandingPage();
|
||||
|
||||
// # Go to reset password page
|
||||
const signupPage = new pages.SignupPage(page);
|
||||
await signupPage.goto();
|
||||
await signupPage.toBeVisible();
|
||||
await pw.signupPage.goto();
|
||||
await pw.signupPage.toBeVisible();
|
||||
|
||||
// # Analyze the page
|
||||
const accessibilityScanResults = await axe
|
||||
.builder(signupPage.page, {disableColorContrast: true, disableLinkInTextBlock: true})
|
||||
.builder(pw.signupPage.page, {disableColorContrast: true, disableLinkInTextBlock: true})
|
||||
.analyze();
|
||||
|
||||
// * Should have no violation
|
||||
expect(accessibilityScanResults.violations).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('/signup_user_complete accessibility tab support', async ({pages, page}, testInfo) => {
|
||||
test('/signup_user_complete accessibility tab support', async ({pw}, testInfo) => {
|
||||
// Set up the page not to redirect to the landing page
|
||||
await pw.hasSeenLandingPage();
|
||||
|
||||
// # Go to reset password page
|
||||
const signupPage = new pages.SignupPage(page);
|
||||
await signupPage.goto();
|
||||
await signupPage.toBeVisible();
|
||||
await pw.signupPage.goto();
|
||||
await pw.signupPage.toBeVisible();
|
||||
|
||||
// * Should have focused at email input on page load
|
||||
expect(await signupPage.emailInput).toBeFocused();
|
||||
expect(await pw.signupPage.emailInput).toBeFocused();
|
||||
|
||||
// * Should move focus to username input after tab
|
||||
await signupPage.emailInput.press('Tab');
|
||||
expect(await signupPage.usernameInput).toBeFocused();
|
||||
await pw.signupPage.emailInput.press('Tab');
|
||||
expect(await pw.signupPage.usernameInput).toBeFocused();
|
||||
|
||||
// * Should move focus to password input after tab
|
||||
await signupPage.usernameInput.press('Tab');
|
||||
expect(await signupPage.passwordInput).toBeFocused();
|
||||
await pw.signupPage.usernameInput.press('Tab');
|
||||
expect(await pw.signupPage.passwordInput).toBeFocused();
|
||||
|
||||
// * Should move focus to password toggle button after tab
|
||||
await signupPage.passwordInput.press('Tab');
|
||||
expect(await signupPage.passwordToggleButton).toBeFocused();
|
||||
await pw.signupPage.passwordInput.press('Tab');
|
||||
expect(await pw.signupPage.passwordToggleButton).toBeFocused();
|
||||
|
||||
// * Should move focus to newsletter checkbox after tab
|
||||
await signupPage.passwordToggleButton.press('Tab');
|
||||
expect(await signupPage.newsLetterCheckBox).toBeFocused();
|
||||
await pw.signupPage.passwordToggleButton.press('Tab');
|
||||
expect(await pw.signupPage.newsLetterCheckBox).toBeFocused();
|
||||
|
||||
// * Should move focus to newsletter privacy policy link after tab
|
||||
await signupPage.newsLetterCheckBox.press('Tab');
|
||||
expect(await signupPage.newsLetterPrivacyPolicyLink).toBeFocused();
|
||||
await pw.signupPage.newsLetterCheckBox.press('Tab');
|
||||
expect(await pw.signupPage.newsLetterPrivacyPolicyLink).toBeFocused();
|
||||
|
||||
// * Should move focus to newsletter unsubscribe link after tab
|
||||
await signupPage.newsLetterPrivacyPolicyLink.press('Tab');
|
||||
expect(await signupPage.newsLetterUnsubscribeLink).toBeFocused();
|
||||
await pw.signupPage.newsLetterPrivacyPolicyLink.press('Tab');
|
||||
expect(await pw.signupPage.newsLetterUnsubscribeLink).toBeFocused();
|
||||
|
||||
// * Should move focus to agreement terms of use link after tab
|
||||
await signupPage.newsLetterUnsubscribeLink.press('Tab');
|
||||
expect(await signupPage.agreementTermsOfUseLink).toBeFocused();
|
||||
await pw.signupPage.newsLetterUnsubscribeLink.press('Tab');
|
||||
expect(await pw.signupPage.agreementTermsOfUseLink).toBeFocused();
|
||||
|
||||
// * Should move focus to agreement privacy policy link after tab
|
||||
await signupPage.agreementTermsOfUseLink.press('Tab');
|
||||
expect(await signupPage.agreementPrivacyPolicyLink).toBeFocused();
|
||||
await pw.signupPage.agreementTermsOfUseLink.press('Tab');
|
||||
expect(await pw.signupPage.agreementPrivacyPolicyLink).toBeFocused();
|
||||
|
||||
// * Should move focus to privacy policy link after tab
|
||||
await signupPage.footer.aboutLink.press('Tab');
|
||||
expect(await signupPage.footer.privacyPolicyLink).toBeFocused();
|
||||
await pw.signupPage.footer.aboutLink.press('Tab');
|
||||
expect(await pw.signupPage.footer.privacyPolicyLink).toBeFocused();
|
||||
|
||||
// * Should move focus to terms link after tab
|
||||
await signupPage.footer.privacyPolicyLink.press('Tab');
|
||||
expect(await signupPage.footer.termsLink).toBeFocused();
|
||||
await pw.signupPage.footer.privacyPolicyLink.press('Tab');
|
||||
expect(await pw.signupPage.footer.termsLink).toBeFocused();
|
||||
|
||||
// * Should move focus to help link after tab
|
||||
await signupPage.footer.termsLink.press('Tab');
|
||||
expect(await signupPage.footer.helpLink).toBeFocused();
|
||||
await pw.signupPage.footer.termsLink.press('Tab');
|
||||
expect(await pw.signupPage.footer.helpLink).toBeFocused();
|
||||
|
||||
// # Move focus to email input
|
||||
await signupPage.emailInput.focus();
|
||||
expect(await signupPage.emailInput).toBeFocused();
|
||||
await pw.signupPage.emailInput.focus();
|
||||
expect(await pw.signupPage.emailInput).toBeFocused();
|
||||
|
||||
// * Should move focus to sign up body after shift+tab
|
||||
await signupPage.emailInput.press('Shift+Tab');
|
||||
expect(await signupPage.bodyCard).toBeFocused();
|
||||
await pw.signupPage.emailInput.press('Shift+Tab');
|
||||
expect(await pw.signupPage.bodyCard).toBeFocused();
|
||||
|
||||
// * Should move focus to sign up body after shift+tab
|
||||
await signupPage.emailInput.press('Shift+Tab');
|
||||
expect(await signupPage.bodyCard).toBeFocused();
|
||||
await pw.signupPage.emailInput.press('Shift+Tab');
|
||||
expect(await pw.signupPage.bodyCard).toBeFocused();
|
||||
|
||||
if (testInfo.project.name === 'ipad') {
|
||||
// * Should move focus to header back button after shift+tab
|
||||
await signupPage.bodyCard.press('Shift+Tab');
|
||||
expect(await signupPage.header.backButton).toBeFocused();
|
||||
await pw.signupPage.bodyCard.press('Shift+Tab');
|
||||
expect(await pw.signupPage.header.backButton).toBeFocused();
|
||||
|
||||
// * Should move focus to log in link after shift+tab
|
||||
await signupPage.header.backButton.press('Shift+Tab');
|
||||
expect(await signupPage.loginLink).toBeFocused();
|
||||
await pw.signupPage.header.backButton.press('Shift+Tab');
|
||||
expect(await pw.signupPage.loginLink).toBeFocused();
|
||||
|
||||
// * Should move focus to header logo after shift+tab
|
||||
await signupPage.loginLink.press('Shift+Tab');
|
||||
expect(await signupPage.header.logo).toBeFocused();
|
||||
await pw.signupPage.loginLink.press('Shift+Tab');
|
||||
expect(await pw.signupPage.header.logo).toBeFocused();
|
||||
} else {
|
||||
// * Should move focus to log in link after shift+tab
|
||||
await signupPage.bodyCard.press('Shift+Tab');
|
||||
expect(await signupPage.loginLink).toBeFocused();
|
||||
await pw.signupPage.bodyCard.press('Shift+Tab');
|
||||
expect(await pw.signupPage.loginLink).toBeFocused();
|
||||
|
||||
// * Should move focus to header back button after shift+tab
|
||||
await signupPage.loginLink.press('Shift+Tab');
|
||||
expect(await signupPage.header.backButton).toBeFocused();
|
||||
await pw.signupPage.loginLink.press('Shift+Tab');
|
||||
expect(await pw.signupPage.header.backButton).toBeFocused();
|
||||
|
||||
// * Should move focus to header logo after shift+tab
|
||||
await signupPage.header.backButton.press('Shift+Tab');
|
||||
expect(await signupPage.header.logo).toBeFocused();
|
||||
await pw.signupPage.header.backButton.press('Shift+Tab');
|
||||
expect(await pw.signupPage.header.logo).toBeFocused();
|
||||
}
|
||||
});
|
||||
|
||||
Ссылка в новой задаче
Block a user