Skip to content

Commit 3e959fc

Browse files
AndrienkoAleksandrGustavo Lira e Silva
andcommitted
feat(e2e): introduce e2e tests for bulk-import plugin
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com> Co-authored-by: Gustavo Lira e Silva <gliraesi@redhat.com>
1 parent 7bfac7d commit 3e959fc

12 files changed

Lines changed: 3493 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { createEslintConfig } from "rhdh-e2e-test-utils/eslint";
2+
3+
export default createEslintConfig(import.meta.dirname);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "bulk-imprort-e2e-tests",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"engines": {
7+
"node": ">=22",
8+
"yarn": ">=3"
9+
},
10+
"packageManager": "yarn@3.8.7",
11+
"description": "E2E tests for Bulk import plugin",
12+
"scripts": {
13+
"test": "CI=true playwright test",
14+
"report": "playwright show-report",
15+
"test:ui": "playwright test --ui",
16+
"test:headed": "playwright test --headed",
17+
"lint:check": "eslint .",
18+
"lint:fix": "eslint . --fix",
19+
"prettier:check": "prettier --check .",
20+
"prettier:fix": "prettier --write .",
21+
"check": "tsc --noEmit && yarn lint:check && yarn prettier:check"
22+
},
23+
"devDependencies": {
24+
"@eslint/js": "^9.39.2",
25+
"@playwright/test": "^1.56.1",
26+
"@types/node": "^24.10.1",
27+
"dotenv": "^16.4.7",
28+
"eslint": "^9.39.2",
29+
"eslint-plugin-check-file": "^3.3.1",
30+
"eslint-plugin-playwright": "^2.4.0",
31+
"prettier": "^3.7.4",
32+
"rhdh-e2e-test-utils": "1.1.0",
33+
"typescript": "^5.9.3",
34+
"typescript-eslint": "^8.50.0"
35+
}
36+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { defineConfig } from "rhdh-e2e-test-utils/playwright-config";
2+
import dotenv from "dotenv";
3+
4+
dotenv.config({ path: `${import.meta.dirname}/.env` });
5+
/**
6+
* Bulk import plugin e2e test configuration.
7+
* Extends the base config from rhdh-e2e-test-utils.
8+
*/
9+
export default defineConfig({
10+
projects: [
11+
{
12+
name: "bulk-import",
13+
timeout: 30 * 60 * 1000, // 30 min
14+
},
15+
],
16+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# rhdh app config file
2+
# this file is used to merge with the default values of the rhdh app config
3+
4+
integrations:
5+
github:
6+
- host: github.com
7+
token: ${GITHUB_TOKEN}
8+
# apps:
9+
# - appId: ${GITHUB_APP_APP_ID}
10+
# clientId: ${GITHUB_APP_CLIENT_ID}
11+
# clientSecret: ${GITHUB_APP_CLIENT_SECRET}
12+
# webhookUrl: ${GITHUB_APP_WEBHOOK_URL}
13+
# webhookSecret: ${GITHUB_APP_WEBHOOK_SECRET}
14+
# privateKey: |
15+
# ${GITHUB_APP_PRIVATE_KEY}
16+
gitlab:
17+
- host: gitlab.com
18+
token: temp
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
plugins:
2+
# bulk-import plugins
3+
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import-backend-dynamic
4+
disabled: false
5+
pluginConfig:
6+
bulkImport:
7+
importAPI: orchestrator
8+
orchestratorWorkflow: universal-pr
9+
- package: ./dynamic-plugins/dist/red-hat-developer-hub-backstage-plugin-bulk-import
10+
disabled: false
11+
pluginConfig:
12+
dynamicPlugins:
13+
frontend:
14+
red-hat-developer-hub.backstage-plugin-bulk-import:
15+
appIcons:
16+
- name: bulkImportIcon
17+
importName: BulkImportIcon
18+
dynamicRoutes:
19+
- path: /bulk-import/repositories
20+
importName: BulkImportPage
21+
menuItem:
22+
icon: bulkImportIcon
23+
text: Bulk import
24+
25+
- package: ./dynamic-plugins/dist/backstage-plugin-scaffolder-backend-module-github-dynamic
26+
disabled: true
27+
28+
# Group: Orchestrator
29+
- package: "oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/red-hat-developer-hub-backstage-plugin-orchestrator:bs_1.45.3__5.3.1"
30+
disabled: false
31+
pluginConfig:
32+
dynamicPlugins:
33+
frontend:
34+
red-hat-developer-hub.backstage-plugin-orchestrator:
35+
appIcons:
36+
- importName: OrchestratorIcon
37+
name: orchestratorIcon
38+
dynamicRoutes:
39+
- importName: OrchestratorPage
40+
menuItem:
41+
icon: orchestratorIcon
42+
text: Orchestrator
43+
textKey: menuItem.orchestrator
44+
path: /orchestrator
45+
entityTabs:
46+
- path: /workflows
47+
title: Workflows
48+
titleKey: catalog.entityPage.workflows.title
49+
mountPoint: entity.page.workflows
50+
mountPoints:
51+
- mountPoint: entity.page.workflows/cards
52+
importName: OrchestratorCatalogTab
53+
config:
54+
layout:
55+
gridColumn: 1 / -1
56+
if:
57+
anyOf:
58+
- IsOrchestratorCatalogTabAvailable
59+
60+
- package: "oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/red-hat-developer-hub-backstage-plugin-orchestrator-backend:bs_1.45.3__8.5.1"
61+
disabled: false
62+
pluginConfig:
63+
orchestrator:
64+
dataIndexService:
65+
url: http://sonataflow-platform-data-index-service.orchestrator.svc.cluster.local:80
66+
67+
- package: "oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/red-hat-developer-hub-backstage-plugin-scaffolder-backend-module-orchestrator:bs_1.45.3__1.3.1"
68+
disabled: false
69+
pluginConfig:
70+
orchestrator:
71+
dataIndexService:
72+
url: http://sonataflow-platform-data-index-service.orchestrator.svc.cluster.local:80
73+
74+
- package: "oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/red-hat-developer-hub-backstage-plugin-orchestrator-form-widgets:bs_1.45.3__1.6.0"
75+
disabled: false
76+
pluginConfig:
77+
dynamicPlugins:
78+
frontend:
79+
red-hat-developer-hub.backstage-plugin-orchestrator-form-widgets: { }
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: rhdh-secrets
5+
type: Opaque
6+
stringData:
7+
GITHUB_TOKEN: $GITHUB_TOKEN
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* Custom Playwright test with RHDH fixtures.
3+
* Uses standard @playwright/test so timeout is not overridden by rhdh-e2e-test-utils (500s).
4+
*/
5+
import { test as base } from "@playwright/test";
6+
import { RHDHDeployment } from "rhdh-e2e-test-utils/rhdh";
7+
import { LoginHelper, UIhelper } from "rhdh-e2e-test-utils/helpers";
8+
import { $ } from "rhdh-e2e-test-utils/utils";
9+
10+
const BEFORE_ALL_TIMEOUT_MS = 30 * 60 * 1000; // 30 min for orchestrator + RHDH deploy
11+
12+
export const test = base.extend<{
13+
rhdhDeploymentWorker: RHDHDeployment;
14+
rhdh: RHDHDeployment;
15+
uiHelper: UIhelper;
16+
loginHelper: LoginHelper;
17+
baseURL: string;
18+
}>({
19+
rhdhDeploymentWorker: [
20+
async ({}, use, workerInfo) => {
21+
const projectName = workerInfo.project.name;
22+
console.log(
23+
`Deploying rhdh for plugin ${projectName} in namespace ${projectName}`,
24+
);
25+
const rhdhDeployment = new RHDHDeployment(projectName);
26+
27+
try {
28+
base.setTimeout(BEFORE_ALL_TIMEOUT_MS);
29+
30+
await rhdhDeployment.configure({ auth: "keycloak" });
31+
32+
const orchestratorNamespace = "orchestrator";
33+
await $`bash tests/scripts/install-orchestrator.sh ${orchestratorNamespace}`;
34+
35+
await rhdhDeployment.deploy({ timeoutMs: BEFORE_ALL_TIMEOUT_MS });
36+
37+
await use(rhdhDeployment);
38+
} finally {
39+
if (process.env.CI) {
40+
console.log(`Deleting namespace ${projectName}`);
41+
await rhdhDeployment.teardown();
42+
}
43+
}
44+
},
45+
{ scope: "worker", auto: true },
46+
],
47+
48+
rhdh: [
49+
async ({ rhdhDeploymentWorker }, use) => {
50+
await use(rhdhDeploymentWorker);
51+
},
52+
{ scope: "test", auto: true },
53+
],
54+
55+
uiHelper: [
56+
async ({ page }, use) => {
57+
await use(new UIhelper(page));
58+
},
59+
{ scope: "test" },
60+
],
61+
62+
loginHelper: [
63+
async ({ page }, use) => {
64+
await use(new LoginHelper(page));
65+
},
66+
{ scope: "test" },
67+
],
68+
69+
baseURL: [
70+
async ({ rhdhDeploymentWorker }, use) => {
71+
await use(rhdhDeploymentWorker.rhdhUrl);
72+
},
73+
{ scope: "test" },
74+
],
75+
});
76+
77+
export { expect } from "@playwright/test";
78+
export type { Page } from "@playwright/test";

0 commit comments

Comments
 (0)