Skip to content

Commit 0247a82

Browse files
chore(e2e): add e2e remove verified badge marketplace (#3494)
* Update all marketplace plugin support fields to object structure Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com> * updating plugins.yaml using sheet Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com> * E2E: Remove Verified Badge and Introduce Transparent Plugin Support Indicators --------- Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com> Co-authored-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
1 parent 285cd8f commit 0247a82

File tree

2 files changed

+254
-10
lines changed

2 files changed

+254
-10
lines changed

e2e-tests/playwright/e2e/extensions.spec.ts

Lines changed: 136 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@ test.describe("Admin > Extensions > Catalog", () => {
99
let uiHelper: UIhelper;
1010
const isMac = process.platform === "darwin";
1111

12+
const commonHeadings = [
13+
"Versions",
14+
"Author",
15+
"Tags",
16+
"Category",
17+
"Publisher",
18+
"Support Provider",
19+
];
20+
const supportTypeOptions = [
21+
"Generally available",
22+
"Certified",
23+
"Custom plugin",
24+
"Tech preview",
25+
"Dev preview",
26+
"Community plugin",
27+
];
28+
1229
test.beforeAll(async () => {
1330
test.info().annotations.push({
1431
type: "component",
@@ -31,7 +48,9 @@ test.describe("Admin > Extensions > Catalog", () => {
3148
await page.getByRole("button", { name: "Clear Search" }).click();
3249
});
3350

34-
test("Verify filters in extensions", async ({ page }, testInfo) => {
51+
test("Verify category and author filters in extensions", async ({
52+
page,
53+
}, testInfo) => {
3554
await uiHelper.verifyHeading(/Plugins \(\d+\)/);
3655

3756
await runAccessibilityTests(page, testInfo);
@@ -69,6 +88,19 @@ test.describe("Admin > Extensions > Catalog", () => {
6988
await page.keyboard.press(`Escape`);
7089
});
7190

91+
test("Verify support type filters in extensions", async ({ page }) => {
92+
await extensions.selectDropdown("Support type");
93+
await expect(page.getByRole("listbox")).toBeVisible();
94+
95+
// Verify all support type options are present
96+
for (const option of supportTypeOptions) {
97+
await expect(page.getByRole("listbox")).toContainText(option);
98+
}
99+
100+
await page.keyboard.press("Escape");
101+
await expect(page.getByLabel("Category").getByRole("combobox")).toBeEmpty();
102+
});
103+
72104
test("Verify certified badge in extensions", async ({ page }) => {
73105
await extensions.selectDropdown("Support type");
74106
await extensions.toggleOption("Certified");
@@ -97,20 +129,115 @@ test.describe("Admin > Extensions > Catalog", () => {
97129
await page.getByRole("button", { name: "close" }).click();
98130
await extensions.selectDropdown("Support type");
99131
await extensions.toggleOption("Certified");
100-
// Below code will be handled as part of the task https://issues.redhat.com/browse/RHIDP-8593
101-
// await extensions.toggleOption("Custom plugin");
102-
// await page.keyboard.press(`Escape`);
103-
// await expect(page.getByLabel("Verified by Red Hat").first()).toBeVisible();
104-
// await expect(extensions.badge.first()).toBeVisible();
105-
// await extensions.badge.first().hover();
106-
// await uiHelper.verifyTextInTooltip("Verified by Red Hat");
132+
});
133+
134+
test("Verify Generally available badge in extensions", async ({ page }) => {
135+
await extensions.selectSupportTypeFilter("Generally available (GA)");
136+
137+
await expect(
138+
page
139+
.getByLabel("Generally available (GA) and supported by Red Hat")
140+
.first(),
141+
).toBeVisible();
142+
await expect(extensions.badge.first()).toBeVisible();
143+
await extensions.badge.first().hover();
144+
await uiHelper.verifyTextInTooltip(
145+
"Generally available (GA) and supported by Red Hat",
146+
);
147+
148+
await uiHelper.clickLink("Read more");
149+
await expect(
150+
page
151+
.getByLabel("Production-ready and supported by Red Hat")
152+
.getByText("Generally available (GA)"),
153+
).toBeVisible();
154+
155+
for (const heading of commonHeadings) {
156+
console.log(`Verifying heading: ${heading}`);
157+
await uiHelper.verifyHeading(heading);
158+
}
159+
160+
await page.getByRole("button", { name: "close" }).click();
161+
162+
await extensions.resetSupportTypeFilter("Generally available (GA)");
163+
});
164+
165+
// Skipping below test due to the issue: https://issues.redhat.com/browse/RHDHBUGS-2104
166+
test.skip("Verify custom plugin badge in extensions", async ({ page }) => {
167+
await extensions.selectDropdown("Support type");
168+
await extensions.toggleOption("Custom plugin");
169+
await page.keyboard.press(`Escape`);
170+
await expect(page.getByLabel("Custom plugins").first()).toBeVisible();
171+
await expect(extensions.badge.first()).toBeVisible();
172+
await extensions.badge.first().hover();
173+
await uiHelper.verifyTextInTooltip("Custom plugins");
174+
await uiHelper.clickLink("Read more");
175+
await expect(
176+
page.getByLabel("Plugins added by the administrator").getByText("Custom"),
177+
).toBeVisible();
178+
await page.getByRole("button", { name: "close" }).click();
179+
await extensions.selectDropdown("Support type");
180+
await extensions.toggleOption("Custom plugin");
181+
await page.keyboard.press(`Escape`);
182+
});
183+
184+
test("Verify tech preview badge in extensions", async () => {
185+
await extensions.verifySupportTypeBadge({
186+
supportType: "Tech preview (TP)",
187+
pluginName: "Bulk Import",
188+
badgeLabel: "Plugin still in development",
189+
badgeText: "Tech preview (TP)",
190+
tooltipText: "",
191+
searchTerm: "Bulk Import",
192+
headings: ["About", "Versions", ...commonHeadings],
193+
includeTable: true,
194+
includeAbout: false,
195+
});
196+
});
197+
198+
test("Verify dev preview badge in extensions", async () => {
199+
await extensions.selectSupportTypeFilter("Dev preview (DP)");
200+
await uiHelper.verifyHeading("Developer Lightspeed");
201+
202+
await extensions.verifyPluginDetails({
203+
pluginName: "Developer Lightspeed",
204+
badgeLabel: "An early-stage, experimental",
205+
badgeText: "Dev preview (DP)",
206+
headings: commonHeadings,
207+
includeTable: true,
208+
includeAbout: false,
209+
});
210+
211+
await extensions.resetSupportTypeFilter("Dev preview (DP)");
212+
});
213+
214+
test("Verify community plugin badge in extensions", async ({ page }) => {
215+
await extensions.selectSupportTypeFilter("Community plugin");
216+
217+
await uiHelper.clickLink("Read more");
218+
await expect(
219+
page
220+
.getByLabel("Open-source plugins, no official support")
221+
.getByText("Community plugin"),
222+
).toBeVisible();
223+
224+
await uiHelper.verifyText("About");
225+
for (const heading of commonHeadings) {
226+
console.log(`Verifying heading: ${heading}`);
227+
await uiHelper.verifyHeading(heading);
228+
}
229+
230+
await expect(page.getByText("AuthorRed Hat")).toBeVisible();
231+
232+
await page.getByRole("button", { name: "close" }).click();
233+
await extensions.resetSupportTypeFilter("Community plugin");
107234
});
108235

109236
test.use({
110237
permissions: ["clipboard-read", "clipboard-write"],
111238
});
112239

113-
test("Verify plugin configuration can be viewed in the production environment", async ({
240+
test.skip("Verify plugin configuration can be viewed in the production environment", async ({
114241
page,
115242
}) => {
116243
const productionEnvAlert = page

e2e-tests/playwright/support/pages/extensions.ts

Lines changed: 118 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
1-
import { Page, Locator } from "@playwright/test";
1+
import { Page, expect, Locator } from "@playwright/test";
2+
import { UIhelper } from "../../utils/ui-helper";
23

34
export class Extensions {
45
private page: Page;
56
public badge: Locator;
7+
private uiHelper: UIhelper;
8+
9+
private commonHeadings = [
10+
"Versions",
11+
"Author",
12+
"Tags",
13+
"Category",
14+
"Publisher",
15+
"Support Provider",
16+
];
17+
private tableHeaders = [
18+
"Package name",
19+
"Version",
20+
"Role",
21+
"Backstage compatibility version",
22+
"Status",
23+
];
624

725
constructor(page: Page) {
826
this.page = page;
927
this.badge = this.page.getByTestId("TaskAltIcon");
28+
this.uiHelper = new UIhelper(page);
1029
}
1130

1231
async selectDropdown(name: string) {
@@ -26,4 +45,102 @@ export class Extensions {
2645
async clickAway() {
2746
await this.page.locator("#menu- div").first().click();
2847
}
48+
49+
async selectSupportTypeFilter(supportType: string) {
50+
await this.selectDropdown("Support type");
51+
await this.toggleOption(supportType);
52+
await this.page.keyboard.press("Escape");
53+
}
54+
55+
async resetSupportTypeFilter(supportType: string) {
56+
await this.selectDropdown("Support type");
57+
await this.toggleOption(supportType);
58+
await this.page.keyboard.press("Escape");
59+
}
60+
61+
async verifyMultipleHeadings(headings: string[] = this.commonHeadings) {
62+
for (const heading of headings) {
63+
console.log(`Verifying heading: ${heading}`);
64+
await this.uiHelper.verifyHeading(heading);
65+
}
66+
}
67+
68+
async verifyPluginDetails({
69+
pluginName,
70+
badgeLabel,
71+
badgeText,
72+
headings = this.commonHeadings,
73+
includeTable = true,
74+
includeAbout = false,
75+
}: {
76+
pluginName: string;
77+
badgeLabel: string;
78+
badgeText: string;
79+
headings?: string[];
80+
includeTable?: boolean;
81+
includeAbout?: boolean;
82+
}) {
83+
await this.page.getByRole("heading", { name: pluginName }).first().click();
84+
await expect(
85+
this.page.getByLabel(badgeLabel).getByText(badgeText),
86+
).toBeVisible();
87+
88+
if (includeAbout) {
89+
await this.uiHelper.verifyText("About");
90+
}
91+
92+
await this.verifyMultipleHeadings(headings);
93+
94+
if (includeTable) {
95+
await this.uiHelper.verifyTableHeadingAndRows(this.tableHeaders);
96+
}
97+
98+
await this.page.getByRole("button", { name: "close" }).click();
99+
}
100+
101+
async verifySupportTypeBadge({
102+
supportType,
103+
pluginName,
104+
badgeLabel,
105+
badgeText,
106+
tooltipText,
107+
searchTerm,
108+
headings = this.commonHeadings,
109+
includeTable = true,
110+
includeAbout = false,
111+
}: {
112+
supportType: string;
113+
pluginName?: string;
114+
badgeLabel: string;
115+
badgeText: string;
116+
tooltipText: string;
117+
searchTerm?: string;
118+
headings?: string[];
119+
includeTable?: boolean;
120+
includeAbout?: boolean;
121+
}) {
122+
await this.selectSupportTypeFilter(supportType);
123+
124+
if (searchTerm) {
125+
await this.uiHelper.searchInputPlaceholder(searchTerm);
126+
}
127+
128+
if (pluginName) {
129+
await this.verifyPluginDetails({
130+
pluginName,
131+
badgeLabel,
132+
badgeText,
133+
headings,
134+
includeTable,
135+
includeAbout,
136+
});
137+
} else {
138+
await expect(this.page.getByLabel(badgeLabel).first()).toBeVisible();
139+
await expect(this.badge.first()).toBeVisible();
140+
await this.badge.first().hover();
141+
await this.uiHelper.verifyTextInTooltip(tooltipText);
142+
}
143+
144+
await this.resetSupportTypeFilter(supportType);
145+
}
29146
}

0 commit comments

Comments
 (0)