Skip to content
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

There is no way to access environment options #86

Closed
dmarquezz opened this issue Mar 17, 2014 · 3 comments
Closed

There is no way to access environment options #86

dmarquezz opened this issue Mar 17, 2014 · 3 comments

Comments

@dmarquezz
Copy link

Before v0.4.1 I could access the test settings for my current environment in a test by calling the options property on the client object. This was useful when testing in different environments because I could declare custom properties and access them within my tests.

Since we use the same URL pattern for all of our environments, I added an environment property to my environment settings in settings.json (now nightwatch.json):

"test_settings" : {
  "dev" : {
    ...
    "environment" : "dev",
    ...
  }
}

I did the same for all of our environments, so my tests looked like this for example:

"Test log in" : function(client) {
  client
    .url(client.options.environment + ".site.com/login")
    .assert.title(client.options.environment + " Site Login");
}

Now however, with v0.4.1, the options property isn't available on the client object. My current solution is to specify the environment in the launch_url property since launch_url can be accessed directly from the client object in v0.4.1. My test above changes to client.launch_url + ".site.com/login".

However, I don't like this solution because the launch_url property has a different purpose from how I'm using it now. But also because having access to the options property, and being able to specify custom options in your test settings provided an extra layer of flexibility.

Is there a way that I can access environment specific settings within tests in v0.4.1? If not, can we either get access to those settings again, or talk about other possible solutions?

@dmarquezz
Copy link
Author

I noticed a similar conversation was started here: https://github.com/beatfactor/nightwatch/issues/85

@beatfactor
Copy link
Member

I'm on it.

@beatfactor
Copy link
Member

check #85.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants