Starting to cleanup the modals spec: moved login logic to a page object.

This commit is contained in:
Maxim Khlobystov 2017-11-03 19:33:01 +00:00
parent 97c854a003
commit cc749d5f01
2 changed files with 18 additions and 1 deletions

View File

@ -0,0 +1,14 @@
'use strict';
let Page = require('./page');
let pageObject = new Page();
let chai = require('chai');
class HomePage extends Page {
login(username, meeting) {
super.open('demo/demoHTML5.jsp?username=' + username + '&meetingname=' + meeting.replace(/\s+/g, '+') + '&action=create');
}
}
module.exports = new HomePage();

View File

@ -1,3 +1,6 @@
'use strict';
let HomePage = require('../../pageobjects/home.page');
var expect = require('chai').expect;
function expectImageMatch(results, errorMessage) {
@ -7,7 +10,7 @@ function expectImageMatch(results, errorMessage) {
describe('Screenshots:', function() {
it('Join Audio modal looks good', function() {
browser.url('demo/demoHTML5.jsp?username=testuser&meetingname=Demo+Meeting&action=create');
HomePage.login('testuser', 'Demo Meeting');
browser.element('.ReactModal__Content--after-open').waitForExist(7000);
expectImageMatch(browser.checkElement('.ReactModal__Content--after-open'), 'Join Audio modal isn\'t the same');
});