Created
July 12, 2012 13:33
-
-
Save thom4parisot/3098134 to your computer and use it in GitHub Desktop.
Bootstrap Dropdown CasperJS check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
casper.start(); | |
casper.open('http://twitter.github.com/bootstrap/javascript.html#dropdowns'); | |
casper.then(function(){ | |
this.test.assertExists('#navbar-example'); | |
this.click('#dropdowns .nav-pills .dropdown:last-of-type a.dropdown-toggle'); | |
this.wait(2000, function(){ | |
this.test.assertExists('#dropdowns .nav-pills .open', 'Dropdown is open'); | |
}); | |
}); | |
casper.run(function(){ | |
this.test.done(); | |
}); |
Test file: casper.js
PASS Found an element matching #navbar-example
FAIL Dropdown is open
# type: assertExists
# subject: false
# selector: "#dropdowns .nav-pills .open"
FAIL 2 tests executed, 1 passed, 1 failed.
Petite refacto:
casper.start('http://twitter.github.com/bootstrap/javascript.html#dropdowns', function() {
this.test.assertExists('#navbar-example');
this.click('#dropdowns .nav-pills .dropdown:last-of-type a.dropdown-toggle');
this.waitUntilVisible('#dropdowns .nav-pills .open', function() {
this.test.pass('Dropdown is open');
});
});
casper.run(function() {
this.test.done();
});
T'utilises quelle version d'ailleurs ?
livarot:~ oncletom$ casperjs --version
1.0.0-RC1
livarot:~ oncletom$ phantomjs --version
1.6.0
Tu mens, @n1k0 !
Solved in CasperJS master. Related to https://github.com/n1k0/casperjs/issues/153
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Chez moi https://gist.github.com/3098134/bdb02729e77809fe66cdf71ee98f48914ac136a6 marche: