Here's the api for client.execute
. I'm able to get a value back, but how am I able to actually test that the value is correct? I don't see a generic assert
method anywhere.
http://nightwatchjs.org/api/execute.html
Running A Demo TestStep 1: Go to the folder “node_modules/nightwatch/examples/tests/”. Step 2: Under the 'tests' folder, you can find some sample tests. Step 3: Let us run the first sample test “ecosia. js”.
Nightwatch. js is an open-source automated testing framework that is powered by Node. js and provides complete E2E (end to end) solutions to automation testing with Selenium Javascript be it for web apps, browser apps, and websites.
To execute tests in multiple browsers, you need to add the desired capabilities of the browsers and Test_worker configurations in nightwatch. json file. For example if you want to execute tests in three browsers parallely - Chrome, Firefox and Opera, your nightwatch. json should something like this.
By simply converting the test method to a string, Nightwatch will ignore it.
Nightwatch.js extends Node.js assert module, so you can also use any of the available methods there in your tests.
'some suite': function (client) {
client.execute(
function(greet){
return greet + " there!";
},
"Hello",
function(result){
client.assert.equal(result, "Hello there!");
}
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With