Skip to content

Nightwatch test doesn't fail if element was not found #4405

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

Open
maxi-mueller opened this issue Apr 22, 2025 · 0 comments
Open

Nightwatch test doesn't fail if element was not found #4405

maxi-mueller opened this issue Apr 22, 2025 · 0 comments

Comments

@maxi-mueller
Copy link

I am using Nightwatch + Cucumber for some automated tests and I noticed that when a element can't be found then functions like click and sendKeys won't fail the test. The error message is shown in the console like:
An error occurred while running .sendKeys() command on <.demo>: Timed out while waiting for element ".demo" with "css selector" to be present for 5000 milliseconds.
but the rest of the test will continue. My nightwatch default profile includes those flags:

suppressNotFoundErrors: false,
abortOnAssertionFailure: true,
abortOnElementLocateError: true,

Here is some example code (notice that i am using the page object model)

  login: async function(email, password) {
    await this.sendKeys('@emailField', email)
    await this.click('@continueButton')
    await this.sendKeys('@passwordField', password)
    await this.click('@confirmPasswordButton')
    await this.expect.element('@uniquePageElement').to.not.be.present;
  },

Also, is it correct to not chain the commands?

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

1 participant