I am new to cucumber. My tests results are shown before it executes. It shows all passed even though the browser is still loading.
Below is my *page.js
var CalculatorPage = function() {
//const {setDefaultTimeout} = require('cucumber');
this.get = function() {
browser.get('');
};
Below is my steps.js file
this.Given(/^The LoginPage is open$/, function () {
this.page.get();
});
This is because JavaScript gets executed in an asynchronous manner. To make it synchronous we need to take advantage of promise.
var CalculatorPage = function() {
//const {setDefaultTimeout} = require('cucumber');
this.get = function() {
return browser.get('');
};
this.Given(/^The LoginPage is open$/, function (done) {
this.page.get().then(function(){
done()
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.