diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 9aa5f59..2d11792 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -33,7 +33,7 @@ export default defineConfig({ { text: "Examples", link: "/examples/" }, { text: "Overlay Testing", link: "/overlay/" }, { - text: "v1.1.9", + text: "v1.1.10", items: [{ text: "Changelog", link: "/changelog" }], }, ], diff --git a/docs/api/playwright/base-config.md b/docs/api/playwright/base-config.md index b96586b..4c8ee48 100644 --- a/docs/api/playwright/base-config.md +++ b/docs/api/playwright/base-config.md @@ -53,20 +53,22 @@ Raw base configuration object. Use for advanced customization. testDir: "./tests", timeout: 90000, expect: { - timeout: 30000, + timeout: 10000, }, - fullyParallel: true, forbidOnly: !!process.env.CI, - retries: process.env.CI ? 1 : 0, - workers: "50%", - reporter: [["list"], ["html"]], + retries: Number(process.env.PLAYWRIGHT_RETRIES ?? 0), + workers: process.env.PLAYWRIGHT_WORKERS || "50%", + outputDir: "node_modules/.cache/e2e-test-results", + reporter: [["list"], ["html"], ["json"]], use: { viewport: { width: 1920, height: 1080 }, - video: "on", + video: { mode: "retain-on-failure", size: { width: 1280, height: 720 } }, trace: "retain-on-failure", screenshot: "only-on-failure", + actionTimeout: 10000, + navigationTimeout: 50000, }, - globalSetup: require.resolve("./global-setup"), + globalSetup: resolve(import.meta.dirname, "../playwright/global-setup.js"), } ``` @@ -89,14 +91,16 @@ export default playwrightDefineConfig({ |---------|-------| | `testDir` | `"./tests"` | | `timeout` | `90000` | -| `expect.timeout` | `30000` | -| `fullyParallel` | `true` | -| `retries` | `1` (CI), `0` (local) | -| `workers` | `"50%"` | +| `expect.timeout` | `10000` | +| `retries` | `0` (configurable via `PLAYWRIGHT_RETRIES`) | +| `workers` | `"50%"` (configurable via `PLAYWRIGHT_WORKERS`) | +| `outputDir` | `"node_modules/.cache/e2e-test-results"` | | `viewport` | `1920x1080` | -| `video` | `"on"` | +| `video` | `"retain-on-failure"` at `1280x720` | | `trace` | `"retain-on-failure"` | | `screenshot` | `"only-on-failure"` | +| `actionTimeout` | `10000` | +| `navigationTimeout` | `50000` | ## Customization Examples diff --git a/docs/changelog.md b/docs/changelog.md index 7da2d0c..59813c6 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,7 +2,16 @@ All notable changes to this project will be documented in this file. -## [1.1.9] - Current +## [1.1.10] - Current + +### Fixed +- **`plugins-list.yaml` parsing**: Parse as proper YAML instead of text splitting, correctly handling entries with build flags (e.g., `--embed-package`, `--suppress-native-package`) and YAML comments. + +### Changed +- **Video recording**: Changed mode from `"on"` to `"retain-on-failure"` and reduced size from `1920x1080` to `1280x720` to save disk space. +- **Workers and retries**: Now configurable via `PLAYWRIGHT_WORKERS` (default: `"50%"`) and `PLAYWRIGHT_RETRIES` (default: `0`) environment variables. + +## [1.1.9] ### Fixed - **OCI URL replacement with user-provided `dynamic-plugins.yaml`**: When a workspace provides its own `dynamic-plugins.yaml`, plugin package paths were not replaced with OCI URLs for PR builds. Extracted shared `replaceWithOCIUrls()` function so both `generateDynamicPluginsConfigFromMetadata()` and `loadAndInjectPluginMetadata()` code paths now perform OCI replacement when `GIT_PR_NUMBER` is set. diff --git a/docs/guide/configuration/environment-variables.md b/docs/guide/configuration/environment-variables.md index c99225f..fe47fe7 100644 --- a/docs/guide/configuration/environment-variables.md +++ b/docs/guide/configuration/environment-variables.md @@ -20,6 +20,13 @@ These are set automatically during deployment: | `K8S_CLUSTER_ROUTER_BASE` | OpenShift ingress domain | Global setup | | `RHDH_BASE_URL` | Full RHDH URL | RHDHDeployment | +## Playwright Variables + +| Variable | Description | Default | +|----------|-------------|---------| +| `PLAYWRIGHT_WORKERS` | Number of parallel workers (e.g., `"4"`, `"50%"`) | `"50%"` | +| `PLAYWRIGHT_RETRIES` | Number of test retries on failure | `0` | + ## Optional Variables | Variable | Description | Default | diff --git a/docs/guide/core-concepts/playwright-config.md b/docs/guide/core-concepts/playwright-config.md index ab802db..70e92ac 100644 --- a/docs/guide/core-concepts/playwright-config.md +++ b/docs/guide/core-concepts/playwright-config.md @@ -26,8 +26,8 @@ The `defineConfig` function extends your configuration with sensible defaults fo | `testDir` | `./tests` | Test files location | | `timeout` | 90,000ms | Test timeout | | `expect.timeout` | 10,000ms | Assertion timeout | -| `retries` | 1 (CI), 0 (local) | Test retries | -| `workers` | 50% of CPUs | Parallel workers | +| `retries` | `0` (configurable via `PLAYWRIGHT_RETRIES`) | Test retries | +| `workers` | `"50%"` (configurable via `PLAYWRIGHT_WORKERS`) | Parallel workers | | `outputDir` | `node_modules/.cache/e2e-test-results` | Playwright artifacts | ### Reporter Settings @@ -44,7 +44,7 @@ The `defineConfig` function extends your configuration with sensible defaults fo | `trace` | `"retain-on-failure"` | | `screenshot` | `"only-on-failure"` | | `viewport` | `{ width: 1920, height: 1080 }` | -| `video` | `"on"` | +| `video` | `"retain-on-failure"` at `1280x720` | | `actionTimeout` | 10,000ms | | `navigationTimeout` | 50,000ms | @@ -118,11 +118,14 @@ export default defineConfig({ ## Environment Variables for Configuration ```bash -# Affects retries (2 in CI, 0 locally) +# Enables forbidOnly and auto-cleanup CI=true -# Custom test directory -# (set via defineConfig, not env var) +# Configure retries (default: 0) +PLAYWRIGHT_RETRIES=2 + +# Configure parallel workers (default: "50%") +PLAYWRIGHT_WORKERS=4 ``` ## Using Base Config Directly @@ -204,7 +207,7 @@ export default defineConfig({ // Browser settings use: { viewport: { width: 1920, height: 1080 }, - video: "on", + video: { mode: "retain-on-failure", size: { width: 1280, height: 720 } }, trace: "retain-on-failure", screenshot: "only-on-failure", }, diff --git a/docs/overlay/examples/basic-plugin.md b/docs/overlay/examples/basic-plugin.md index 8d143de..6634e5f 100644 --- a/docs/overlay/examples/basic-plugin.md +++ b/docs/overlay/examples/basic-plugin.md @@ -67,7 +67,7 @@ workspaces//e2e-tests/ "eslint-plugin-check-file": "^3.3.1", "eslint-plugin-playwright": "^2.4.0", "prettier": "^3.7.4", - "rhdh-e2e-test-utils": "1.1.9", + "rhdh-e2e-test-utils": "1.1.10", "typescript": "^5.9.3", "typescript-eslint": "^8.50.0" } diff --git a/docs/overlay/examples/tech-radar.md b/docs/overlay/examples/tech-radar.md index 6a7bf02..563aeda 100644 --- a/docs/overlay/examples/tech-radar.md +++ b/docs/overlay/examples/tech-radar.md @@ -70,7 +70,7 @@ workspaces/tech-radar/e2e-tests/ "eslint-plugin-check-file": "^3.3.1", "eslint-plugin-playwright": "^2.4.0", "prettier": "^3.7.4", - "rhdh-e2e-test-utils": "1.1.9", + "rhdh-e2e-test-utils": "1.1.10", "typescript": "^5.9.3", "typescript-eslint": "^8.50.0" } diff --git a/docs/overlay/test-structure/directory-layout.md b/docs/overlay/test-structure/directory-layout.md index a994dbb..c5f441d 100644 --- a/docs/overlay/test-structure/directory-layout.md +++ b/docs/overlay/test-structure/directory-layout.md @@ -67,7 +67,7 @@ Defines the test package with dependencies and scripts: "eslint-plugin-check-file": "^3.3.1", "eslint-plugin-playwright": "^2.4.0", "prettier": "^3.7.4", - "rhdh-e2e-test-utils": "1.1.9", + "rhdh-e2e-test-utils": "1.1.10", "typescript": "^5.9.3", "typescript-eslint": "^8.50.0" } diff --git a/package.json b/package.json index b8cc6b8..1e00e61 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rhdh-e2e-test-utils", - "version": "1.1.9", + "version": "1.1.10", "description": "Test utilities for RHDH E2E tests", "license": "Apache-2.0", "type": "module", diff --git a/src/playwright/base-config.ts b/src/playwright/base-config.ts index 3760938..566ce16 100644 --- a/src/playwright/base-config.ts +++ b/src/playwright/base-config.ts @@ -11,8 +11,8 @@ import { resolve } from "path"; export const baseConfig: PlaywrightTestConfig = { testDir: "./tests", forbidOnly: !!process.env.CI, - retries: process.env.CI ? 1 : 0, - workers: "50%", + retries: Number(process.env.PLAYWRIGHT_RETRIES ?? 0), + workers: process.env.PLAYWRIGHT_WORKERS || "50%", outputDir: "node_modules/.cache/e2e-test-results", timeout: 90_000, reporter: [ @@ -26,8 +26,8 @@ export const baseConfig: PlaywrightTestConfig = { screenshot: "only-on-failure", viewport: { width: 1920, height: 1080 }, video: { - mode: "on", - size: { width: 1920, height: 1080 }, + mode: "retain-on-failure", + size: { width: 1280, height: 720 }, }, actionTimeout: 10_000, navigationTimeout: 50_000, diff --git a/src/utils/plugin-metadata.ts b/src/utils/plugin-metadata.ts index 6ebad98..be5c8a1 100644 --- a/src/utils/plugin-metadata.ts +++ b/src/utils/plugin-metadata.ts @@ -56,13 +56,20 @@ async function getOCIUrlsForPR( } const ownerRepo = match[1]; - // Read plugins list - const pluginsList = await fs.readFile(pluginsListPath, "utf-8"); - const pluginPaths = pluginsList - .trim() - .split("\n") - .map((l: string) => l.replace(/:$/, "").trim()) - .filter(Boolean); + // Parse plugins-list.yaml as YAML and extract keys (plugin paths) + const pluginsListContent = await fs.readFile(pluginsListPath, "utf-8"); + const pluginsListData = yaml.load(pluginsListContent) as Record< + string, + unknown + > | null; + + if (!pluginsListData || typeof pluginsListData !== "object") { + throw new Error( + `[PluginMetadata] plugins-list.yaml is empty or invalid: ${pluginsListPath}`, + ); + } + + const pluginPaths = Object.keys(pluginsListData); const workspaceName = path.basename(workspacePath);