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

Better errors details #296

Open
bitplanets opened this issue Dec 15, 2014 · 3 comments
Open

Better errors details #296

bitplanets opened this issue Dec 15, 2014 · 3 comments

Comments

@bitplanets
Copy link

I just got

C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:1643
      throw error;
            ^
AssertionError: expected false to be true

What is going on? I don't even know what failed... Not even the line... nothing.

@samccone
Copy link
Contributor

Without looking at your code it is hard to help with this error.

@bitplanets
Copy link
Author

The problem was very easy to solve because I just had a test. This is not the question.

The issue is why the lib doesn't show the file and the line where the error happened?

@bitplanets
Copy link
Author

Now I get this:

C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:1643
      throw error;
            ^
Error: Wait timed out after 626ms
    at C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:1311:29
    at Object.webdriver.promise.asap (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:671:5)
    at newFrame.then.e (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:1555:25)
    at C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\goog\base.js:1243:15
    at webdriver.promise.ControlFlow.runInNewFrame_ (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:1539:20)
    at notify (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:362:12)
    at notifyAll (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:331:7)
    at resolve (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:309:7)
    at fulfill (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:429:5)
    at webdriver.promise.ControlFlow.resolveFrame_ (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:1460:9)
    at webdriver.promise.ControlFlow.getNextTask_ (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:1429:12)
    at webdriver.promise.ControlFlow.runEventLoop_ (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:1387:59)
    at wrapper [as _onTimeout] (timers.js:261:14)
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)
==== async task ====
    at webdriver.promise.ControlFlow.wait (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:1296:15)
    at webdriver.WebDriver.wait (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:543:21)
    at Object.<anonymous> (C:\t\tests\steps\init.js:46:21)
    at C:\t\node_modules\pioneer\lib\support\index.js:65:25
    at webdriver.promise.ControlFlow.runInNewFrame_ (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:1539:20)
    at webdriver.promise.ControlFlow.runEventLoop_ (C:\t\node_modules\pioneer\node_modules\selenium-webdriver\lib\webdriver\promise.js:1404:8)
    at wrapper [as _onTimeout] (timers.js:261:14)
    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)

And the error should be here somewhere:

module.exports = function(){
    this.Given(/^I drop the database$/,function(){
        var databaseName    = 'test';
        var mongoose        = require('mongoose');
        var mongooseConnect = require('mongoose-connect');
        var connectData     = mongooseConnect.connect(databaseName, [], mongoose);
        var dropped         = false;
        connectData.connection.on('connected', function(){
            connectData.connection.db.dropDatabase(function(err, _dropped){
                (err === null).should.be.true;
                _dropped.should.be.true;
                dropped = true;
            });
        });
        this.driver.wait(function(){
            return dropped;
        }, 10 * 1000).then(function(){
        })
    });

    this.Given(/^I open the game$/,function(){
        this.driver.get('https://localhost/')
    });

    this.Given(/^I wait for (\d+) seconds$/,function(n){
        var timerDone = false;
        setTimeout(function(){
            timerDone = true;
        }, n * 1000)
        this.driver.wait(function(){
            return timerDone;
        }, Infinity).then(function(){
        })
    });

    this.When(/^I should see the loading screen$/, function(){
        this.Widget.isVisible({
            selector: '#preloader'
        }).then(function(value){
            value.should.be.true;
        })
    });

    this.Given(/^I wait for app to initialize (\d+) seconds$/,function(n){
        var inited = false;
        this.driver.wait(function(){
            var result = this.driver.executeScript('return data.init');
            result.then(function(value){
                if(inited) return;
                inited = value;
            })
        }.bind(this), n * 10).then(function(){
        })
    });

    this.When(/^I should have some planets$/, function(){
        var result = this.driver.executeScript('return data.stores.blockStore.getPlanets().length');
        result.then(function(value){
            parseInt(value).should.be.above(0);
        })
    });

    this.Then(/^I should see \"([^\"]*)\"$/, function(expected){
        var List = this.Widget.List.extend({
            root: "#todo-list",
            childSelector: "li"
        })

        return new List().readAt(0).should.eventually.eql(expected);
    })
}

How do you debug your tests? This is insane without a file and a line number. Well the error was that the wait method timed out.

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

2 participants