Closed sam3k closed 5 years ago
Thanks for reporting this. During next few days I will have no time to check this. But later I can. We are happy to receive a pull request fixing this.
Hi @sam3k , could you please try as below.
Please let us know if it works.
Hi @spnraju I've just tried:
let expect = await client.api.expect.elements...
let expect = await expect.elements.....
let expect = await client.expect.elements...
In all cases always got "Cannot read property 'elements' of undefined". Not sure if this is due to me using Cucumber+Nightwatch.
@mucsi96, I'm going to clone the repo and see if I can debug; but it almost sounds like I have a typo in my code.
Btw, these are my imports and original step definition that fails:
import { client } from 'nightwatch-api';
import { Given, Then } from 'cucumber';
Then('I expect to see the Org Hierarchy section on this profile', async () => {
await client
.expect
.elements('.list .card').count.to.be.above(0);
/* This didn't work either
await client.pause(3000);
expect.elements('.list .card').count.to.be.above(0);
*/
});
Btw, I'm basing my cucumber+nightwatch implementation off of the cucumber example: https://github.com/mucsi96/nightwatch-api/tree/master/packages/cucumber-example
I've found the issue. Somehow I ended up with an older version of Nightwatch. Upgrading to "nightwatch": "^1.1.11" fixed the issue. Closing this. Thank you all.
Your issue may already be reported! Please search on the issue track before creating one.
Expected Behavior
I'm trying to use
.elements().count
as described here: https://nightwatchjs.org/api#expect-elements-Current Behavior
Cucumber/Nightwatch fails step with: _nightwatchApi.client.expect.elements is not a function
Steps to Reproduce (for bugs)
step.js
package.json
Context
I cannot write any test that uses "expect". Only "assert". I am trying to find if there is more than 0 elements in a list. Meaning, if a list is empty or not by checking the className of the list item.
Your Environment