MM-64282 E2E/Playwright: Test documentation format (#31050)

* initial implementation of test documentation in spec file with AI-assisted prompt from Claude and linter script

* update snapshots

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
sabril
2025-05-20 01:07:47 +08:00
коммит произвёл GitHub
родитель a358401772
Коммит 2116a6d94a
18 изменённых файлов: 1721 добавлений и 487 удалений

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

@@ -3,46 +3,58 @@
import {expect, test} from '@mattermost/playwright-lib';
test('MM-T5139: Message Priority - Standard message priority and system setting', async ({pw}) => {
// # Setup test environment
const {user} = await pw.initSetup();
/**
* @objective Verify that standard message priority posts correctly without priority labels and functions as expected.
*/
test(
'MM-T5139 posts message with standard priority and verifies no priority labels appear',
{tag: '@message_priority'},
async ({pw}) => {
// # Setup test environment
const {user} = await pw.initSetup();
// # Log in as a user in new browser context
const {channelsPage} = await pw.testBrowser.login(user);
// # Log in as a user in new browser context
const {channelsPage} = await pw.testBrowser.login(user);
// # Visit default channel page
await channelsPage.goto();
await channelsPage.toBeVisible();
// # Visit default channel page
await channelsPage.goto();
await channelsPage.toBeVisible();
// Open menu
await channelsPage.centerView.postCreate.openPriorityMenu();
// # Open priority menu
await channelsPage.centerView.postCreate.openPriorityMenu();
// Use messagePriority for dialog interactions
await channelsPage.messagePriority.verifyPriorityDialog();
await channelsPage.messagePriority.verifyStandardOptionSelected();
// * Verify priority dialog appears with standard option selected
await channelsPage.messagePriority.verifyPriorityDialog();
await channelsPage.messagePriority.verifyStandardOptionSelected();
// # Close menu and post message
await channelsPage.messagePriority.closePriorityMenu();
// # Close priority menu
await channelsPage.messagePriority.closePriorityMenu();
const testMessage = 'This is just a test message';
await channelsPage.postMessage(testMessage);
// # Post a message with standard priority
const testMessage = 'This is just a test message';
await channelsPage.postMessage(testMessage);
// # Verify message posts without priority label
const lastPost = await channelsPage.getLastPost();
await lastPost.toBeVisible();
await lastPost.toContainText(testMessage);
await expect(lastPost.container.locator('.post-priority')).not.toBeVisible();
// * Verify message posts correctly with the expected text
const lastPost = await channelsPage.getLastPost();
await lastPost.toBeVisible();
await lastPost.toContainText(testMessage);
// # Open post in RHS and verify
await lastPost.container.click();
await channelsPage.sidebarRight.toBeVisible();
// * Verify no priority label appears on the post
await expect(lastPost.container.locator('.post-priority')).not.toBeVisible();
// # Get RHS post and verify content
const rhsPost = await channelsPage.sidebarRight.getLastPost();
await rhsPost.toBeVisible();
await rhsPost.toContainText(testMessage);
await expect(rhsPost.container.locator('.post-priority')).not.toBeVisible();
// # Open post in right-hand sidebar
await lastPost.container.click();
await channelsPage.sidebarRight.toBeVisible();
// # Verify RHS formatting bar doesn't have priority button
await expect(channelsPage.sidebarRight.postCreate.priorityButton).not.toBeVisible();
});
// * Verify post content appears correctly in RHS
const rhsPost = await channelsPage.sidebarRight.getLastPost();
await rhsPost.toBeVisible();
await rhsPost.toContainText(testMessage);
// * Verify no priority label appears in RHS
await expect(rhsPost.container.locator('.post-priority')).not.toBeVisible();
// * Verify RHS formatting bar doesn't include priority button
await expect(channelsPage.sidebarRight.postCreate.priorityButton).not.toBeVisible();
},
);