-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] how to capture client
instance before any steps have been executed
#14
Comments
Why you don’t create a simple node module with these constants and import it where needed? |
You can add the url also to this module. And import it in nightwatch configuration |
I have some troubles to understand what to do.
When i run this code, it raises an exception
|
May be i've to tweak
|
I see. Maybe its a bug. Will try to investigate. Until this is resolved I suggest not using nightwatch globals. Just creating an node module for that.And using it in page objects, steps and nightwatch configuration as well. Is it fine for you? |
ok, thanks for your time. And thanks for |
I am also facing the same issue while running cucumber tests using nightwatch-api. Can we please get a solution for this. Thanks |
Hi @pendenaor and @pratyush23 , are you still facing this issue? If yes, could you point me to a repo with sample project with similar config? |
Closing due to lack of activity. Feel free to reopen if the issue still exist |
@mucsi96 I am facing this issue, too. I have also to distinguish between some things and therefor I am using boolean values. Example for my config: globals: {
url: isStagingEnvironment ? 'www.example.com' : 'http://localhost',
apiUrlApplicant: process.env.URL_APPLICANT,
apiTokenApplicant: process.env.API_TOKEN,
useNetworkStubs,
isNotMocked,
isStagingEnvironment,
}, Example for a using in my step files: if (client.globals.isStagingEnvironment) {
client.expect.element(_SELECTOR_).to.be.visible.before(DEFAULT_WAIT_IN_MS);
} Example for a using in my helper files: const { client } = require('nightwatch-cucumber');
const { url } = client.globals;
module.exports = {
'applications page': `${url}/.../...`,
.... |
Hi @mucsi96 First, thanks a lot for this new package API. Looks interesting. I am trying to update my framework test from the old "Nightwatch-Cucumber (deprecated)" to this new "Nightwatch-api".
Basically, this was working fine before in old "Nightwatch-Cucumber (deprecated)" but in this new api is not running: This is the code that I am using in my step file: const { client } = require('nightwatch-api');
const { Given, Then, When } = require('cucumber');
var core = require('../../../../../pages/core');
core(client).loginRequired(); Is there something that I am not considering to point correctly to my function? Thanks in advance for your help! |
Hi @gornelex , thanks for reaching out. I see that you are facing issues in migration. Please note that nightwatch-api is a lot different than that of nightwatch-cucumber. Please follow the examples provided in the repo. if you still face the issue, an example setup will help in understanding it better. Please let us know. |
I'm currently migrating my bdd test (based on the cucumber example) and i want to create some page urls with
url
property set in global test settings, eg:The text was updated successfully, but these errors were encountered: