BES-26 | adding new test
This commit is contained in:
parent
e43b6d9709
commit
4a63d7df46
@ -3,6 +3,7 @@ exports.config = {
|
||||
path: '/',
|
||||
suites: {
|
||||
login: ['./test/specs/suites/desktop/loginpage.test.js'],
|
||||
subject: ['./test/specs/suites/desktop/subjectpage.test.js'],
|
||||
},
|
||||
specs: [
|
||||
'./test/specs/**/*.js'
|
||||
|
14
test/specs/components/subject.js
Normal file
14
test/specs/components/subject.js
Normal file
@ -0,0 +1,14 @@
|
||||
const path = require('path');
|
||||
const base = require('../base/base');
|
||||
|
||||
class Subject {
|
||||
constructor() {
|
||||
this.subjectNavbar = '.navbar';
|
||||
}
|
||||
|
||||
isNavbarDisplayed() {
|
||||
base.waitForDisplayed(this.subjectNavbar);
|
||||
return base.isDisplayed(this.subjectNavbar);
|
||||
}
|
||||
}
|
||||
module.exports = Subject;
|
@ -4,9 +4,11 @@ const { expect } = require('chai');
|
||||
const common = require('../../base/common');
|
||||
const navigate = require('../../base/navigation');
|
||||
const Login = require('../../components/login');
|
||||
|
||||
const Subject = require('../../components/subject');
|
||||
|
||||
const testName = 'test';
|
||||
const corrrectName = 'admin';
|
||||
|
||||
describe('Login page in BestNotes', () => {
|
||||
it('should be displayed', () => {
|
||||
const login = new Login();
|
||||
@ -36,4 +38,23 @@ describe('Login page in BestNotes', () => {
|
||||
addStep('Check if the error message is displayed');
|
||||
expect(login.getErrorMessage(), 'Message about wrong credentials should be displayed').to.equal(common.errorLoginMessage);
|
||||
})
|
||||
|
||||
it('should logged user with correct 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, corrrectName);
|
||||
login.fillCredentials(login.passwordField, corrrectName);
|
||||
login.clickLoginButton();
|
||||
|
||||
addStep('Check if the page is displayed and URL matches');
|
||||
expect(browser.getUrl(), 'Post details URL should include post ID').to.equal(common.bestNotesLink + 'subject/');
|
||||
expect(new Subject().isNavbarDisplayed(), 'Subject page should be displayed').to.be.true;
|
||||
})
|
||||
});
|
0
test/specs/suites/desktop/subjectpage.test.js
Normal file
0
test/specs/suites/desktop/subjectpage.test.js
Normal file
Loading…
Reference in New Issue
Block a user