-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathcatalog-timestamp.spec.ts
More file actions
97 lines (78 loc) · 3.34 KB
/
Copy pathcatalog-timestamp.spec.ts
File metadata and controls
97 lines (78 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import { Page, expect, test } from "@support/coverage/test";
import { getTranslations, getCurrentLanguage } from "../e2e/localization/locale";
import { CatalogImport } from "../support/pages/catalog-import";
import { Common, setupBrowser, teardownBrowser } from "../utils/common";
import { UIhelper } from "../utils/ui-helper";
const t = getTranslations();
const lang = getCurrentLanguage();
let page: Page;
test.describe("Test timestamp column on Catalog", () => {
test.skip(
() => (process.env.JOB_NAME ?? "").includes("osd-gcp"),
"skipping on OSD-GCP cluster due to RHDHBUGS-555",
);
let uiHelper: UIhelper;
let common: Common;
let catalogImport: CatalogImport;
const component =
"https://github.com/janus-qe/custom-catalog-entities/blob/main/timestamp-catalog-info.yaml";
test.beforeAll(async ({ browser }, testInfo) => {
test.info().annotations.push({
type: "component",
description: "core",
});
page = (await setupBrowser(browser, testInfo)).page;
common = new Common(page);
uiHelper = new UIhelper(page);
catalogImport = new CatalogImport(page);
await common.loginAsGuest();
});
test.beforeEach(async () => {
await uiHelper.openSidebar(t["rhdh"][lang]["menuItem.catalog"]);
await uiHelper.verifyHeading(
t["catalog"][lang]["indexPage.title"].replace("{{orgName}}", "My Org"),
);
await uiHelper.openCatalogSidebar("Component");
});
test("Import an existing Git repository and verify `Created At` column and value in the Catalog Page", async () => {
await uiHelper.goToSelfServicePage();
await uiHelper.clickButton(
t["scaffolder"][lang]["templateListPage.contentHeader.registerExistingButtonTitle"],
);
await catalogImport.registerExistingComponent(component);
await uiHelper.openCatalogSidebar("Component");
await uiHelper.searchInputPlaceholder("timestamp-test-created");
await uiHelper.verifyText("timestamp-test-created");
await uiHelper.verifyColumnHeading(["Created At"], true);
await uiHelper.verifyRowInTableByUniqueText("timestamp-test-created", [
/^\d{1,2}\/\d{1,2}\/\d{1,4}, \d:\d{1,2}:\d{1,2} (AM|PM)$/u,
]);
});
test("Toggle 'CREATED AT' to see if the component list can be sorted in ascending/decending order", async () => {
// Clear search filter from previous test to show all components
const clearButton = page.getByRole("button", { name: "clear search" });
if ((await clearButton.isVisible()) && (await clearButton.isEnabled())) {
await clearButton.click();
}
// Wait for the table to have data rows
await expect(page.getByRole("row").filter({ has: page.getByRole("cell") })).not.toHaveCount(0);
// Get the first data row's "Created At" cell using semantic selectors
const firstRow = page
.getByRole("row")
.filter({ has: page.getByRole("cell") })
.first();
const createdAtCell = firstRow.getByRole("cell").nth(7);
const column = page.getByRole("columnheader", {
name: "Created At",
exact: true,
});
// Click twice to sort descending — newest entries first
await column.click();
await column.click();
// After sorting descending, the first row should have a non-empty "Created At"
await expect(createdAtCell).not.toBeEmpty();
});
test.afterAll(async ({}, testInfo) => {
await teardownBrowser(page, testInfo);
});
});