@red-hat-developer-hub/e2e-test-utils 1.1.23 → 1.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deployment/rhdh/deployment.d.ts +18 -1
- package/dist/deployment/rhdh/deployment.d.ts.map +1 -1
- package/dist/deployment/rhdh/deployment.js +135 -51
- package/dist/playwright/fixtures/test.d.ts.map +1 -1
- package/dist/playwright/fixtures/test.js +8 -0
- package/dist/playwright/helpers/ui-helper.d.ts +7 -0
- package/dist/playwright/helpers/ui-helper.d.ts.map +1 -1
- package/dist/playwright/helpers/ui-helper.js +16 -0
- package/dist/playwright/teardown-reporter.d.ts +17 -5
- package/dist/playwright/teardown-reporter.d.ts.map +1 -1
- package/dist/playwright/teardown-reporter.js +55 -14
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/kubernetes-client.d.ts.map +1 -1
- package/dist/utils/kubernetes-client.js +0 -2
- package/dist/utils/plugin-metadata.d.ts +52 -96
- package/dist/utils/plugin-metadata.d.ts.map +1 -1
- package/dist/utils/plugin-metadata.js +201 -211
- package/dist/utils/tests/helpers.d.ts +26 -0
- package/dist/utils/tests/helpers.d.ts.map +1 -0
- package/dist/utils/tests/helpers.js +84 -0
- package/dist/utils/tests/plugin-metadata.fixtures.test.d.ts +2 -0
- package/dist/utils/tests/plugin-metadata.fixtures.test.d.ts.map +1 -0
- package/dist/utils/tests/plugin-metadata.fixtures.test.js +563 -0
- package/dist/utils/tests/plugin-metadata.nightly.test.d.ts +2 -0
- package/dist/utils/tests/plugin-metadata.nightly.test.d.ts.map +1 -0
- package/dist/utils/tests/plugin-metadata.nightly.test.js +178 -0
- package/dist/utils/tests/plugin-metadata.pr.test.d.ts +2 -0
- package/dist/utils/tests/plugin-metadata.pr.test.d.ts.map +1 -0
- package/dist/utils/tests/plugin-metadata.pr.test.js +296 -0
- package/dist/utils/tests/plugin-metadata.test.d.ts.map +1 -0
- package/dist/utils/tests/plugin-metadata.test.js +156 -0
- package/dist/utils/workspace-paths.d.ts +43 -0
- package/dist/utils/workspace-paths.d.ts.map +1 -0
- package/dist/utils/workspace-paths.js +65 -0
- package/package.json +1 -1
- package/dist/utils/plugin-metadata.test.d.ts.map +0 -1
- package/dist/utils/plugin-metadata.test.js +0 -39
- /package/dist/utils/{plugin-metadata.test.d.ts → tests/plugin-metadata.test.d.ts} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static utility for resolving paths relative to a workspace's e2e-tests directory.
|
|
3
|
+
* Uses `test.info().project.testDir` to determine the workspace location —
|
|
4
|
+
* works correctly whether Playwright runs from the workspace or from the repo root.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { WorkspacePaths } from '@red-hat-developer-hub/e2e-test-utils/utils';
|
|
9
|
+
*
|
|
10
|
+
* // One-liner to resolve a config file path
|
|
11
|
+
* const configPath = WorkspacePaths.resolve("tests/config/rbac-configmap.yaml");
|
|
12
|
+
*
|
|
13
|
+
* // Access well-known directories
|
|
14
|
+
* WorkspacePaths.e2eRoot; // /abs/path/workspaces/acr/e2e-tests
|
|
15
|
+
* WorkspacePaths.workspaceRoot; // /abs/path/workspaces/acr
|
|
16
|
+
* WorkspacePaths.metadataDir; // /abs/path/workspaces/acr/metadata
|
|
17
|
+
* WorkspacePaths.configDir; // /abs/path/workspaces/acr/e2e-tests/tests/config
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class WorkspacePaths {
|
|
21
|
+
private constructor();
|
|
22
|
+
/** The workspace's e2e-tests directory, derived from the current test's project testDir. */
|
|
23
|
+
static get e2eRoot(): string;
|
|
24
|
+
/** Resolve a relative path from the e2e-tests directory. */
|
|
25
|
+
static resolve(relativePath: string): string;
|
|
26
|
+
/** The workspace root directory (parent of e2e-tests). */
|
|
27
|
+
static get workspaceRoot(): string;
|
|
28
|
+
/** The metadata directory. e.g., `workspaces/acr/metadata` */
|
|
29
|
+
static get metadataDir(): string;
|
|
30
|
+
/** The tests/config directory. e.g., `workspaces/acr/e2e-tests/tests/config` */
|
|
31
|
+
static get configDir(): string;
|
|
32
|
+
/** Default app-config path: `tests/config/app-config-rhdh.yaml` */
|
|
33
|
+
static get appConfig(): string;
|
|
34
|
+
/** Default secrets path: `tests/config/rhdh-secrets.yaml` */
|
|
35
|
+
static get secrets(): string;
|
|
36
|
+
/** Default dynamic plugins path: `tests/config/dynamic-plugins.yaml` */
|
|
37
|
+
static get dynamicPlugins(): string;
|
|
38
|
+
/** Default Helm value file path: `tests/config/value_file.yaml` */
|
|
39
|
+
static get valueFile(): string;
|
|
40
|
+
/** Default operator subscription path: `tests/config/subscription.yaml` */
|
|
41
|
+
static get subscription(): string;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=workspace-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-paths.d.ts","sourceRoot":"","sources":["../../src/utils/workspace-paths.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,cAAc;IACzB,OAAO;IAEP,4FAA4F;IAC5F,MAAM,KAAK,OAAO,IAAI,MAAM,CAE3B;IAED,4DAA4D;IAC5D,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAI5C,0DAA0D;IAC1D,MAAM,KAAK,aAAa,IAAI,MAAM,CAEjC;IAED,8DAA8D;IAC9D,MAAM,KAAK,WAAW,IAAI,MAAM,CAE/B;IAED,gFAAgF;IAChF,MAAM,KAAK,SAAS,IAAI,MAAM,CAE7B;IAID,mEAAmE;IACnE,MAAM,KAAK,SAAS,IAAI,MAAM,CAE7B;IAED,6DAA6D;IAC7D,MAAM,KAAK,OAAO,IAAI,MAAM,CAE3B;IAED,wEAAwE;IACxE,MAAM,KAAK,cAAc,IAAI,MAAM,CAElC;IAED,mEAAmE;IACnE,MAAM,KAAK,SAAS,IAAI,MAAM,CAE7B;IAED,2EAA2E;IAC3E,MAAM,KAAK,YAAY,IAAI,MAAM,CAEhC;CACF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { test } from "@playwright/test";
|
|
3
|
+
/**
|
|
4
|
+
* Static utility for resolving paths relative to a workspace's e2e-tests directory.
|
|
5
|
+
* Uses `test.info().project.testDir` to determine the workspace location —
|
|
6
|
+
* works correctly whether Playwright runs from the workspace or from the repo root.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { WorkspacePaths } from '@red-hat-developer-hub/e2e-test-utils/utils';
|
|
11
|
+
*
|
|
12
|
+
* // One-liner to resolve a config file path
|
|
13
|
+
* const configPath = WorkspacePaths.resolve("tests/config/rbac-configmap.yaml");
|
|
14
|
+
*
|
|
15
|
+
* // Access well-known directories
|
|
16
|
+
* WorkspacePaths.e2eRoot; // /abs/path/workspaces/acr/e2e-tests
|
|
17
|
+
* WorkspacePaths.workspaceRoot; // /abs/path/workspaces/acr
|
|
18
|
+
* WorkspacePaths.metadataDir; // /abs/path/workspaces/acr/metadata
|
|
19
|
+
* WorkspacePaths.configDir; // /abs/path/workspaces/acr/e2e-tests/tests/config
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export class WorkspacePaths {
|
|
23
|
+
constructor() { } // Static-only class
|
|
24
|
+
/** The workspace's e2e-tests directory, derived from the current test's project testDir. */
|
|
25
|
+
static get e2eRoot() {
|
|
26
|
+
return path.resolve(test.info().project.testDir, "..");
|
|
27
|
+
}
|
|
28
|
+
/** Resolve a relative path from the e2e-tests directory. */
|
|
29
|
+
static resolve(relativePath) {
|
|
30
|
+
return path.resolve(this.e2eRoot, relativePath);
|
|
31
|
+
}
|
|
32
|
+
/** The workspace root directory (parent of e2e-tests). */
|
|
33
|
+
static get workspaceRoot() {
|
|
34
|
+
return path.resolve(this.e2eRoot, "..");
|
|
35
|
+
}
|
|
36
|
+
/** The metadata directory. e.g., `workspaces/acr/metadata` */
|
|
37
|
+
static get metadataDir() {
|
|
38
|
+
return path.resolve(this.e2eRoot, "../metadata");
|
|
39
|
+
}
|
|
40
|
+
/** The tests/config directory. e.g., `workspaces/acr/e2e-tests/tests/config` */
|
|
41
|
+
static get configDir() {
|
|
42
|
+
return path.resolve(this.e2eRoot, "tests/config");
|
|
43
|
+
}
|
|
44
|
+
// ── Default config file paths ────────────────────────────────────────────
|
|
45
|
+
/** Default app-config path: `tests/config/app-config-rhdh.yaml` */
|
|
46
|
+
static get appConfig() {
|
|
47
|
+
return path.resolve(this.e2eRoot, "tests/config/app-config-rhdh.yaml");
|
|
48
|
+
}
|
|
49
|
+
/** Default secrets path: `tests/config/rhdh-secrets.yaml` */
|
|
50
|
+
static get secrets() {
|
|
51
|
+
return path.resolve(this.e2eRoot, "tests/config/rhdh-secrets.yaml");
|
|
52
|
+
}
|
|
53
|
+
/** Default dynamic plugins path: `tests/config/dynamic-plugins.yaml` */
|
|
54
|
+
static get dynamicPlugins() {
|
|
55
|
+
return path.resolve(this.e2eRoot, "tests/config/dynamic-plugins.yaml");
|
|
56
|
+
}
|
|
57
|
+
/** Default Helm value file path: `tests/config/value_file.yaml` */
|
|
58
|
+
static get valueFile() {
|
|
59
|
+
return path.resolve(this.e2eRoot, "tests/config/value_file.yaml");
|
|
60
|
+
}
|
|
61
|
+
/** Default operator subscription path: `tests/config/subscription.yaml` */
|
|
62
|
+
static get subscription() {
|
|
63
|
+
return path.resolve(this.e2eRoot, "tests/config/subscription.yaml");
|
|
64
|
+
}
|
|
65
|
+
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-metadata.test.d.ts","sourceRoot":"","sources":["../../src/utils/plugin-metadata.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { describe, it } from "node:test";
|
|
2
|
-
import assert from "node:assert";
|
|
3
|
-
import { extractPluginName, getNormalizedPluginMergeKey, } from "./plugin-metadata.js";
|
|
4
|
-
describe("getNormalizedPluginMergeKey", () => {
|
|
5
|
-
it("returns same key for OCI keycloak and local keycloak-dynamic (same logical plugin)", () => {
|
|
6
|
-
const oci = getNormalizedPluginMergeKey({
|
|
7
|
-
package: "oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/backstage-community-plugin-catalog-backend-module-keycloak:pr_1980__3.16.0!backstage-community-plugin-catalog-backend-module-keycloak",
|
|
8
|
-
});
|
|
9
|
-
const local = getNormalizedPluginMergeKey({
|
|
10
|
-
package: "./dynamic-plugins/dist/backstage-community-plugin-catalog-backend-module-keycloak-dynamic",
|
|
11
|
-
});
|
|
12
|
-
assert.strictEqual(oci, local, "same logical plugin has same merge key");
|
|
13
|
-
assert.strictEqual(oci, "backstage-community-plugin-catalog-backend-module-keycloak");
|
|
14
|
-
});
|
|
15
|
-
it("returns different keys for different plugins", () => {
|
|
16
|
-
const keycloak = getNormalizedPluginMergeKey({
|
|
17
|
-
package: "./dynamic-plugins/dist/backstage-community-plugin-catalog-backend-module-keycloak-dynamic",
|
|
18
|
-
});
|
|
19
|
-
const techRadar = getNormalizedPluginMergeKey({
|
|
20
|
-
package: "./dynamic-plugins/dist/backstage-community-plugin-tech-radar-dynamic",
|
|
21
|
-
});
|
|
22
|
-
assert.notStrictEqual(keycloak, techRadar);
|
|
23
|
-
});
|
|
24
|
-
it("returns empty string for missing or empty package", () => {
|
|
25
|
-
assert.strictEqual(getNormalizedPluginMergeKey({}), "");
|
|
26
|
-
assert.strictEqual(getNormalizedPluginMergeKey({ package: "" }), "");
|
|
27
|
-
assert.strictEqual(getNormalizedPluginMergeKey({ package: undefined }), "");
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
describe("extractPluginName", () => {
|
|
31
|
-
it("extracts name from OCI URL with tag and alias", () => {
|
|
32
|
-
const name = extractPluginName("oci://ghcr.io/org/repo/backstage-community-plugin-catalog-backend-module-keycloak:pr_1__1.0!alias");
|
|
33
|
-
assert.strictEqual(name, "backstage-community-plugin-catalog-backend-module-keycloak");
|
|
34
|
-
});
|
|
35
|
-
it("extracts name from local path with -dynamic suffix", () => {
|
|
36
|
-
const name = extractPluginName("./dynamic-plugins/dist/backstage-community-plugin-catalog-backend-module-keycloak-dynamic");
|
|
37
|
-
assert.strictEqual(name, "backstage-community-plugin-catalog-backend-module-keycloak-dynamic");
|
|
38
|
-
});
|
|
39
|
-
});
|
|
File without changes
|