0

I'm working with WebDriverIO and Mocha for my initial UI tests.

conf is an object where the WebDriverIO scripts live and (in this case) the test returns an object... { width : ###, active : '' }

When I run the test, I get to through the first test as expected but the browser closes before the other two tests can run (and providing the failing tests).

So...
"View Select Resizes to Mobile" = Pass
[Browsers close]
"View Select Resizes to Tablet" = Fail
"View Select Resizes to Desktop" = Fail

Why are the browser sessions closing? (I would like to keep the same session open for all three)

Is there a way to remedy this or a specific place in my project I should look?

describe('View Select Resizes to', function(){

  before(function(){
    browser.url( 'http://localhost:8000/' );
  });

    it('Mobile', async()=>{

      let result = {};

      result = await conf.viewselect('mobile');

      assert( result.width, 375 );
      assert( result.active, 'mobile' );

    });

    it('Tablet', async()=>{

      let result = {};

      result = await conf.viewselect('mobile');

      assert( result.width, 540 );
      assert( result.active, 'tablet' );

    });

    it('Desktop', async()=>{

      let result = {};

      result = await conf.viewselect('desktop');

      assert( result.width, 1067 );
      assert( result.active, 'desktop' );

    });

});

Thanks for the help :)

Doug
  • 1,435
  • 1
  • 12
  • 26
  • in async testing, shouldn't you provide done in the async (done) =>{ .. } and then call it at the end of the test? Just an idea... – Roman Mik Aug 30 '18 at 17:59
  • I'm not certain, that sounds more like working with a callback vs. async https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function but its worth giving it a shot :) – Doug Aug 30 '18 at 20:08

0 Answers0