Skip to content

Commit e811c64

Browse files
committed
[RHTAP-5669] Implements checks for Nexus plugin
1 parent 2916af9 commit e811c64

File tree

7 files changed

+57
-21
lines changed

7 files changed

+57
-21
lines changed

src/ui/page-objects/registryPo.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ export const RegistryPO = {
1414
expiresColumnHeader: 'Expires',
1515
manifestColumnHeader: 'Manifest',
1616

17+
// Nexus repository headers
18+
versionColumnHeader: 'Version',
19+
artifactColumnHeader: 'Artifact',
20+
repositoryTypeColumnHeader: 'Repository Type',
21+
checksumColumnHeader: 'Checksum',
22+
modifiedColumnHeader: 'Modified',
23+
1724
// Vulnerabilities table headers
1825
advisoryColumnHeader: 'Advisory',
1926
severityColumnHeader: 'Severity',
@@ -27,5 +34,6 @@ export const RegistryPO = {
2734

2835
// Repository elements
2936
quayRepositoryPrefix: 'Quay repository:',
37+
nexusRepositoryPrefix: 'Nexus Repository Manager:',
3038
backToRepositoryLinkLabel: 'Back to repository'
3139
};

src/ui/plugins/registry/baseRegistryPlugin.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,6 @@ export abstract class BaseRegistryPlugin implements RegistryPlugin {
5151
expect(indexedRowsAfterClear.length).toBe(initialRowCount);
5252
}
5353

54-
async checkTableColumnHeaders(page: Page): Promise<void> {
55-
await expect(page.getByRole('columnheader', { name: RegistryPO.tagColumnHeader })).toBeVisible();
56-
await expect(page.getByRole('columnheader', { name: RegistryPO.lastModifiedColumnHeader })).toBeVisible();
57-
await expect(page.getByRole('columnheader', { name: RegistryPO.securityScanColumnHeader })).toBeVisible();
58-
await expect(page.getByRole('columnheader', { name: RegistryPO.sizeColumnHeader })).toBeVisible();
59-
await expect(page.getByRole('columnheader', { name: RegistryPO.expiresColumnHeader })).toBeVisible();
60-
await expect(page.getByRole('columnheader', { name: RegistryPO.manifestColumnHeader })).toBeVisible();
61-
}
62-
6354
async checkImageTableContent(page: Page): Promise<void> {
6455
const rows = await this.getTableRows(page);
6556
expect(rows.length).toBeGreaterThan(0);
@@ -71,5 +62,5 @@ export abstract class BaseRegistryPlugin implements RegistryPlugin {
7162
// eslint-disable-next-line no-unused-vars
7263
abstract checkRepositoryLink(page: Page): Promise<void>;
7364
// eslint-disable-next-line no-unused-vars
74-
abstract checkVulnerabilities(page: Page): Promise<void>;
65+
abstract checkTableColumnHeaders(page: Page): Promise<void>;
7566
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { expect, Page } from '@playwright/test';
2+
import { ImageRegistry } from '../../../rhtap/core/integration/registry/imageRegistry';
3+
import { BaseRegistryPlugin } from "./baseRegistryPlugin";
4+
import { RegistryPO } from "../../page-objects/registryPo";
5+
6+
export class NexusUiPlugin extends BaseRegistryPlugin {
7+
8+
constructor(registry: ImageRegistry) {
9+
super(registry);
10+
}
11+
12+
async checkRepositoryHeading(page: Page): Promise<void> {
13+
await expect(page.getByRole('heading', { name: `${RegistryPO.nexusRepositoryPrefix} ${this.registry.getOrganization()}/${this.registry.getImageName()}` })).toBeVisible();
14+
}
15+
16+
// eslint-disable-next-line no-unused-vars
17+
async checkRepositoryLink(_page: Page): Promise<void> {
18+
// Skipped: Nexus repository link is not supported yet
19+
}
20+
21+
async checkTableColumnHeaders(page: Page): Promise<void> {
22+
await expect(page.getByRole('columnheader', { name: RegistryPO.versionColumnHeader })).toBeVisible();
23+
await expect(page.getByRole('columnheader', { name: RegistryPO.artifactColumnHeader })).toBeVisible();
24+
await expect(page.getByRole('columnheader', { name: RegistryPO.repositoryTypeColumnHeader })).toBeVisible();
25+
await expect(page.getByRole('columnheader', { name: RegistryPO.checksumColumnHeader })).toBeVisible();
26+
await expect(page.getByRole('columnheader', { name: RegistryPO.modifiedColumnHeader })).toBeVisible();
27+
await expect(page.getByRole('columnheader', { name: RegistryPO.sizeColumnHeader })).toBeVisible();
28+
}
29+
}

src/ui/plugins/registry/quayUiPlugin.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,30 @@ import { BaseRegistryPlugin } from "./baseRegistryPlugin";
44
import { RegistryPO } from "../../page-objects/registryPo";
55

66
export class QuayUiPlugin extends BaseRegistryPlugin {
7-
private quayProvider: ImageRegistry;
87

98
constructor(registry: ImageRegistry) {
109
super(registry);
11-
this.quayProvider = registry;
1210
}
1311

1412
async checkRepositoryHeading(page: Page): Promise<void> {
15-
await expect(page.getByRole('heading', { name: `${RegistryPO.quayRepositoryPrefix} ${this.quayProvider.getOrganization()}/${this.quayProvider.getImageName()}` })).toBeVisible();
13+
await expect(page.getByRole('heading', { name: `${RegistryPO.quayRepositoryPrefix} ${this.registry.getOrganization()}/${this.registry.getImageName()}` })).toBeVisible();
1614
}
1715

1816
async checkRepositoryLink(page: Page): Promise<void> {
19-
const repositoryLink = `${this.quayProvider.getOrganization()}/${this.quayProvider.getImageName()}`;
17+
const repositoryLink = `${this.registry.getOrganization()}/${this.registry.getImageName()}`;
2018

2119
await expect(page.getByRole('link', { name: repositoryLink })).toBeVisible();
2220
}
2321

22+
async checkTableColumnHeaders(page: Page): Promise<void> {
23+
await expect(page.getByRole('columnheader', { name: RegistryPO.tagColumnHeader })).toBeVisible();
24+
await expect(page.getByRole('columnheader', { name: RegistryPO.lastModifiedColumnHeader })).toBeVisible();
25+
await expect(page.getByRole('columnheader', { name: RegistryPO.securityScanColumnHeader })).toBeVisible();
26+
await expect(page.getByRole('columnheader', { name: RegistryPO.sizeColumnHeader })).toBeVisible();
27+
await expect(page.getByRole('columnheader', { name: RegistryPO.expiresColumnHeader })).toBeVisible();
28+
await expect(page.getByRole('columnheader', { name: RegistryPO.manifestColumnHeader })).toBeVisible();
29+
}
30+
2431
async checkVulnerabilities(page: Page): Promise<void> {
2532
const searchInput = page.getByRole('textbox', { name: RegistryPO.searchPlaceholder });
2633
await searchInput.fill('build-container');
@@ -47,7 +54,7 @@ export class QuayUiPlugin extends BaseRegistryPlugin {
4754
await goBackButton.click();
4855

4956
// Check that the repository link is visible
50-
const repositoryLink = `${this.quayProvider.getOrganization()}/${this.quayProvider.getImageName()}`;
57+
const repositoryLink = `${this.registry.getOrganization()}/${this.registry.getImageName()}`;
5158
await expect(page.getByRole('link', { name: repositoryLink })).toBeVisible();
5259
}
5360
}

src/ui/plugins/registry/registryPlugin.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,4 @@ export interface RegistryPlugin {
3131
* @param page - The page object
3232
*/
3333
checkTableColumnHeaders(page: Page): Promise<void>;
34-
35-
/**
36-
* Checks vulnerabilities table content
37-
* @param page - The page object
38-
*/
39-
checkVulnerabilities(page: Page): Promise<void>;
4034
}

src/ui/plugins/registry/registryUiFactory.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import { ImageRegistry, ImageRegistryType } from '../../../rhtap/core/integration/registry/imageRegistry';
99
import { RegistryPlugin } from './registryPlugin';
1010
import { QuayUiPlugin } from './quayUiPlugin';
11+
import { NexusUiPlugin } from './nexusUiPlugin';
1112

1213
export class RegistryUiFactory {
1314
/**
@@ -25,6 +26,8 @@ export class RegistryUiFactory {
2526
switch (registryType) {
2627
case ImageRegistryType.QUAY:
2728
return new QuayUiPlugin(registry);
29+
case ImageRegistryType.NEXUS:
30+
return new NexusUiPlugin(registry);
2831
default:
2932
console.warn(`Unsupported Registry type: ${registryType}`);
3033
return undefined;

tests/ui/component.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ test.describe('Component UI Test Suite', () => {
145145
timeout: 20000,
146146
});
147147

148+
await test.step('Hide Quick start side panel', async () => {
149+
await hideQuickStartIfVisible(page);
150+
}, { timeout: 20000 });
151+
148152
await test.step('Check repository heading', async () => {
149153
await registryPlugin.checkRepositoryHeading(page);
150154
}, { timeout: 20000 });

0 commit comments

Comments
 (0)