e2e-tests/playwright/script/README.md
This directory contains utility scripts for the Playwright E2E test suite.
The lint-test-docs.js script verifies that all spec files follow the required documentation format:
@objective and @precondition tags{tag: '@feature_name'})// # Action)// * Verification)# Run the linter directly
node script/lint-test-docs.js
# Or use the npm script
npm run lint:test-docs
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.
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.