Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ global:
disabled: false
- package: ./dynamic-plugins/dist/backstage-community-plugin-azure-devops
disabled: false
- package: ./dynamic-plugins/dist/parfuemerie-douglas-scaffolder-backend-module-azure-repositories-dynamic
disabled: false
- package: ./dynamic-plugins/dist/backstage-community-plugin-jenkins-backend-dynamic
disabled: false
pluginConfig:
Expand Down
5 changes: 1 addition & 4 deletions e2e-tests/playwright/e2e/github-happy-path.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,7 @@ test.describe.serial("GitHub Happy path", async () => {
});

test("Verify that the 5, 10, 20 items per page option properly displays the correct number of PRs", async () => {
await uiHelper.openCatalogSidebar("Component");
await uiHelper.clickLink("Red Hat Developer Hub");
await common.clickOnGHloginPopup();
await uiHelper.clickTab("Pull/Merge Requests");
await uiHelper.clickButton("OPEN", { force: true });
const allPRs = await BackstageShowcase.getShowcasePRs("open");
await backstageShowcase.verifyPRRowsPerPage(5, allPRs);
await backstageShowcase.verifyPRRowsPerPage(10, allPRs);
Expand Down
68 changes: 33 additions & 35 deletions e2e-tests/playwright/e2e/plugins/bulk-import.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import {

// Pre-req : plugin-bulk-import & plugin-bulk-import-backend-dynamic
test.describe.serial("Bulk Import plugin", () => {
test.skip(() => process.env.JOB_NAME.includes("osd-gcp")); // skipping due to RHIDP-5704 on OSD Env
test.skip(() => process.env.JOB_NAME?.includes("osd-gcp") ?? false); // skipping due to RHIDP-5704 on OSD Env
// TODO: https://issues.redhat.com/browse/RHDHBUGS-2116
test.fixme(() => process.env.JOB_TYPE.includes("presubmit")); // skip on PR checks
test.fixme(() => !process.env.JOB_NAME.includes("ocp")); // run only on OCP jobs to avoid GH rate limit
test.fixme(() => !(process.env.JOB_NAME?.includes("nightly") ?? false)); // run only on nightly jobs
test.fixme(() => !(process.env.JOB_NAME?.includes("ocp") ?? false)); // run only on OCP jobs to avoid GH rate limit
test.describe.configure({ retries: process.env.CI ? 5 : 0 });

let page: Page;
Expand Down Expand Up @@ -84,11 +84,20 @@ spec:
test("Add a Repository from the Repository Tab and Confirm its Preview", async () => {
await uiHelper.openSidebar("Bulk import");
await uiHelper.clickButton("Import");
await uiHelper.searchInputPlaceholder(catalogRepoDetails.name);

await uiHelper.verifyRowInTableByUniqueText(catalogRepoDetails.name, [
"Not Generated",
]);
// Search results and catalog-info.yaml status may take time to load;
// the GitHub API may return empty results or "Generating" status initially.
// Clear and re-enter the search on each retry to trigger a fresh API call.
await expect(async () => {
await uiHelper.searchInputPlaceholder("");
await uiHelper.searchInputPlaceholder(catalogRepoDetails.name);
await uiHelper.verifyRowInTableByUniqueText(catalogRepoDetails.name, [
"Not Generated",
]);
}).toPass({
intervals: [2_000, 5_000, 10_000],
timeout: 60_000,
});
await bulkimport.selectRepoInTable(catalogRepoDetails.name);
await uiHelper.verifyRowInTableByUniqueText(catalogRepoDetails.name, [
catalogRepoDetails.url,
Expand Down Expand Up @@ -127,14 +136,11 @@ spec:
});

test('Verify that the two selected repositories are listed: one with the status "Already imported" and another with the status "WAIT_PR_APPROVAL."', async () => {
await common.waitForLoad();
await bulkimport.filterAddedRepo(catalogRepoDetails.name);
await uiHelper.verifyRowInTableByUniqueText(catalogRepoDetails.name, [
await bulkimport.filterAndVerifyAddedRepo(catalogRepoDetails.name, [
catalogRepoDetails.url,
"Added",
]);
await bulkimport.filterAddedRepo(newRepoDetails.repoName);
await uiHelper.verifyRowInTableByUniqueText(newRepoDetails.repoName, [
await bulkimport.filterAndVerifyAddedRepo(newRepoDetails.repoName, [
"Waiting for Approval",
]);
});
Expand Down Expand Up @@ -213,15 +219,13 @@ spec:
),
).toHaveLength(0);

await bulkimport.filterAddedRepo(newRepoDetails.repoName);
// verify that the status has changed to "Already imported."
await uiHelper.clickOnButtonInTableByUniqueText(
// Verify that the status has changed to "Added" after merging the PR.
// Use retry with a Refresh click to wait for the backend to process.
await bulkimport.filterAndVerifyAddedRepo(
newRepoDetails.repoName,
"Refresh",
["Added"],
{ refresh: true },
);
await uiHelper.verifyRowInTableByUniqueText(newRepoDetails.repoName, [
"Already imported",
]);
});

test("Verify Added Repositories Appear in the Catalog as Expected", async () => {
Expand Down Expand Up @@ -282,10 +286,10 @@ spec:

test.describe
.serial("Bulk Import - Verify existing repo are displayed in bulk import Added repositories", () => {
test.skip(() => process.env.JOB_NAME.includes("osd-gcp")); // skipping due to RHIDP-5704 on OSD Env
test.skip(() => process.env.JOB_NAME?.includes("osd-gcp") ?? false); // skipping due to RHIDP-5704 on OSD Env
// TODO: https://issues.redhat.com/browse/RHDHBUGS-2116
test.fixme(() => process.env.JOB_TYPE.includes("presubmit")); // skip on PR checks
test.fixme(() => !process.env.JOB_NAME.includes("ocp")); // run only on OCP jobs to avoid GH rate limit
test.fixme(() => !(process.env.JOB_NAME?.includes("nightly") ?? false)); // run only on nightly jobs
test.fixme(() => !(process.env.JOB_NAME?.includes("ocp") ?? false)); // run only on OCP jobs to avoid GH rate limit
let page: Page;
let uiHelper: UIhelper;
let common: Common;
Expand All @@ -312,11 +316,8 @@ test.describe
});

test("Verify existing repo from app-config is displayed in bulk import Added repositories", async () => {
await uiHelper.openSidebar("Bulk import");
await common.waitForLoad();
await bulkimport.filterAddedRepo(existingRepoFromAppConfig);
await uiHelper.verifyRowInTableByUniqueText(existingRepoFromAppConfig, [
"Already imported",
await bulkimport.filterAndVerifyAddedRepo(existingRepoFromAppConfig, [
"Added",
]);
});

Expand All @@ -331,22 +332,19 @@ test.describe
);

// Verify in bulk import's Added Repositories
await uiHelper.openSidebar("Bulk import");
await common.waitForLoad();
await bulkimport.filterAddedRepo(existingComponentDetails.repoName);
await uiHelper.verifyRowInTableByUniqueText(
await bulkimport.filterAndVerifyAddedRepo(
existingComponentDetails.repoName,
["Already imported"],
["Added"],
);
});
});

test.describe
.serial("Bulk Import - Ensure users without bulk import permissions cannot access the bulk import plugin", () => {
test.skip(() => process.env.JOB_NAME.includes("osd-gcp")); // skipping due to RHIDP-5704 on OSD Env
test.skip(() => process.env.JOB_NAME?.includes("osd-gcp") ?? false); // skipping due to RHIDP-5704 on OSD Env
// TODO: https://issues.redhat.com/browse/RHDHBUGS-2116
test.fixme(() => process.env.JOB_TYPE.includes("presubmit")); // skip on PR checks
test.fixme(() => !process.env.JOB_NAME.includes("ocp")); // run only on OCP jobs to avoid GH rate limit
test.fixme(() => !(process.env.JOB_NAME?.includes("nightly") ?? false)); // run only on nightly jobs
test.fixme(() => !(process.env.JOB_NAME?.includes("ocp") ?? false)); // run only on OCP jobs to avoid GH rate limit
let page: Page;
let uiHelper: UIhelper;
let common: Common;
Expand Down
4 changes: 3 additions & 1 deletion e2e-tests/playwright/support/page-objects/global-fab-po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export class FabPo extends PageObject {

public async clickFabMenuByLabel(label: string) {
const locator = this.page.getByTestId(this.generateDataTestId(label));
await locator.click();
await expect(locator).toBeVisible({ timeout: 15000 });
await locator.dispatchEvent("click");
}

public async clickFabMenuByTestId(id: string) {
Expand All @@ -28,6 +29,7 @@ export class FabPo extends PageObject {

public async verifyFabButtonByLabel(label: string) {
const locator = this.page.getByTestId(this.generateDataTestId(label));
await expect(locator).toBeVisible();
await expect(locator).toContainText(label);
}

Expand Down
43 changes: 43 additions & 0 deletions e2e-tests/playwright/support/pages/bulk-import.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { Page, expect } from "@playwright/test";
import { APIHelper } from "../../utils/api-helper";
import { UIhelper } from "../../utils/ui-helper";
import { Common } from "../../utils/common";
import { UI_HELPER_ELEMENTS } from "../page-objects/global-obj";

export class BulkImport {
private page: Page;
private uiHelper: UIhelper;
private common: Common;

constructor(page: Page) {
this.page = page;
this.uiHelper = new UIhelper(page);
this.common = new Common(page);
}

async searchInOrg(searchText: string) {
Expand Down Expand Up @@ -58,4 +64,41 @@ export class BulkImport {
.locator(`input[name*="${label}"], textarea[name*="${label}"]`)
.fill(text);
}

/**
* Navigates to the Bulk import page, filters for the repo, and asserts
* that the row is visible with the expected status text. Retries the
* entire sequence to handle backend processing delays.
*
* @param options.refresh - when true, clicks the "Refresh" button on
* the row after filtering and before asserting (useful after merging
* a PR to force the backend to re-check the status).
*/
async filterAndVerifyAddedRepo(
repoName: string,
expectedCellTexts: (string | RegExp)[],
options?: { refresh?: boolean },
) {
await expect(async () => {
await this.uiHelper.openSidebar("Bulk import");
await this.common.waitForLoad();
await this.filterAddedRepo(repoName);
if (options?.refresh) {
await this.uiHelper.clickOnButtonInTableByUniqueText(
repoName,
"Refresh",
);
}
const row = this.page.locator(UI_HELPER_ELEMENTS.rowByText(repoName));
await row.waitFor({ timeout: 5_000 });
for (const cellText of expectedCellTexts) {
await expect(
row.locator("td").filter({ hasText: cellText }).first(),
).toBeVisible({ timeout: 5_000 });
}
}).toPass({
intervals: [2_000, 5_000, 10_000],
timeout: 60_000,
});
}
}
12 changes: 7 additions & 5 deletions e2e-tests/playwright/utils/ui-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,13 @@ export class UIhelper {
async goToSettingsPage() {
await expect(this.page.locator("nav[id='global-header']")).toBeVisible();
await this.openProfileDropdown();
await this.clickLink(
// TODO: RHDHBUGS-2552 - Strings not getting translated
// t["plugin.global-header"][lang]["profile.settings"],
"Settings",
);
// TODO: RHDHBUGS-2552 - Strings not getting translated
// The profile dropdown renders Settings as a menuitem, not an <a> link
const settingsItem = this.page.getByRole("menuitem", {
name: "Settings",
});
await expect(settingsItem).toBeVisible();
await settingsItem.click();
}

async goToSelfServicePage() {
Expand Down
Loading