TwoToc code
[YouAndWeb_TwoToc] / e2e / account / login / login.po.js
1 /**
2  * This file uses the Page Object pattern to define the main page for tests
3  * https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ
4  */
5
6 'use strict';
7
8 var LoginPage = function() {
9   this.form = element(by.css('.form'));
10   this.form.email = this.form.element(by.model('user.email'));
11   this.form.password = this.form.element(by.model('user.password'));
12   this.form.submit = this.form.element(by.css('.btn-login'));
13
14   this.login = function(data) {
15     for (var prop in data) {
16       var formElem = this.form[prop];
17       if (data.hasOwnProperty(prop) && formElem && typeof formElem.sendKeys === 'function') {
18         formElem.sendKeys(data[prop]);
19       }
20     }
21
22     this.form.submit.click();
23   };
24 };
25
26 module.exports = new LoginPage();
27