Created
April 12, 2018 15:30
-
-
Save NicholasRoge/4bf64fe9de908167b66335f4c8bd4c51 to your computer and use it in GitHub Desktop.
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
// wdio.conf.js | |
{ | |
... | |
before() { | |
browser.addCommand('foo', function (callback) { | |
callback.apply(this, []) | |
}) | |
} | |
... | |
} | |
// test.js | |
it('should succeed in selecting the body after being selected in a built-in command', function () { | |
browser.waitUntil(() => { | |
expect($('body').state).to.equal('success') | |
return true | |
}) | |
expect($('body').state).to.equal('success') | |
}) | |
it('should fail to select the body after being selected in a custom command', function () { | |
browser.foo(() => expect($('body').state).to.equal('success')) | |
expect($('body').state).to.equal('failure') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think this would work cause the expect assertion would throw exception itself. You can do something similar like this:
browser.waitUntil(() => {
return $('body').state === 'success';
});