Nightwatch: Enhancement: Allow relative url in `url` function

Created on 12 Aug 2015  路  13Comments  路  Source: nightwatchjs/nightwatch

Hi,

While I was playing with the framework, I wanted to make something DRY. I configured the launchUrl settings and then I tried to do the following in a test suite:

 module.exports = {
     'Test account login in admin': function (browser) {
         browser.init().url('/admin/')...
      }
 }

It looks like (I'm not 100% sure but I don't see any other explanations) the url() function does not work with relative path... Here, I would expect to be redirect to http://localhost:1234/admin if the launchUrl is http://localhost:1234/ (or even http://localhost:1234/some/path/ since, the parameter starts with a slash in my example).

To summarize, I think this behaviour would be great:

| launchUrl | url parameter | Expected page call |
| --- | --- | --- |
| http://localhost:1234/ | /admin/ | http://localhost:1234/admin/ |
| http://localhost:1234/ | admin/foo | http://localhost:1234/admin/foo |
| http://localhost:1234/ | http://www.google.com | http://www.google.com |
| http://localhost:1234/path/ | admin/ | http://localhost:1234/path/admin/ |
| http://localhost:1234/path/ | ../admin/ | http://localhost:1234/admin/ |
| http://localhost:1234/path/ | http://www.google.com | http://www.google.com |

Most helpful comment

I'm afraid this is not something we'll be adding for now. Thanks though.

Really? I feel this is pretty basic functionality when working with single page applications.

All 13 comments

+1

+1

+1

I'm afraid this is not something we'll be adding for now. Thanks though.

I'm trying to set up a new node project, looking for best practices, and there doesn't seem to be any "way" when it comes to starting up your environment at the start of the test. Is this intentional? Would be nice to get an explanation.

+1, everything went smooth until I had to find out how to go to the URL I had already set in nightwatch.json as my launch_url. My first attempt was to set .url('/').

+1

Just an unexpected omission in this library, forcing concats or customization everywhere.

+1
We run virtual box in dev environment, so not everyone have the same hostname, sad this is closed.

+1

+1

+1

I'm afraid this is not something we'll be adding for now. Thanks though.

Really? I feel this is pretty basic functionality when working with single page applications.

+1
I also wanted to use the relative url method

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chaseconey picture chaseconey  路  4Comments

manjero picture manjero  路  4Comments

davidlinse picture davidlinse  路  4Comments

danielbentov picture danielbentov  路  4Comments

antogyn picture antogyn  路  4Comments