protractor - Angular e2e test page object initialize before all tests -


here folder structure:

 |-- test     |-- unit     |-- e2e        |--suita           testa.js        |--suitb           testb.js        |--helper           helper.js 

in helper functions:

var helper = function() {     console.log('load helper module');     this.listh3title = element.all(by.css('div.col-sm-3 h3')).first().gettext();     this.firstresponsivetable = element(by.css('div.responsive-table')); };  module.exports = helper; 

in testa.js

describe('testa:', function() {     browser.get('');     it('login form should present', function() {         var loginform = element(by.css('form[name="loginform"]'));         expect(loginform.ispresent()).tobetruthy();     }); });  

in testb.js

var helper = require('../utilities/helper'); var helper = helper = new helper();  describe('testb:', function() { }); 

the helper function run before tests. in case testa fail because can't find element


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -