tim-yao / cucumber-nightwatch

A small library to enable us to use latest nightwatch.js(v3) in cucumber.js(v9)
MIT License
1 stars 1 forks source link

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

Open tim-yao opened 1 year ago

tim-yao commented 1 year ago

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 commented 1 year ago

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 https://github.com/nightwatchjs/nightwatch/issues/2510 & https://github.com/nightwatchjs/nightwatch/pull/3499

tim-yao commented 1 year ago

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

tim-yao commented 1 year ago

This issue is gone. Can be closed.

tim-yao commented 1 year ago

The problem continues to exist.