import { Util } from "../util" ; import { browser , by , element } from "protractor" ; export class LoginPage { header = element ( by . css ( '[data-automation-id="adf-layout-container"]' ) ) ; signInButton = element ( by . id ( 'login-button' ) ) ; txtUsername = element ( by . css ( 'input[id="username"]' ) ) ; txtPassword = element ( by . css ( 'input[id="password"]' ) ) ; enterUsername ( username ) { Util . waitUntilElementIsVisible ( this . txtUsername ) ; this . txtUsername . sendKeys ( '' ) ; this . txtUsername . clear ( ) ; return this . txtUsername . sendKeys ( username ) ; } enterPassword ( password ) { Util . waitUntilElementIsVisible ( this . txtPassword ) ; this . txtPassword . clear ( ) ; return this . txtPassword . sendKeys ( password ) ; } clickSignInButton ( ) { Util . waitUntilElementIsVisible ( this . signInButton ) ; return this . signInButton . click ( ) ; } async login ( username , password ) { browser . waitForAngularEnabled ( false ) ; this . enterUsername ( username ) ; this . enterPassword ( password ) ; this . clickSignInButton ( ) ; return Util . waitUntilElementIsVisible ( this . header ) ; } }