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,11 +3,10 @@
|
||||
|
||||
import {test} from '@e2e-support/test_fixture';
|
||||
|
||||
test('/landing#/login', async ({pw, pages, page, isMobile, browserName, viewport}, testInfo) => {
|
||||
test('/landing#/login', async ({pw, page, browserName, viewport}, testInfo) => {
|
||||
// Go to landing login page
|
||||
const landingLoginPage = new pages.LandingLoginPage(page, isMobile);
|
||||
await landingLoginPage.goto();
|
||||
await landingLoginPage.toBeVisible();
|
||||
await pw.landingLoginPage.goto();
|
||||
await pw.landingLoginPage.toBeVisible();
|
||||
|
||||
// Match snapshot of landing page
|
||||
await pw.matchSnapshot(testInfo, {page, browserName, viewport});
|
||||
|
||||
@@ -3,27 +3,28 @@
|
||||
|
||||
import {test} from '@e2e-support/test_fixture';
|
||||
|
||||
test('/login', async ({pw, pages, page, browserName, viewport}, testInfo) => {
|
||||
test('/login', async ({pw, page, browserName, viewport}, testInfo) => {
|
||||
// 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 license = await adminClient.getClientLicenseOld();
|
||||
const loginPage = new pages.LoginPage(page, adminConfig);
|
||||
await loginPage.goto();
|
||||
await loginPage.toBeVisible();
|
||||
await pw.loginPage.goto();
|
||||
await pw.loginPage.toBeVisible();
|
||||
|
||||
// Click to other element to remove focus from email input
|
||||
await loginPage.title.click();
|
||||
await pw.loginPage.title.click();
|
||||
|
||||
// Match snapshot of login page
|
||||
const testArgs = {page, browserName, viewport};
|
||||
const license = await adminClient.getClientLicenseOld();
|
||||
const editionSuffix = license.IsLicensed === 'true' ? '' : 'free edition';
|
||||
await pw.matchSnapshot({...testInfo, title: `${testInfo.title} ${editionSuffix}`}, testArgs);
|
||||
|
||||
// Click sign in button without entering user credential
|
||||
await loginPage.signInButton.click();
|
||||
await loginPage.userErrorLabel.waitFor();
|
||||
await pw.waitForAnimationEnd(loginPage.bodyCard);
|
||||
await pw.loginPage.signInButton.click();
|
||||
await pw.loginPage.userErrorLabel.waitFor();
|
||||
await pw.waitForAnimationEnd(pw.loginPage.bodyCard);
|
||||
|
||||
// Match snapshot of login page with error
|
||||
await pw.matchSnapshot({...testInfo, title: `${testInfo.title} error ${editionSuffix}`}, testArgs);
|
||||
|
||||
@@ -3,37 +3,37 @@
|
||||
|
||||
import {test} from '@e2e-support/test_fixture';
|
||||
|
||||
test('/signup_email', async ({pw, pages, page, browserName, viewport}, testInfo) => {
|
||||
test('/signup_email', async ({pw, page, browserName, viewport}, testInfo) => {
|
||||
// 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 license = await adminClient.getClientLicenseOld();
|
||||
const loginPage = new pages.LoginPage(page, adminConfig);
|
||||
await loginPage.goto();
|
||||
await loginPage.toBeVisible();
|
||||
await pw.loginPage.goto();
|
||||
await pw.loginPage.toBeVisible();
|
||||
|
||||
// Create an account
|
||||
await loginPage.createAccountLink.click();
|
||||
await pw.loginPage.createAccountLink.click();
|
||||
|
||||
// Should have redirected to signup page
|
||||
const signupPage = new pw.pages.SignupPage(page);
|
||||
await signupPage.toBeVisible();
|
||||
await pw.signupPage.toBeVisible();
|
||||
|
||||
// Click to other element to remove focus from email input
|
||||
await signupPage.title.click();
|
||||
await pw.signupPage.title.click();
|
||||
|
||||
// Match snapshot of signup_email page
|
||||
const testArgs = {page, browserName, viewport};
|
||||
const license = await adminClient.getClientLicenseOld();
|
||||
const editionSuffix = license.IsLicensed === 'true' ? '' : 'free edition';
|
||||
await pw.matchSnapshot({...testInfo, title: `${testInfo.title} ${editionSuffix}`}, testArgs);
|
||||
|
||||
// Click sign in button without entering user credential
|
||||
const invalidUser = {email: 'invalid', username: 'a', password: 'b'};
|
||||
await signupPage.create(invalidUser, false);
|
||||
await signupPage.emailError.waitFor();
|
||||
await signupPage.usernameError.waitFor();
|
||||
await signupPage.passwordError.waitFor();
|
||||
await pw.waitForAnimationEnd(signupPage.bodyCard);
|
||||
await pw.signupPage.create(invalidUser, false);
|
||||
await pw.signupPage.emailError.waitFor();
|
||||
await pw.signupPage.usernameError.waitFor();
|
||||
await pw.signupPage.passwordError.waitFor();
|
||||
await pw.waitForAnimationEnd(pw.signupPage.bodyCard);
|
||||
|
||||
// Match snapshot of signup_email page
|
||||
await pw.matchSnapshot({...testInfo, title: `${testInfo.title} error ${editionSuffix}`}, testArgs);
|
||||
|
||||
Ссылка в новой задаче
Block a user