github.com/argoproj/argo-cd/v3@v3.2.1/ui-test/src/auth/login-page.ts (about)

     1  import {By, WebDriver} from 'selenium-webdriver';
     2  import {Base} from '../base';
     3  import Configuration from '../Configuration';
     4  import UiTestUtilities from '../UiTestUtilities';
     5  
     6  const LOGIN_FORM: By = By.css('#app .login__box form');
     7  const LOGIN_FORM_INPUT: By = By.css('input.argo-field');
     8  const LOGIN_FORM_BUTTON: By = By.css('button.argo-button');
     9  
    10  export class AuthLoginPage extends Base {
    11      public constructor(driver: WebDriver) {
    12          super(driver);
    13      }
    14  
    15      /**
    16       * Fill login form and submit it
    17       */
    18      public async loginWithCredentials() {
    19          const loginForm = await UiTestUtilities.findUiElement(this.driver, LOGIN_FORM);
    20          const inputs = await loginForm.findElements(LOGIN_FORM_INPUT);
    21          const submitButton = await loginForm.findElement(LOGIN_FORM_BUTTON);
    22  
    23          await inputs[0].sendKeys(Configuration.ARGOCD_AUTH_USERNAME);
    24          await inputs[1].sendKeys(Configuration.ARGOCD_AUTH_PASSWORD);
    25  
    26          await submitButton.click();
    27      }
    28  }