mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
Signed-off-by: Keith Chong <kykchong@redhat.com>
This commit is contained in:
@@ -49,21 +49,20 @@ export default class UiTestUtilities {
|
||||
*/
|
||||
public static async init(): Promise<Navigation> {
|
||||
const options = new chrome.Options();
|
||||
if (process.env.IS_HEADLESS) {
|
||||
UiTestUtilities.log('Env var IS_HEADLESS = ' + process.env.IS_HEADLESS);
|
||||
if (process.env.IS_HEADLESS !== 'false') {
|
||||
UiTestUtilities.log('Adding headless option');
|
||||
options.addArguments('headless');
|
||||
}
|
||||
options.addArguments('window-size=1400x1200');
|
||||
const driver = await new Builder()
|
||||
.forBrowser('chrome')
|
||||
.setChromeOptions(options)
|
||||
.build();
|
||||
const driver = await new Builder().forBrowser('chrome').setChromeOptions(options).build();
|
||||
|
||||
UiTestUtilities.log('Environment variables are:');
|
||||
UiTestUtilities.log(require('dotenv').config({path: __dirname + '/../.env'}));
|
||||
|
||||
// Navigate to the ArgoCD URL
|
||||
await driver.get(Configuration.ARGOCD_URL);
|
||||
|
||||
UiTestUtilities.log('Navigate to Argo CD URL successful: driver.get');
|
||||
return new Navigation(driver);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ export class ApplicationCreatePanel extends Base {
|
||||
try {
|
||||
const appNameField = await UiTestUtilities.findUiElement(this.driver, CREATE_APPLICATION_FIELD_APP_NAME);
|
||||
await appNameField.sendKeys(appName);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
UiTestUtilities.log('Error caught while setting app name: ' + err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -40,7 +41,8 @@ export class ApplicationCreatePanel extends Base {
|
||||
try {
|
||||
const project = await UiTestUtilities.findUiElement(this.driver, CREATE_APPLICATION_FIELD_PROJECT);
|
||||
await project.sendKeys(projectName);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
UiTestUtilities.log('Error caught while setting project name: ' + err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -49,7 +51,8 @@ export class ApplicationCreatePanel extends Base {
|
||||
try {
|
||||
const reposUrl = await UiTestUtilities.findUiElement(this.driver, CREATE_APPLICATION_FIELD_REPOSITORY_URL);
|
||||
await reposUrl.sendKeys(sourceRepoUrl);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
UiTestUtilities.log('Error caught while setting source repo URL: ' + err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -58,7 +61,8 @@ export class ApplicationCreatePanel extends Base {
|
||||
try {
|
||||
const path = await UiTestUtilities.findUiElement(this.driver, CREATE_APPLICATION_FIELD_REPOSITORY_PATH);
|
||||
await path.sendKeys(sourceRepoPath);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
UiTestUtilities.log('Error caught while setting source repo path: ' + err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -78,7 +82,8 @@ export class ApplicationCreatePanel extends Base {
|
||||
if (destinationClusterFieldValue) {
|
||||
await this.setDestinationClusterUrl(destinationClusterFieldValue);
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
UiTestUtilities.log('Error caught while selecting destination cluster URL menu: ' + err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -98,7 +103,8 @@ export class ApplicationCreatePanel extends Base {
|
||||
if (destinationClusterFieldValue) {
|
||||
await this.setDestinationClusterName(destinationClusterFieldValue);
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
UiTestUtilities.log('Error caught while selecting destination cluster name menu: ' + err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -108,7 +114,8 @@ export class ApplicationCreatePanel extends Base {
|
||||
const clusterName = await UiTestUtilities.findUiElement(this.driver, CREATE_APPLICATION_FIELD_CLUSTER_NAME);
|
||||
await clusterName.sendKeys(destinationClusterName);
|
||||
// await clusterName.sendKeys('\r');
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
UiTestUtilities.log('Error caught while setting destination cluster name: ' + err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -117,7 +124,8 @@ export class ApplicationCreatePanel extends Base {
|
||||
try {
|
||||
const clusterUrl = await UiTestUtilities.findUiElement(this.driver, CREATE_APPLICATION_FIELD_CLUSTER_URL);
|
||||
await clusterUrl.sendKeys(destinationClusterUrl);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
UiTestUtilities.log('Error caught while setting destination cluster URL: ' + err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -126,7 +134,8 @@ export class ApplicationCreatePanel extends Base {
|
||||
try {
|
||||
const namespace = await UiTestUtilities.findUiElement(this.driver, CREATE_APPLICATION_FIELD_CLUSTER_NAMESPACE);
|
||||
await namespace.sendKeys(destinationNamespace);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
UiTestUtilities.log('Error caught while setting destination namespace: ' + err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -140,12 +149,13 @@ export class ApplicationCreatePanel extends Base {
|
||||
await createButton.click();
|
||||
|
||||
// Wait until the Create Application Sliding Panel disappears
|
||||
await this.driver.wait(until.elementIsNotVisible(createButton), Const.TEST_SLIDING_PANEL_TIMEOUT).catch(e => {
|
||||
await this.driver.wait(until.elementIsNotVisible(createButton), Const.TEST_SLIDING_PANEL_TIMEOUT).catch((e) => {
|
||||
UiTestUtilities.logError('The Create Application Sliding Panel did not disappear');
|
||||
throw e;
|
||||
});
|
||||
await this.driver.sleep(1000);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
UiTestUtilities.log('Error caught while clicking Create button: ' + err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -159,11 +169,12 @@ export class ApplicationCreatePanel extends Base {
|
||||
await cancelButton.click();
|
||||
|
||||
// Wait until the Create Application Sliding Panel disappears
|
||||
await this.driver.wait(until.elementIsNotVisible(cancelButton), Const.TEST_SLIDING_PANEL_TIMEOUT).catch(e => {
|
||||
await this.driver.wait(until.elementIsNotVisible(cancelButton), Const.TEST_SLIDING_PANEL_TIMEOUT).catch((e) => {
|
||||
UiTestUtilities.logError('The Create Application Sliding Panel did not disappear');
|
||||
throw e;
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
UiTestUtilities.log('Error caught while clicking Cancel button: ' + err);
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -198,7 +209,7 @@ export class ApplicationCreatePanel extends Base {
|
||||
await this.selectDestinationClusterNameMenu(destinationClusterName);
|
||||
await this.setDestinationNamespace(destinationNamespace);
|
||||
await this.clickCreateButton();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export class ApplicationsList extends Base {
|
||||
try {
|
||||
const tile = await UiTestUtilities.findUiElement(this.driver, this.getApplicationTileLocator(appName));
|
||||
await tile.click();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ export class ApplicationsList extends Base {
|
||||
try {
|
||||
const newAppButton = await UiTestUtilities.findUiElement(this.driver, NEW_APP_BUTTON);
|
||||
await newAppButton.click();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
return this.applicationCreatePanel;
|
||||
@@ -57,7 +57,7 @@ export class ApplicationsList extends Base {
|
||||
// Wait until the Synchronize sliding panel appears
|
||||
const synchronizeButton = await this.driver.wait(until.elementLocated(SYNC_PANEL_SYNCHRONIZE_BUTTON), Const.TEST_TIMEOUT);
|
||||
await this.driver.wait(until.elementIsVisible(synchronizeButton), Const.TEST_TIMEOUT);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
return this.applicationsSyncPanel;
|
||||
@@ -72,7 +72,7 @@ export class ApplicationsList extends Base {
|
||||
try {
|
||||
const deleteButton = await UiTestUtilities.findUiElement(this.driver, this.getDeleteButtonLocatorForApp(appName));
|
||||
await deleteButton.click();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
return this.popupManager;
|
||||
@@ -95,7 +95,7 @@ export class ApplicationsList extends Base {
|
||||
const refreshButton = await UiTestUtilities.findUiElement(this.driver, this.getRefreshButtonLocatorForApp(appName));
|
||||
await this.driver.wait(until.elementIsVisible(refreshButton), Const.TEST_TIMEOUT);
|
||||
await refreshButton.click();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ export class ApplicationsList extends Base {
|
||||
await this.driver.wait(async () => {
|
||||
return UiTestUtilities.untilAttributeIs(healthStatusElement, 'title', 'Healthy');
|
||||
}, Const.TEST_TIMEOUT);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ export class ApplicationsList extends Base {
|
||||
await this.driver.wait(async () => {
|
||||
return UiTestUtilities.untilAttributeIs(statusElement, 'title', 'Synced');
|
||||
}, Const.TEST_TIMEOUT);
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ export class ApplicationsSyncPanel extends Base {
|
||||
await this.driver.wait(until.elementIsEnabled(synchronizeButton), Const.TEST_TIMEOUT);
|
||||
await synchronizeButton.click();
|
||||
|
||||
await this.driver.wait(until.elementIsNotVisible(synchronizeButton), Const.TEST_SLIDING_PANEL_TIMEOUT).catch(e => {
|
||||
await this.driver.wait(until.elementIsNotVisible(synchronizeButton), Const.TEST_SLIDING_PANEL_TIMEOUT).catch((e) => {
|
||||
UiTestUtilities.logError('The Synchronization Sliding Panel did not disappear');
|
||||
throw e;
|
||||
});
|
||||
UiTestUtilities.log('Synchronize sliding panel disappeared');
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export class Navigation extends Base {
|
||||
try {
|
||||
const navBarButton = await UiTestUtilities.findUiElement(this.driver, NAVBAR_APPLICATIONS_BUTTON);
|
||||
await navBarButton.click();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
return this.applicationsList;
|
||||
@@ -45,7 +45,7 @@ export class Navigation extends Base {
|
||||
try {
|
||||
const navBarButton = await UiTestUtilities.findUiElement(this.driver, NAVBAR_SETTINGS_BUTTON);
|
||||
await navBarButton.click();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ export class Navigation extends Base {
|
||||
try {
|
||||
const navBarButton = await UiTestUtilities.findUiElement(this.driver, NAVBAR_USER_INFO_BUTTON);
|
||||
await navBarButton.click();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export class Navigation extends Base {
|
||||
try {
|
||||
const navBarButton = await UiTestUtilities.findUiElement(this.driver, NAVBAR_DOCS_BUTTON);
|
||||
await navBarButton.click();
|
||||
} catch (err) {
|
||||
} catch (err: any) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user