2019-11-29 22:16:18 +01:00
|
|
|
const { addStep } = require('@wdio/allure-reporter').default;
|
|
|
|
const { expect } = require('chai');
|
|
|
|
|
|
|
|
const common = require('../../base/common');
|
|
|
|
const navigate = require('../../base/navigation');
|
|
|
|
const Login = require('../../components/login');
|
|
|
|
|
|
|
|
|
2019-11-29 22:51:45 +01:00
|
|
|
const testName = 'test';
|
|
|
|
describe('Login page in BestNotes', () => {
|
2019-11-29 22:16:18 +01:00
|
|
|
it('should be displayed', () => {
|
|
|
|
const login = new Login();
|
2019-11-29 22:51:45 +01:00
|
|
|
|
|
|
|
addStep('Redirect to Login Page');
|
2019-11-29 22:16:18 +01:00
|
|
|
navigate.toLoginPage();
|
2019-11-29 22:51:45 +01:00
|
|
|
|
|
|
|
addStep('Check if Login Form is displayed and URL ');
|
|
|
|
expect(browser.getUrl(), 'Post details URL should include post ID').to.equal(common.bestNotesLink + 'accounts/login/');
|
2019-11-29 22:16:18 +01:00
|
|
|
expect(login.isLoginFormDisplayed(), 'Login form should be displayed').to.be.true;
|
|
|
|
})
|
2019-11-29 22:51:45 +01:00
|
|
|
|
|
|
|
it('shouldnt logged user with incorrect credentials', () => {
|
|
|
|
const login = new Login();
|
|
|
|
|
|
|
|
addStep('Redirect to Login Page');
|
|
|
|
navigate.toLoginPage();
|
|
|
|
|
|
|
|
addStep('Check if Login Form is displayed');
|
|
|
|
expect(login.isLoginFormDisplayed(), 'Login form should be displayed').to.be.true;
|
|
|
|
|
|
|
|
addStep('Fill credentials and try to login');
|
|
|
|
login.fillCredentials(login.emailField, testName);
|
|
|
|
login.fillCredentials(login.passwordField, testName);
|
|
|
|
login.clickLoginButton();
|
|
|
|
|
|
|
|
addStep('Check if the error message is displayed');
|
|
|
|
expect(login.getErrorMessage(), 'Message about wrong credentials should be displayed').to.equal(common.errorLoginMessage);
|
|
|
|
})
|
2019-11-29 22:16:18 +01:00
|
|
|
});
|