viral desai
viral desai

Reputation: 21

A Jasmine spec timed out. Resetting the WebDriver Control Flow

I am getting

Jasmine spec timed out. Resetting the WebDriver Control Flow.

I have also used fakesyn before but getting same error message as above. Please help me

This is my specs:

describe('CW Login Page',   function() {
    var username;   
    var password;
    var login;
    beforeEach(() => {
    browser.waitForAngularEnabled(false);
    browser.get('http://www.testing.com/');
    console.log('after link await');
  });

    it('should find the element and send the parameters',  fakeAsync(() => {
      setTimeout(function() {
      value=0;
      console.log('Inside it function');
      username = element(by.id('userIDInput'));
      password= element(by.id('passwordInput'));
      login= element(by.id('login'));
      console.log('After await');
      username.sendKeys('abc');
      password.sendKeys('abc');
      login.click();
      console.log("After it function");
      },5000);
      tick(5000);
    }));

    `beforeEach`(() => {
      console.log('\r\n ---=== TESTS FINISHED!!! ===--- \r\n');
   });
    });

This is my config:

exports.config = {
  allScriptsTimeout: 50000,
  getPageTimeout:40000,
  framework:'jasmine2',
  /*seleniumAddress: 'http://localhost:4723/wd/hub', // Ignored if directConnect is true
  specs: ['loginpage.js'],*/
  seleniumAddress: 'https://hub.testingbot.com/wd/hub',
  specs: ['./src/loginpage_fakeasync.e2e-specs.js'],
  seleniumArgs: ['--dev-server-target'], // '--dev-server-target' ],
  directConnect: false, //Change this to true for your local testing
  multiCapabilities: [{ // in 1 chrome run the 10 specs sequentially
    browserName: 'chrome',
    platform: 'Android',  
    version: '7.1',  
    platformName: 'Android',  
    deviceName: 'Pixel 2',
    client_key: "abc",
    client_secret: "xyz"
  }],

jasmineNodeOpts: {  
  onComplete: null,                 //jasmine framework details
  isVerbose: false,
  showColors: true,
  includeStackTrace: true,
  defaultTimeoutInterval: 40000,
  print: function() {}

I expect to open the webpage and login using the automation script. If someone can figure out the error it would be a great help

I am getting

Jasmine spec timed out. Resetting the WebDriver Control Flow.

I have also used fakesyn before but getting same error message as above. Please help me

Upvotes: 1

Views: 175

Answers (1)

DublinDev
DublinDev

Reputation: 2348

The control flow should keep everything running in sync so the fakeAsync & setTimeout should not be required. If your framework is not too large then you should consider disabling the control flow and using the async/await style of handling promises.

I doubt this will solve your issue but can you try the below code and post the results.

describe('CW Login Page', function () {
    var username;
    var password;
    var login;

    beforeEach(() => {
        browser.waitForAngularEnabled(false);
        browser.get('http://www.testing.com/');
        console.log('after link await');
    });

    it('should find the element and send the parameters', () => {
        value = 0;
        console.log('Inside it function');
        username = element(by.id('userIDInput'));
        password = element(by.id('passwordInput'));
        login = element(by.id('login'));
        console.log('After await');
        username.sendKeys('abc');
        password.sendKeys('abc');
        login.click();
        console.log("After it function");
    })

    afterEach(() => {
        console.log('\r\n ---=== TESTS FINISHED!!! ===--- \r\n');
    }
});

Upvotes: 1

Related Questions