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]>
28 lines
1011 B
TypeScript
28 lines
1011 B
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import chalk from 'chalk';
|
|
|
|
import {startStack, stopStack} from '@mattermost/playwright-lib';
|
|
|
|
// Deliberately skips baseGlobalSetup() (admin user bootstrap, sysadmin setup, plugin config):
|
|
// `npm run testcontainers:up` is for bringing up a fresh, untouched server for poking around or
|
|
// for a later `npm run test` to reuse — not for preparing it as if a real suite were about to run.
|
|
async function globalSetup() {
|
|
try {
|
|
await startStack();
|
|
} catch (error: unknown) {
|
|
// eslint-disable-next-line no-console
|
|
console.error(chalk.cyan('[testcontainers]'), error);
|
|
await stopStack();
|
|
const message = error instanceof Error ? error.message : String(error);
|
|
throw new Error(chalk.red(`[testcontainers] stack failed to start: ${message}`));
|
|
}
|
|
|
|
return async function () {
|
|
await stopStack();
|
|
};
|
|
}
|
|
|
|
export default globalSetup;
|