-
Notifications
You must be signed in to change notification settings - Fork 738
CONSOLE-5417: Migrate dev-console Cypress tests to Playwright (batch 4) #16767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-bot
merged 13 commits into
openshift:main
from
shahsahil264:CONSOLE-5417
Jul 30, 2026
Merged
Changes from 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a64fe49
CONSOLE-5417: Migrate dev-console Cypress tests to Playwright (batch 4)
shahsahil264 b2124a2
fix: Add exact:true to Create button to avoid strict mode violation
shahsahil264 734f726
fix: Add privileged namespace label for quarkus image on OCP 5.0
shahsahil264 6f819f3
fix: Fix batch 4 vulnerability tests for OCP 5.0
shahsahil264 f99fbe2
Merge remote-tracking branch 'origin/main' into CONSOLE-5417
shahsahil264 6eab3f5
fix: Address batch 4 PR review feedback
shahsahil264 b89437e
fix: Remove dead hasCSVReady function and unnecessary JSDoc
shahsahil264 be13f30
fix: Restore vulnerability-po.ts and fix 404 detection in hasOperator…
shahsahil264 c682a5d
fix: Remove broad message-based 404 fallback in hasOperatorSubscription
shahsahil264 337c199
fix: Address rhamilto review comments on batch 4
shahsahil264 e7fcb1c
Merge branch 'openshift:main' into CONSOLE-5417
shahsahil264 d4bd220
Merge branch 'openshift:main' into CONSOLE-5417
shahsahil264 4943f2c
fix: Address batch 4 review comments — selectors, imports, severity f…
shahsahil264 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| import type { Locator } from '@playwright/test'; | ||
|
|
||
| import BasePage from '../base-page'; | ||
|
|
||
| export class VulnerabilityPage extends BasePage { | ||
| private readonly vulnerabilitiesTab = this.page.getByTestId( | ||
| 'horizontal-link-Vulnerabilities', | ||
| ); | ||
| private readonly detailsTab = this.page.getByTestId('horizontal-link-Details'); | ||
| private readonly yamlTab = this.page.getByTestId('horizontal-link-YAML'); | ||
| private readonly affectedPodsTab = this.page.getByTestId('horizontal-link-Affected Pods'); | ||
| private readonly vulnerabilityTable = this.page.locator( | ||
| '[aria-label="Image Manifest Vulnerabilities"]', | ||
| ); | ||
| private readonly filterMenuToggle = this.page.getByTestId('console-select-menu-toggle'); | ||
| private readonly vulnPopup = this.page.getByTestId('vul popup'); | ||
| private readonly vulnAlertLink = this.page.getByTestId('Image Vulnerabilities'); | ||
| private readonly viewAllLink = this.page.getByTestId('view-all'); | ||
| private readonly vulnerabilityTypeSection = this.page.getByRole('group', { | ||
| name: 'Vulnerability type', | ||
| }); | ||
|
|
||
| async navigateToProjectOverview(namespace: string): Promise<void> { | ||
| await this.goTo(`/project-details/ns/${namespace}`); | ||
| } | ||
|
|
||
| getVulnerabilitiesTab(): Locator { | ||
| return this.vulnerabilitiesTab; | ||
| } | ||
|
|
||
| getDetailsTab(): Locator { | ||
| return this.detailsTab; | ||
| } | ||
|
|
||
| getYamlTab(): Locator { | ||
| return this.yamlTab; | ||
| } | ||
|
|
||
| getAffectedPodsTab(): Locator { | ||
| return this.affectedPodsTab; | ||
| } | ||
|
|
||
| async clickVulnerabilitiesTab(): Promise<void> { | ||
| await this.robustClick(this.vulnerabilitiesTab); | ||
| } | ||
|
|
||
| getVulnerabilityTable(): Locator { | ||
| return this.vulnerabilityTable; | ||
| } | ||
|
|
||
| getFilterMenuToggle(): Locator { | ||
| return this.filterMenuToggle; | ||
| } | ||
|
|
||
| async clickFilterMenuToggle(): Promise<void> { | ||
| await this.robustClick(this.filterMenuToggle); | ||
| } | ||
|
|
||
| getVulnPopup(): Locator { | ||
| return this.vulnPopup; | ||
| } | ||
|
|
||
| getVulnAlertLink(): Locator { | ||
| return this.vulnAlertLink; | ||
| } | ||
|
|
||
| async clickVulnAlert(): Promise<void> { | ||
| await this.robustClick(this.vulnAlertLink); | ||
| } | ||
|
|
||
| async clickViewAll(): Promise<void> { | ||
| await this.robustClick(this.viewAllLink); | ||
| } | ||
|
|
||
| getVulnLink(index: number): Locator { | ||
| return this.page.getByTestId(`vuln-${index}`); | ||
| } | ||
|
|
||
| async clickVulnLink(index: number): Promise<void> { | ||
| await this.robustClick(this.getVulnLink(index)); | ||
| } | ||
|
|
||
| getVulnImageLink(imageName: string): Locator { | ||
| return this.page.getByRole('link', { name: imageName }); | ||
| } | ||
|
|
||
| async clickVulnImageLink(imageName: string): Promise<void> { | ||
| await this.robustClick(this.getVulnImageLink(imageName)); | ||
| } | ||
|
|
||
| getVulnerabilityTypeSection(): Locator { | ||
| return this.vulnerabilityTypeSection; | ||
| } | ||
|
|
||
| getVulnerabilityTypeButton(typeName: string): Locator { | ||
| return this.page.getByRole('button', { name: typeName, exact: true }); | ||
| } | ||
|
|
||
| async clickVulnerabilityType(typeName: string): Promise<void> { | ||
| await this.robustClick(this.getVulnerabilityTypeButton(typeName)); | ||
| } | ||
|
|
||
| getSectionHeading(text: string): Locator { | ||
| return this.page.locator(`[data-test-section-heading="${text}"]`); | ||
|
shahsahil264 marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| async selectFilterOption(optionId: string): Promise<void> { | ||
| const option = this.page.getByTestId('console-select-item').filter({ hasText: optionId }); | ||
| await this.robustClick(option); | ||
| } | ||
| } | ||
47 changes: 47 additions & 0 deletions
47
frontend/e2e/tests/dev-console/fixtures/create-quarkus-deployment.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| apiVersion: apps/v1 | ||
|
shahsahil264 marked this conversation as resolved.
Outdated
|
||
| kind: Deployment | ||
| metadata: | ||
| name: test-vulnerability | ||
|
shahsahil264 marked this conversation as resolved.
Outdated
|
||
| namespace: aut-image-vulnerability | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| app: quarkus | ||
| replicas: 1 | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: quarkus | ||
| spec: | ||
| automountServiceAccountToken: false | ||
| containers: | ||
| - name: quarkus | ||
| image: >- | ||
| quay.io/redhat-appstudio-qe/quarkus:7dd062e2e8cb4ba599185e48d628b65a | ||
| command: ["sleep", "infinity"] | ||
| ports: | ||
| - containerPort: 8080 | ||
| resources: | ||
| requests: | ||
| cpu: 10m | ||
| memory: 32Mi | ||
| limits: | ||
| cpu: 100m | ||
| memory: 128Mi | ||
| livenessProbe: | ||
| exec: | ||
| command: ["true"] | ||
| periodSeconds: 30 | ||
| readinessProbe: | ||
| exec: | ||
| command: ["true"] | ||
| periodSeconds: 10 | ||
| securityContext: | ||
| allowPrivilegeEscalation: false | ||
| readOnlyRootFilesystem: true | ||
| runAsNonRoot: true | ||
| seccompProfile: | ||
| type: RuntimeDefault | ||
| capabilities: | ||
| drop: | ||
| - ALL | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import KubernetesClient from '../../../clients/kubernetes-client'; | ||
|
shahsahil264 marked this conversation as resolved.
Outdated
|
||
|
|
||
| const SUBSCRIPTION_GROUP = 'operators.coreos.com'; | ||
| const SUBSCRIPTION_VERSION = 'v1alpha1'; | ||
| const SUBSCRIPTION_PLURAL = 'subscriptions'; | ||
|
|
||
| /** | ||
| * Check whether an OLM operator subscription exists in the cluster. | ||
| * Searches the given namespace (defaults to openshift-operators) for a | ||
| * Subscription whose metadata.name matches `subscriptionName`. | ||
| */ | ||
| export async function hasOperatorSubscription( | ||
| k8sClient: KubernetesClient, | ||
| subscriptionName: string, | ||
| namespace = 'openshift-operators', | ||
| ): Promise<boolean> { | ||
| try { | ||
| await k8sClient.getCustomResource( | ||
| SUBSCRIPTION_GROUP, | ||
| SUBSCRIPTION_VERSION, | ||
| namespace, | ||
| SUBSCRIPTION_PLURAL, | ||
| subscriptionName, | ||
| ); | ||
| return true; | ||
| } catch (err) { | ||
| const code = (err as any).statusCode ?? (err as any).response?.statusCode; | ||
| if (code === 404) { | ||
| return false; | ||
| } | ||
| throw err; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Check whether a ClusterServiceVersion whose name starts with | ||
| * `csvPrefix` exists in the given namespace and has phase "Succeeded". | ||
| */ | ||
| export async function hasCSVReady( | ||
| k8sClient: KubernetesClient, | ||
| csvPrefix: string, | ||
| namespace = 'openshift-operators', | ||
| ): Promise<boolean> { | ||
| try { | ||
| const csvs = await k8sClient.listCustomResources( | ||
| SUBSCRIPTION_GROUP, | ||
| SUBSCRIPTION_VERSION, | ||
| namespace, | ||
| 'clusterserviceversions', | ||
| ); | ||
| return csvs.some( | ||
| (csv) => | ||
| (csv as any).metadata?.name?.startsWith(csvPrefix) && | ||
| (csv as any).status?.phase === 'Succeeded', | ||
| ); | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.