selenium webdriver - Protractor moves on to next test without waiting -


i'm using protractor , when run tests on browserstack receive following error

staleelementreferenceerror: stale element reference: element not attached page document 

or depending on in beforeall

error: index out of bound. trying access element @ index: 0, there 0 elements match locator by.cssselector ... 

here code snippet causing error:

describe('...', () => {    it('...', () => {        expect(element.all(by.css(...)).count()).tobe(9);        expect(element.all(by.css('.items').get(0).isdisplayed()).tobetruthy();    }); }  describe('', () => {     beforeall((/* done */) => {          element(by.css('.go-home').click(); // .then(done);           //browser.driver.get('/');//.then(done);     });     ... }); 

for reason beforeall continues , changes url, while previous it still running (i guess based on error).

now, managed hack such works. i've added done it follows

describe('...', () => {    it('...', (done) => {        expect(element.all(by.css(...).count()).tobe(9);         element.all(by.css(...)).get(0).isdisplayed().then((state) => {           expect(state).tobetruthy();           done();     });    }); }  describe('', () => {     beforeall(() => {          element(by.css('.go-home').click(); // works           //browser.driver.get('/');          // still fails     });     ... }); 

now works. if use browser.driver.get('/') fails again.

normally don't have add done its question is: going wrong here ? appreciated

update: protractor.config.js:

exports.config = {     chromedriver: '../node_modules/protra...medriver_2.25',     seleniumserverjar: '../node_...-server-standalone-2.53.1.jar',     exclude: [],      specs: [         '../test/e2e/**/*.js'     ],      multicapabilities: [         {             build: 'test',             project: 'abc',             browsername: 'firefox',             //browsername: 'chrome',             os: 'windows',             os_version: '10',             directconnect: true         }],     debug: true,     maxsessions: 1,     framework: 'jasmine2',      onprepare: function () {         browser.driver.manage().window().setsize(1024, 768);          // register helpers         require('../test/framework/jasmine2');          var disablenganimate = function () {             angular                 .module('disablenganimate', [])                 .run(['$animate', function ($animate) {                     $animate.enabled(false);                 }]);             };          var disablecssanimate = function () {             angular                 .module('disablecssanimate', [])                 .run(function () {                     var style = document.createelement('style');                     style.type = 'text/css';                     style.innerhtml = '* {' +                         '-webkit-transition: none !important;' +                         '-moz-transition: none !important' +                         '-o-transition: none !important' +                         '-ms-transition: none !important' +                         'transition: none !important' +                         '}';                     document.getelementsbytagname('head')[0].appendchild(style);             });         };          browser.addmockmodule('disablenganimate', disablenganimate);         browser.addmockmodule('disablecssanimate', disablecssanimate);     } }; 


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -