2017-08-25 10:55:53 +00:00
|
|
|
import { LoginPageObject } from './login.po';
|
2020-08-13 15:24:49 +00:00
|
|
|
import { browser } from "protractor";
|
2017-08-25 10:55:53 +00:00
|
|
|
|
|
|
|
describe('Login Page', () => {
|
|
|
|
let page: LoginPageObject;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
page = new LoginPageObject();
|
2020-08-13 15:24:49 +00:00
|
|
|
page.navigateTo();
|
2017-08-25 10:55:53 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have a header saying login', () => {
|
|
|
|
expect(page.getLoginHeaderText()).toEqual('Login');
|
|
|
|
});
|
2017-08-25 11:17:15 +00:00
|
|
|
|
2017-11-13 15:49:17 +00:00
|
|
|
it('should have a username box of type email', () => {
|
2020-08-13 15:24:49 +00:00
|
|
|
expect(page.isEmailFieldPresent()).toBeTruthy();
|
|
|
|
expect(page.getEmailFieldType()).toEqual('email');
|
2017-08-25 11:17:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have a password box of type password', () => {
|
|
|
|
expect(page.isPasswordFieldPresent()).toBeTruthy();
|
|
|
|
expect(page.getPasswordFieldType()).toBe('password');
|
|
|
|
});
|
2020-08-13 15:24:49 +00:00
|
|
|
|
|
|
|
it('should have a login button of type submit', () => {
|
|
|
|
expect(page.isLoginButtonPresent()).toBeTruthy();
|
|
|
|
expect(page.getLoginButtonType()).toBe('submit');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have a disabled login button when empty', () => {
|
|
|
|
expect(page.isLoginButtonEnabled()).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have a disabled login button when only email', () => {
|
|
|
|
page.fillEmailFieldWith('test@example.com');
|
|
|
|
expect(page.isLoginButtonEnabled()).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have a disabled login button when only password', () => {
|
|
|
|
page.fillPasswordFieldWith('abc123');
|
|
|
|
expect(page.isLoginButtonEnabled()).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have an enabled login button when both inputs filled', () => {
|
|
|
|
page.fillEmailFieldWith('test@example.com');
|
|
|
|
page.fillPasswordFieldWith('abc123');
|
|
|
|
expect(page.isLoginButtonEnabled()).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should submit the filled data when login pressed', () => {
|
|
|
|
page.fillEmailFieldWith('test@example.com');
|
|
|
|
page.fillPasswordFieldWith('abc123');
|
|
|
|
expect(page.isLoginButtonEnabled()).toBeTruthy();
|
|
|
|
page.getLoginButton().click();
|
|
|
|
browser.waitForAngular();
|
|
|
|
expect(browser.getCurrentUrl()).toContain('dashboard');
|
|
|
|
});
|
2017-08-25 10:55:53 +00:00
|
|
|
});
|