mirror of
https://github.com/hanzoai/team.git
synced 2026-09-30 01:57:35 +00:00
* add testcontainers to playwright-lib * include retry mechanism for transient failures * - Introduced a new command `testcontainers:up` in package.json to run Playwright tests with Testcontainers. - Created a standalone Playwright configuration file `playwright.testcontainers-up.config.ts` for managing Testcontainers. - Added a no-op test `testcontainers_up.spec.ts` to ensure the Testcontainers stack is up during the test run. - Implemented a global setup script `testcontainers_up_global_setup.ts` to start and stop the Testcontainers stack. - Updated dependencies in package.json, including adding `chalk` for logging. * fix package-lock * fix tsc and restore waiting for all migrations to complete --------- Co-authored-by: Mattermost Build <[email protected]>
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.