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

Unhandled rejection while using expect assertions in an async test step #3138

Closed
sarahRaafat15 opened this issue Apr 6, 2022 · 3 comments · Fixed by #3164
Closed

Unhandled rejection while using expect assertions in an async test step #3138

sarahRaafat15 opened this issue Apr 6, 2022 · 3 comments · Fixed by #3164
Assignees
Labels

Comments

@sarahRaafat15
Copy link

sarahRaafat15 commented Apr 6, 2022

Describe the bug

After an expect element to contain text assertion fails in an async step, test stops the rest of the execution, also the results object 's modules is empty.
NightwatchAssertError

Sample test

sampleTest.js

// Please add the sample test here

 it("async step", async function(browser) {
      browser.url("https://nightwatchjs.org/")
      browser.expect.element('#navigation').text.to.contain("someText")
    })
    it("2nd step", function(browser) {
      browser.url("https://google.com/")
    })

Your Environment

Executable Version
nightwatch --version 2.0.10
npm --version 8.3.1
node --version v16.14.0
Browser driver Version
chromedriver 98.0.0
OS Version
Windows 10
@sarahRaafat15 sarahRaafat15 changed the title Nightwatch Assert error stops test execution in async step Nightwatch Assert error in async step stops test execution Apr 6, 2022
@gravityvi
Copy link
Member

gravityvi commented Apr 18, 2022

Hey @sarahRaafat15, even in the case of sync test methods rest of the tests are skipped and this is the expected behavior

@sarahRaafat15
Copy link
Author

Hi @gravityvi , but in the case of having
skip_testcases_on_fail: false in nightwatch.json it should not.
Also I think this is a duplication of this bug #3075 which is solved in nighwatch 2.0.8 so it should not be occuring in 2.0.10 ?
image

@gravityvi gravityvi self-assigned this Apr 19, 2022
@gravityvi gravityvi changed the title Nightwatch Assert error in async step stops test execution skip_testcases_on_fail flag not working in async tests Apr 19, 2022
@gravityvi gravityvi added this to To do in Nightwatch v2 Apr 19, 2022
@gravityvi
Copy link
Member

gravityvi commented Apr 19, 2022

Thanks @sarahRaafat15 for reporting this. I have noticed this only happens while using browser.expect assertions. We will look into this.

@vaibhavsingh97 vaibhavsingh97 moved this from To do to In progress in Nightwatch v2 Apr 21, 2022
@gravityvi gravityvi changed the title skip_testcases_on_fail flag not working in async tests Unhandled rejection while using expect assertions in an async test step Apr 25, 2022
Nightwatch v2 automation moved this from In progress to Done Apr 28, 2022
beatfactor pushed a commit that referenced this issue Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

2 participants