-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathlogin.po.js
29 lines (24 loc) · 929 Bytes
/
login.po.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* This file uses the Page Object pattern to define the main page for tests
* https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ
*/
import {OauthButtons} from '../../components/oauth-buttons/oauth-buttons.po';
export class LoginPage {
constructor() {
this.form = element(by.css('.form'));
const form = this.form;
form.email = form.element(by.name('email'));
form.password = form.element(by.name('password'));
form.submit = form.element(by.css('.btn-login'));
form.oauthButtons = (new OauthButtons()).oauthButtons;
}
login(data) {
for(let prop in data) {
let formElem = this.form[prop];
if(data.hasOwnProperty(prop) && formElem && typeof formElem.sendKeys === 'function') {
formElem.sendKeys(data[prop]);
}
}
return this.form.submit.click();
}
}