Skip to content

Can't make screenshots of failed qunit tests #61

Description

@fbuchinger

I want to run our qunit tests in different browsers using selenium/soda and capture screenshots of failed tests.

function runTestsInBrowser(browserName){
    var browser = soda.createClient({
        host: 'localhost'
      , port: 4444
      , url: 'http://localhost'
      , browser: browserName
    });


   browser
  .chain
  .session()
  .open('/testpage.html')
  .waitForTextPresent('Tests completed')
  .assertTextPresent('0 failed')
  .end(function(err){
    browser.testComplete(function(){
      console.log('done');
      if (err){
        var timestamp = (new Date).toISOString().split(':').join('-').split('.')[0];
        browser.captureEntirePageScreenshot('D:\\dev\\selenium\\screenshots\\' + browserName + '_' + timestamp + '.png');
        //throw err;
      } 
    });
  });
}

runTestsInBrowser('firefoxchrome');
//runTestsInBrowser('iexplore');
runTestsInBrowser('chrome');

unfortunately, this leads to an exception:

D:\dev\selenium\soda\lib\soda\client.js:122
        fn(new Error(err), res.body, res);
        ^
TypeError: string is not a function
    at IncomingMessage.<anonymous> (D:\dev\selenium\soda\lib\soda\client.js:122:
9)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

turns out that the screenshot file path was assigned to fn. am i doing something wrong?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions