initial codebase
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { browser } from 'protractor';
|
||||
import { AppPage } from './app.po';
|
||||
|
||||
describe('app', () => {
|
||||
let page: AppPage;
|
||||
|
||||
beforeEach(() => {
|
||||
page = new AppPage();
|
||||
});
|
||||
|
||||
it('should display login page and login into app', () => {
|
||||
page.navigateTo();
|
||||
expect(browser.getCurrentUrl()).toContain('/login');
|
||||
page.login();
|
||||
});
|
||||
|
||||
it('should display hello message', () => {
|
||||
page.navigateTo();
|
||||
expect(page.getParagraphText()).toEqual('Hello world !');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Use the Page Object pattern to define the page under test.
|
||||
* See docs/coding-guide/e2e-tests.md for more info.
|
||||
*/
|
||||
|
||||
import { browser, element, by } from 'protractor';
|
||||
|
||||
export class AppPage {
|
||||
usernameField = element(by.css('input[formControlName="username"]'));
|
||||
passwordField = element(by.css('input[formControlName="password"]'));
|
||||
loginButton = element(by.css('button[type="submit"]'));
|
||||
|
||||
constructor() {
|
||||
// Forces default language
|
||||
this.navigateTo();
|
||||
browser.executeScript(() => localStorage.setItem('language', 'en-US'));
|
||||
}
|
||||
|
||||
navigateTo() {
|
||||
return browser.get('/');
|
||||
}
|
||||
|
||||
login() {
|
||||
this.usernameField.sendKeys('test');
|
||||
this.passwordField.sendKeys('123');
|
||||
this.loginButton.click();
|
||||
}
|
||||
|
||||
getParagraphText() {
|
||||
return element(by.css('app-root h1')).getText();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user