diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 22b7418..6852131 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.37", + text: "v1.1.38", items: [{ text: "Changelog", link: "/changelog" }], }, ], diff --git a/docs/changelog.md b/docs/changelog.md index c315905..451ee01 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,7 +2,13 @@ All notable changes to this project will be documented in this file. -## [1.1.37] - Current +## [1.1.38] - Current + +### Added + +- **Automatic workspace and project annotations**: All tests now automatically receive `workspace` and `project` annotations via a Playwright [automatic fixture](https://playwright.dev/docs/test-fixtures#automatic-fixtures). The workspace name is derived from `testDir` and the project name comes from the Playwright project configuration. No consumer changes required. + +## [1.1.37] ### Added diff --git a/package.json b/package.json index 5cbe6f9..f5d563b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@red-hat-developer-hub/e2e-test-utils", - "version": "1.1.37", + "version": "1.1.38", "description": "Test utilities for RHDH E2E tests", "license": "Apache-2.0", "repository": { diff --git a/src/playwright/fixtures/test.ts b/src/playwright/fixtures/test.ts index e1711c1..4456227 100644 --- a/src/playwright/fixtures/test.ts +++ b/src/playwright/fixtures/test.ts @@ -3,12 +3,14 @@ import { test as base } from "@playwright/test"; import { LoginHelper, UIhelper } from "../helpers/index.js"; import { runOnce } from "../run-once.js"; import { $ } from "../../utils/bash.js"; +import { WorkspacePaths } from "../../utils/workspace-paths.js"; import path from "path"; type RHDHDeploymentTestFixtures = { rhdh: RHDHDeployment; uiHelper: UIhelper; loginHelper: LoginHelper; + autoAnnotations: void; }; type RHDHDeploymentWorkerFixtures = { @@ -61,6 +63,20 @@ const baseTest = base.extend< }, { scope: "test" }, ] as const, + autoAnnotations: [ + // eslint-disable-next-line no-empty-pattern + async ({}, use, testInfo) => { + testInfo.annotations.push( + { + type: "workspace", + description: path.basename(WorkspacePaths.workspaceRoot), + }, + { type: "project", description: testInfo.project.name }, + ); + await use(); + }, + { auto: true, scope: "test" }, + ], }); export const test = Object.assign(baseTest, {