Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Nightwatch API command won't throw error if test fail #5

Open
tim-yao opened this issue Apr 23, 2023 · 4 comments
Open

Nightwatch API command won't throw error if test fail #5

tim-yao opened this issue Apr 23, 2023 · 4 comments
Assignees

Comments

@tim-yao
Copy link
Owner

tim-yao commented Apr 23, 2023

The below command won't fail cucumber tests when it fails.

    // These won't fail
    await this.browser.waitForElementVisible(
      '#not-existing-element',
      1000,
      0,
      true,
      function (result) {
        console.log('result', result)
      }
    )
    await this.browser.waitForElementPresent(
      'css selector',
      '#not-existing-element'
    )
    await this.browser.click('#not-existing-element')
    await this.browser.ensure.elementIsVisible('#not-existing-element')

Below works.

    await this.browser!.expect.element('#not-existing-element').to.be.present;
    await this.browser!.expect.element('#not-existing-element').to.be.visible;
    await this.browser!.assert.visible('#not-existing-element')
@tim-yao
Copy link
Owner Author

tim-yao commented Apr 23, 2023

This issue can be fixed by this patch https://github.com/nightwatchjs-community/cucumber-nightwatch/blob/main/patches/nightwatch%2B2.6.14.patch.

And you will need to patch the nightwatch.js in your project.

For longer term, need the Nightwatch to fix it in the programmatic API. See nightwatchjs/nightwatch#2510 & nightwatchjs/nightwatch#3499

@tim-yao tim-yao self-assigned this Apr 23, 2023
@tim-yao
Copy link
Owner Author

tim-yao commented May 26, 2023

The above patch stops working in v3.0.0-preview.1

@tim-yao
Copy link
Owner Author

tim-yao commented Aug 11, 2023

This issue is gone. Can be closed.

@tim-yao tim-yao closed this as completed Aug 11, 2023
@tim-yao tim-yao reopened this Sep 11, 2023
@tim-yao
Copy link
Owner Author

tim-yao commented Sep 11, 2023

The problem continues to exist.

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

No branches or pull requests

1 participant