Closed samtbabu closed 5 years ago
Hi @samtbabu , thanks for bringing this to our notice. Could you kindly help with below details?
I assume you have updated your nightwatch version as cucumber-nightwatch is not compatible with nightwatch v1. Did you try running the package with pure nightwatch? Meaning, without nightwatch-api.
.
Hi @samtbabu , thanks for bringing this to our notice. Could you kindly help with below details?
I assume you have updated your nightwatch version as cucumber-nightwatch is not compatible with nightwatch v1. Did you try running the package with pure nightwatch? Meaning, without nightwatch-api.
Hi @spnraju , Thanks for the quick response. Please find the inline response
Q. I assume you have updated your nightwatch version as cucumber-nightwatch is not compatible with nightwatch v1 ?
Answer: Yes, I updated the nightwatch to 1.1.12 for using it with nightwatch-api. When I am using the nightwatch-cucumber, I used the nightwatch version: "^0.9.21"
Q. Did you try running the package with pure nightwatch? Meaning, without nightwatch-api. Answer:
When I was using nightwatch-cucumber package, I use the below statement.
const { client } = require('nightwatch-cucumber');
const { client } = require('nightwatch-cucumber');
const PAGE_WAIT_TIME = 20000;
module.exports = (Given, Then, When, World) => {
Given(/^I open the (.*) page/, pageModel => {
World.currentPageModel = client.page[pageModel]();
// @root signifies the class to look for to identify a page.
return World.currentPageModel
.navigate()
.waitForElementVisible('@root', PAGE_WAIT_TIME)
.waitForXHRComplete(PAGE_WAIT_TIME);
});
const { client } = require('nightwatch-api');
const PAGE_WAIT_TIME = 20000;
Given(/^I open the "([^"]*)" Page$/, async pagemodel => {
World.currentPageModel = client.page[pagemodel]();
await World.currentPageModel
.navigate()
.waitForElementVisible('@root', PAGE_WAIT_TIME)
.waitForAjaxCompleted();
});
I am not sure I understand your second question correctly, Please let me know, if you need further information.
Hi @samtbabu my second question is more about using nightwatch without cucumber i.e neither Nightwatch-api nor cucumber-nightwatch packages. Could you check the sample here https://github.com/spnraju/nightwatchjs-selenium-example
@spnraju - Thanks for the clarification. I tried integrating the nightwatch-commands package with pure nightwatch and I am able to reproduce the issue, which proves it's an issue with nightwatch package rather than nightwatch-api
I try taking this up with the nightwatch-commands team.
@spnraju It will be greatly appreciated if you can point us to some packages related to custom commands, which supports nightwatch-api package.
λ npm run chrome
> nightwatchjs-selenium-example@1.0.0 chrome C:\Users\sthoma40\MyDocs\Officeworks\Automation\nightwatchjs-selenium-example
> nightwatch -e chrome
[Github] Test Suite
===================
Running: Demo test GitHub
TypeError: Error while running "waitForCondition" command: "TypeError: Class constructor ProtocolActions cannot be invoked without 'new'
"
FAILED: 1 errors (1.355s)
TypeError: Error while running "waitForCondition" command: "TypeError: Class constructor ProtocolActions cannot be invoked without 'new'
"
module.exports = {
tags: ['git'],
'Demo test GitHub': function (client) {
client
.url('https://github.com/nightwatchjs/nightwatch')
.waitForAjaxCompleted()
.waitForElementVisible('body', 1000)
.getTitle(function (result) {
client.assert.equal(result.indexOf('GitHub - nightwatchjs/nightwatch'), 0, 'Page title starts with nightwatch')
})
.assert.visible('.container h1 strong a')
.assert.containsText('.container h1 strong a', 'nightwatch', 'Checking project title is set to nightwatch');
},
after: function (client) {
client.end();
}
};
module.exports = {
src_folders: ['tests'],
output_folder: 'output/reports',
custom_commands_path: './node_modules/nightwatch-commands/commands',
custom_assertions_path: '',
page_objects_path: '',
"devDependencies": {
"chromedriver": "^75.1.0",
"edgedriver": "^4.17134.1",
"geckodriver": "^1.16.2",
"iedriver": "^3.14.1",
"nightwatch": "^1.2.1",
"nightwatch-commands": "^3.0.0",
"selenium-server": "^3.141.59"
}
Expected Behavior
nightwatch-commands Package Support for nightwatch-api
I am trying to migrate my project from cucumer-nightwatch to nightwatch-api. In cucumer-nightwatch, I am using the nightwatch-commands package and I was trying to use the same with nightwatch-api.
Current Behavior
Getting the below error message while using the "nightwatch-commands": "^3.0.0" Package
Consol Log
Dependencies used
Nightwatch Config
Using Custom Command in Step Definition
waitForAjaxCompleted function definition in the Package: nightwatch-commands
What are you trying to accomplish?
nightwatch-commands Package has very useful methods, which can we used along with Nightwatch-api
@mucsi96 - Any help is much appreciated and let me know if you need any details from my side.