|
1 | | -import {$, ElementFinder} from 'protractor'; |
| 1 | +import {$, by, element, ElementFinder, ProtractorBy} from 'protractor'; |
| 2 | +import {By} from '@angular/platform-browser'; |
| 3 | +import {default as data} from '../data'; |
2 | 4 |
|
3 | 5 | export class LoginPage { |
| 6 | + // matchers |
4 | 7 | public usernameInput: ElementFinder; |
5 | 8 | public passwordInput: ElementFinder; |
6 | 9 | public loginButton: ElementFinder; |
| 10 | + public loginPageMainText: ElementFinder; |
| 11 | + public loginPageSecondaryText: ElementFinder; |
| 12 | + // elements |
| 13 | + public loginPageMainTextMatcher: By; |
| 14 | + public loginPageSecondaryTextMatcher: By; |
| 15 | + public loginPageImageMatcher: By; |
| 16 | + |
| 17 | + // login method, used on Login Page |
| 18 | + public login(): void { |
| 19 | + this.usernameInput.clear(); |
| 20 | + this.passwordInput.clear(); |
| 21 | + this.usernameInput.sendKeys(data.login); |
| 22 | + this.passwordInput.sendKeys(data.password); |
| 23 | + this.loginButton.click(); |
| 24 | + } |
| 25 | + |
7 | 26 |
|
8 | 27 | constructor() { |
9 | 28 | this.usernameInput = $('#username'); |
10 | 29 | this.passwordInput = $('#password'); |
11 | 30 | this.loginButton = $('button.btn-success'); |
| 31 | + this.loginPageMainTextMatcher = by.css('#loginPageMainText'); |
| 32 | + this.loginPageSecondaryTextMatcher = by.css('#loginPageSecondaryText'); |
| 33 | + this.loginPageImageMatcher = by.css('#loginPageImage'); |
| 34 | + this.loginPageMainText = element(this.loginPageMainTextMatcher); |
| 35 | + this.loginPageSecondaryText = element(this.loginPageSecondaryTextMatcher); |
12 | 36 | } |
13 | 37 | } |
0 commit comments