Nightwatch: --retries uses the same browser session instead of creating a new one (v1 regression)

Created on 17 Jul 2019  路  11Comments  路  Source: nightwatchjs/nightwatch

I'm opening this without an example test case and extra info because with a quick test it seemed quite obviously to be a regression between v0.9 and v1. I might be wrong, in such case please let me know and I'll look into adding a reproducable example and logging info (once I'm on my home PC)

Expected behaviour:

  • Write a test that has a failure
  • Run the test with the --retries 2 option
  • See a browser instance open and close for each retry

Current behaviour:

The same browser instance is used for all retries. (Does not happen with v0.9.21)

  • nightwatch v1.1.13
  • node v11.14.0
  • ChromeDriver 2.41.578706

All 11 comments

I think you should be using --suiteRetries. With that option your browser will close and reopen.
https://nightwatchjs.org/guide

To be honest I want to retry the single testcase rather than the whole testsuite to avoid making the tests run longer than necessary, which is the reason that I chose --retries rather than --suiteRetries.

I'm fine with this being expected behaviour, but I don't think that is the case simply because this wasn't the case on v0.9.21. If it is, then I think the docs should probably be updated to reflect that

+1. we use this functionality to re-run a specific test, rather than a whole suite of tests - i don't need to run all 20 of my tests if 1 failed, i just want to re-run the one failure. Additionally since my tests need to login, then having retry reuse the browser makes it so that i am already logged in, but my test being retried expects to have to login

So what we're saying is that we want the browser window to be re-opened? I think we're now in an awkward position to introduce a breaking change between 1.x versions. It's probably too late in 1.2 to change this back to 0.9 behaviour. What we can do is to introduce an additional setting, something like "retries_session_reuse" which will be turned on by default and when you set it to false it will produce the expected outcome here.

Actually i think for my scenario "--suiteRetries" does what i need. when i ran with --suiteRetries, it only re-ran the failed test with complete restart of browser, not all tests in my nightwatch run

@beatfactor I'm fine with an extra configuration option

This issue has been automatically marked as stale because it has not had any recent activity.
If possible, please retry using the latest Nightwatch version and update the issue with any relevant details. If no further activity occurs, it will be closed. Thank you for your contribution.

not stale

Also waiting for a solution for this. It is making my tests to break because the variables are not reset on each new retry

+1

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

manjero picture manjero  路  4Comments

sgleonardoopitz picture sgleonardoopitz  路  3Comments

willli666 picture willli666  路  3Comments

t00f picture t00f  路  3Comments

maxgalbu picture maxgalbu  路  3Comments