Skip to content

Commit

Permalink
handle e2e ns
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <[email protected]>
  • Loading branch information
crenshaw-dev committed Oct 1, 2024
1 parent 8721c05 commit b032183
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
5 changes: 4 additions & 1 deletion ui-test/src/.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
1 change: 1 addition & 0 deletions ui-test/src/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 : '';
Expand Down
21 changes: 8 additions & 13 deletions ui-test/src/applications-list/applications-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"]`
);
}
}

0 comments on commit b032183

Please sign in to comment.