Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't make screenshots of failed qunit tests #61

Open
fbuchinger opened this issue Sep 12, 2013 · 0 comments
Open

Can't make screenshots of failed qunit tests #61

fbuchinger opened this issue Sep 12, 2013 · 0 comments

Comments

@fbuchinger
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant