Created
November 26, 2015 14:22
-
-
Save SimitTomar/b704fb24d83f28b47473 to your computer and use it in GitHub Desktop.
This file contains 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
@christian-bromann My question is around the Custom Commands. I went through the example given here: http://webdriver.io/guide/usage/customcommands.html | |
Based on that created to JS files | |
1) getUrlAndTitle.js: which contains the code for custom command: | |
‘ | |
client.addCommand("getUrlAndTitle", function(customVar, cb) { | |
this.url(function(err,urlResult) { | |
this.getTitle(function(err,titleResult) { | |
var specialResult = {url: urlResult.value, title: titleResult}; | |
cb(err,specialResult); | |
console.log(customVar); // "a custom variable" | |
}) | |
}); | |
}); | |
‘ | |
2) Test.js: which contains the step Definitions: | |
‘ | |
this.Then(/^I Select an appropriate Title$/, {timeout: 30 * 1000}, function (next) { | |
this.client | |
.init() | |
.getUrlAndTitle('a custom variable',function(err,result){ | |
console.log('entered getUrlAndTitle'); | |
}) | |
.then(function() { | |
this.call(next); | |
}); | |
}); | |
‘ | |
But the Issue is that I am not getting .getUrlAndTitle as a command when I do this.client. , I just typed it manually in the step definition to see the output. Of course, the corresponding step is failing. | |
Is there anything that I am missing here, do I need to add the path of getUrlAndTitle.js in Test.js like | |
‘var getUrlAndTitle = require('tests/acceptance/wdio/utilities/helper/getUrlAndTitle.js');’ | |
or add the command in world.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment