mirror of
https://github.com/mattermost/mattermost.git
synced 2026-06-11 20:07:34 +00:00
* Switch Cypress to use shared ESLint config * Run --fix in Cypress * Manually fix remaining lint issues in Cypress * Switch Playwright to use shared ESLint config * Run --fix in Playwright * Manually fix remaining lint issues in Playwright * Install and cache web app deps during Cypress CI builds This also caches the types and client package. That isn't needed currently since it uses prepackaged versions of those, but I imagine we might change that at some point. * Run e2e-tests-check when ESLint plugin is updated * Change E2E test GHA caching to cache all of web app node_modules * Fix mismatch between cache save and restore * Try bumping cache keys * Copy step to install dependencies to server.run_cypress.sh I don't know how this must've worked before, but if this fixes the issue, it seems like neither Cypress nor Playwright actually use the cached depenendencies. * Try disabling caching entirely for Cypress tests * Try bypassing makefile? * Try also manually building dependencies in run_specs.sh I don't know why this appears to duplicate run_cypress.sh and run_playwright.sh, both of which are called run_test.sh which might not be used any more as best I can tell. * Try installing the web app dependencies in yet another place * Disable the extra steps in server.prepare.sh specifically for Cypress * Revert changes to update cache key and disable web app depenedency cache on Cypress builds
Playwright E2E Test Scripts
This directory contains utility scripts for the Playwright E2E test suite.
Test Documentation Format Linter
The lint-test-docs.js script verifies that all spec files follow the required documentation format:
- JSDoc with
@objectiveand@preconditiontags - Proper test title with MM-T ID (e.g., MM-T1234)
- Tag for feature categorization (e.g.,
{tag: '@feature_name'}) - Action comments (e.g.,
// # Action) - Verification comments (e.g.,
// * Verification)
Usage
# Run the linter directly
node script/lint-test-docs.js
# Or use the npm script
npm run lint:test-docs
Integration with CI
The linter is also integrated with the main check command, which is typically run before committing changes:
npm run check
This will run ESLint, Prettier, TypeScript type checking, and the test documentation format linter.
Requirements
All spec files should follow this format:
/**
* @objective Clear description of what the test verifies
*
* @precondition
* Special setup or conditions required for the test
* Note: Only include for non-default requirements
*/
test('descriptive test title', {tag: '@feature_tag'}, async ({pw}) => {
// # Initialize setup and login
const {user} = await pw.initSetup();
const {channelsPage} = await pw.testBrowser.login(user);
// # Navigate to channel and post a message
await channelsPage.goto();
await channelsPage.postMessage('Test message');
// * Verify message appears in the channel
const lastPost = await channelsPage.getLastPost();
await expect(lastPost.body).toContainText('Test message');
});
This ensures consistency across all test files and makes it easier to understand the purpose and requirements of each test.