all repos — caroster @ 39940cb45380ee7a700aefd283c7b59b3ef6990d

[Octree] Group carpool to your event https://caroster.io

e2e/test/pages/login.js (view raw)

 1'use strict'
 2
 3/* global browser, $ */
 4/* eslint-disable class-methods-use-this */
 5
 6class Login {
 7  get email() {
 8    return $('#email')
 9  }
10  get password() {
11    return $('#password')
12  }
13  get submit() {
14    return $('#submit')
15  }
16  get recipient() {
17    return $('#recipient')
18  }
19  /**
20   * Opens the login form.
21   *
22   * @param {number} [timeout] Wait timeout
23   * @returns {Login} Login object
24   */
25  async open(timeout = 1200) {
26    await browser.url('/login.html')
27    await browser.saveAndDiffScreenshot('Login-test')
28    const password = await $('#password')
29    await password.waitForExist({ timeout })
30    return this
31  }
32  /**
33   * Authenticates user.
34   *
35   * @param {string} email User email
36   * @param {string} password User password
37   * @param {number} [timeout] Wait timeout
38   * @returns {Login} Login object
39   */
40  async authenticate(email, password, timeout) {
41    const emailField = await this.email
42    emailField.setValue(email)
43    const passwordField = await this.password
44    passwordField.setValue(password)
45    const submitButton = await this.submit
46    await submitButton.click()
47    const recipient = await this.recipient
48    await recipient.waitForExist({ timeout })
49    return this
50  }
51}
52
53module.exports = new Login()