Skip to content

Commit

Permalink
login, to be polite
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
crenshaw-dev committed Oct 1, 2024
1 parent 335d83f commit 0bb49b7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 26 deletions.
25 changes: 0 additions & 25 deletions ui-test/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion ui-test/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This directory contains e2e-style UI tests.

To run the tests, first make sure you have an Argo CD instance available on http://localhost:4000. You can do this by
running `make start` or `make start-local` in the root of the Argo CD repository.
running `make start-e2e` or `make start-e2e-local` in the root of the Argo CD repository.

Then, run `yarn install` to install the necessary dependencies, and `yarn test` to run the tests.

Expand Down
17 changes: 17 additions & 0 deletions ui-test/src/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const NAVBAR_SETTINGS_BUTTON: By = By.css('#app .sidebar .argo-icon-settings');
const NAVBAR_USER_INFO_BUTTON: By = By.css('#app .sidebar .fa-user-circle');
const NAVBAR_DOCS_BUTTON: By = By.css('#app .sidebar .argo-icon-docs');

const LOGIN_USERNAME_INPUT: By = By.css('.login input');
const LOGIN_PASSWORD_INPUT: By = By.css('.login input[type="password"]');

export class Navigation extends Base {
private applicationsList: ApplicationsList;

Expand All @@ -16,6 +19,20 @@ export class Navigation extends Base {
this.applicationsList = new ApplicationsList(this.driver);
}

public async login(username: string, password: string): Promise<void> {
try {
const usernameInput = await UiTestUtilities.findUiElement(this.driver, LOGIN_USERNAME_INPUT);
await usernameInput.sendKeys(username);

const passwordInput = await UiTestUtilities.findUiElement(this.driver, LOGIN_PASSWORD_INPUT);
await passwordInput.sendKeys(password);

await passwordInput.submit();
} catch (err) {
throw new Error("Error logging in: " + err);
}
}

/**
* Click the Applications Nav Bar Button
* Return: reference to ApplicationsList page
Expand Down
2 changes: 2 additions & 0 deletions ui-test/src/test001.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {PopupManager} from './popup/popup-manager';
async function doTest() {
const navigation = await UiTestUtilities.init();
try {
await UiTestUtilities.log('About to login');
await navigation.login('admin', 'password');
const appsList: ApplicationsList = await navigation.clickApplicationsNavBarButton();

await UiTestUtilities.log('Clicked nav bar button');
Expand Down

0 comments on commit 0bb49b7

Please sign in to comment.