Files
openclaw-mattermost-extension/playwright.config.ts
T

106 lines
2.6 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
import { TEST_CONFIG } from "./tests/e2e/config.js";
/**
* Playwright E2E test configuration for OpenClaw Mattermost Extension
* Tests against Mattermost web UI for end-to-end scenarios
*
* @see https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
testDir: "./tests/e2e",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 1,
/* Opt out of parallel tests on CI for stability */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use */
reporter: [
["html", { outputFolder: "test-results/e2e-html-report" }],
["list"],
["json", { outputFile: "test-results/e2e-results.json" }],
],
/* Shared settings for all the projects below */
use: {
/* Base URL for all tests - Mattermost server URL */
baseURL: TEST_CONFIG.mattermost.baseUrl,
/* Collect trace when retrying the failed test */
trace: "on-first-retry",
/* Capture screenshot on failure */
screenshot: "only-on-failure",
/* Record video on retry */
video: "on-first-retry",
/* Action timeout - how long each action can take */
actionTimeout: 15000,
/* Navigation timeout */
navigationTimeout: 30000,
/* Viewport settings */
viewport: { width: 1280, height: 720 },
},
/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},
// Test against mobile viewports
{
name: "Mobile Chrome",
use: { ...devices["Pixel 5"] },
},
{
name: "Mobile Safari",
use: { ...devices["iPhone 12"] },
},
],
/* Run local dev server before starting the tests - optional */
webServer: process.env.E2E_USE_LOCAL_SERVER
? {
command: "npm run dev",
url: "http://localhost:8065",
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
}
: undefined,
/* Test timeout - overall test timeout */
timeout: 60000,
/* Expect timeout - default timeout for expect assertions */
expect: {
timeout: 10000,
},
/* Output directory for test artifacts */
outputDir: "test-results/e2e",
/* Global setup and teardown */
globalSetup: "./tests/e2e/global-setup.ts",
globalTeardown: "./tests/e2e/global-teardown.ts",
});