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>
Этот коммит содержится в:
Saturnino Abril
2025-01-14 12:30:42 +08:00
коммит произвёл GitHub
родитель 20e9c6aa3e
Коммит 90e3d2833e
35 изменённых файлов: 554 добавлений и 591 удалений

Просмотреть файл

@@ -4,48 +4,47 @@
import {expect, test} from '@e2e-support/test_fixture';
import MessagePriority from '@e2e-support/ui/components/channels/message_priority';
test('MM-T5139: Message Priority - Standard message priority and system setting', async ({pw, pages}) => {
test('MM-T5139: Message Priority - Standard message priority and system setting', async ({pw}) => {
// # Setup test environment
const {user} = await pw.initSetup();
// # Log in as a user in new browser context
const {page} = await pw.testBrowser.login(user);
const {page, channelsPage} = await pw.testBrowser.login(user);
// # Visit default channel page
const channelPage = new pages.ChannelsPage(page);
await channelPage.goto();
await channelPage.toBeVisible();
await channelsPage.goto();
await channelsPage.toBeVisible();
const messagePriority = new MessagePriority(page.locator('body'));
// Open menu
await channelPage.centerView.postCreate.openPriorityMenu();
await channelsPage.centerView.postCreate.openPriorityMenu();
// Use messagePriority for dialog interactions
await messagePriority.verifyPriorityDialog();
await messagePriority.verifyStandardOptionSelected();
// # Close menu and post message
await channelPage.centerView.postCreate.priorityButton.click();
await channelsPage.centerView.postCreate.priorityButton.click();
const testMessage = 'This is just a test message';
await channelPage.postMessage(testMessage);
await channelsPage.postMessage(testMessage);
// # Verify message posts without priority label
const lastPost = await channelPage.centerView.getLastPost();
const lastPost = await channelsPage.centerView.getLastPost();
await lastPost.toBeVisible();
await lastPost.toContainText(testMessage);
await expect(lastPost.container.locator('.post-priority')).not.toBeVisible();
// # Open post in RHS and verify
await lastPost.container.click();
await channelPage.sidebarRight.toBeVisible();
await channelsPage.sidebarRight.toBeVisible();
// # Get RHS post and verify content
const rhsPost = await channelPage.sidebarRight.getLastPost();
const rhsPost = await channelsPage.sidebarRight.getLastPost();
await rhsPost.toBeVisible();
await rhsPost.toContainText(testMessage);
await expect(rhsPost.container.locator('.post-priority')).not.toBeVisible();
// # Verify RHS formatting bar doesn't have priority button
await expect(channelPage.sidebarRight.postCreate.priorityButton).not.toBeVisible();
await expect(channelsPage.sidebarRight.postCreate.priorityButton).not.toBeVisible();
});