From b032183bb54d718844365fd2d75c21da5bd615e8 Mon Sep 17 00:00:00 2001 From: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:02:43 -0400 Subject: [PATCH] handle e2e ns Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --- ui-test/src/.env | 5 ++++- ui-test/src/Configuration.ts | 1 + .../applications-list/applications-list.ts | 21 +++++++------------ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ui-test/src/.env b/ui-test/src/.env index 119f763c7773e..47da05f7e5549 100644 --- a/ui-test/src/.env +++ b/ui-test/src/.env @@ -15,12 +15,15 @@ IS_HEADLESS=true # ENABLE_CONSOLE_LOG=true # ############################ -# ArgoCD specific variables +# Argo CD specific variables ############################ # # URL of the ArgoCD UI to test against ARGOCD_SERVER=http://localhost:4000 # +# Namespace in which Argo CD is running +ARGOCD_INSTANCE_NAMESPACE=argocd-e2e +# # Git repository where applications reside GIT_REPO=https://github.com/argoproj/argocd-example-apps # diff --git a/ui-test/src/Configuration.ts b/ui-test/src/Configuration.ts index ca2e8ccfb7571..cbc802872c057 100644 --- a/ui-test/src/Configuration.ts +++ b/ui-test/src/Configuration.ts @@ -6,6 +6,7 @@ export default class Configuration { public static readonly TEST_TIMEOUT: string | undefined = process.env.TEST_TIMEOUT; // ArgoCD UI specific. These are for single application-based tests, so one can quickly create an app based on the environment variables public static readonly ARGOCD_SERVER: string = process.env.ARGOCD_SERVER ? process.env.ARGOCD_SERVER : ''; + public static readonly ARGOCD_INSTANCE_NAMESPACE: string = process.env.ARGOCD_INSTANCE_NAMESPACE ? process.env.ARGOCD_INSTANCE_NAMESPACE : ''; public static readonly APP_NAME: string = process.env.APP_NAME ? process.env.APP_NAME : ''; public static readonly APP_PROJECT: string = process.env.APP_PROJECT ? process.env.APP_PROJECT : ''; public static readonly GIT_REPO: string = process.env.GIT_REPO ? process.env.GIT_REPO : ''; diff --git a/ui-test/src/applications-list/applications-list.ts b/ui-test/src/applications-list/applications-list.ts index 6139aeeca7926..638dd2fcbc0b3 100644 --- a/ui-test/src/applications-list/applications-list.ts +++ b/ui-test/src/applications-list/applications-list.ts @@ -5,6 +5,7 @@ import {Base} from '../base'; import {ApplicationCreatePanel} from '../application-create-panel/application-create-panel'; import {ApplicationsSyncPanel, SYNC_PANEL_SYNCHRONIZE_BUTTON} from '../applications-sync-panel/applications-sync-panel'; import {PopupManager} from '../popup/popup-manager'; +import Configuration from "../Configuration"; const NEW_APP_BUTTON: By = By.css('button[qe-id="applications-list-button-new-app"]'); // Uncomment to use: @@ -158,42 +159,36 @@ export class ApplicationsList extends Base { // By.css('#app .applications-tiles .applications-list-" + appName + "''); private getApplicationTileLocator(appName: string): By { - return By.xpath('.//div[contains(@class,"qe-applications-list-argocd_"' + appName + ')'); + return By.xpath(`.//div[contains(@class,"qe-applications-list-${Configuration.ARGOCD_INSTANCE_NAMESPACE}_${appName})`); } private getSyncButtonLocatorForApp(appName: string): By { - return By.css('div.qe-applications-list-argocd_' + appName + ' div.row a[qe-id="applications-tiles-button-sync"]'); + return By.css(`div.qe-applications-list-${Configuration.ARGOCD_INSTANCE_NAMESPACE}_${appName} div.row a[qe-id="applications-tiles-button-sync"]`); } private getDeleteButtonLocatorForApp(appName: string): By { - return By.css('div.qe-applications-list-argocd_' + appName + ' div.row a[qe-id="applications-tiles-button-delete"]'); + return By.css(`div.qe-applications-list-${Configuration.ARGOCD_INSTANCE_NAMESPACE}_${appName} div.row a[qe-id="applications-tiles-button-delete"]`); } private getRefreshButtonLocatorForApp(appName: string): By { - return By.xpath('.//div[contains(@class, "qe-applications-list-argocd_' + appName + '")]//div[@class="row"]//ancestor::a[@qe-id="applications-tiles-button-refresh"]'); + return By.xpath(`.//div[contains(@class, "qe-applications-list-${Configuration.ARGOCD_INSTANCE_NAMESPACE}_${appName}")]//div[@class="row"]//ancestor::a[@qe-id="applications-tiles-button-refresh"]`); } private getApplicationHealthTitle(appName: string): By { return By.xpath( - './/div[contains(@class, "qe-applications-list-argocd_' + - appName + - '")]//div[@class="row"]//div[@qe-id="applications-tiles-health-status"]//i[@qe-id="utils-health-status-title"]' + `.//div[contains(@class, "qe-applications-list-${Configuration.ARGOCD_INSTANCE_NAMESPACE}_${appName}")]//div[@class="row"]//div[@qe-id="applications-tiles-health-status"]//i[@qe-id="utils-health-status-title"]` ); } private getApplicationSyncTitle(appName: string): By { return By.xpath( - './/div[contains(@class, "qe-applications-list-argocd_' + - appName + - '")]//div[@class="row"]//div[@qe-id="applications-tiles-health-status"]//i[@qe-id="utils-sync-status-title"]' + `.//div[contains(@class, "qe-applications-list-${Configuration.ARGOCD_INSTANCE_NAMESPACE}_${appName}")]//div[@class="row"]//div[@qe-id="applications-tiles-health-status"]//i[@qe-id="utils-sync-status-title"]` ); } private getApplicationOperationsTitle(appName: string): By { return By.xpath( - './/div[contains(@class, "qe-applications-list-argocd_' + - appName + - '")]//div[@class="row"]//div[@qe-id="applications-tiles-health-status"]//i[@qe-id="utils-operations-status-title"]' + `.//div[contains(@class, "qe-applications-list-${Configuration.ARGOCD_INSTANCE_NAMESPACE}_${appName}")]//div[@class="row"]//div[@qe-id="applications-tiles-health-status"]//i[@qe-id="utils-operations-status-title"]` ); } }