nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.83k stars 1.33k forks source link

abortOnFailure=false for waitForElementVisible/NotVisible does not seem to prevent failures #3931

Closed reallymello closed 1 year ago

reallymello commented 1 year ago

Description of the bug/issue

When I use waitForElementNotVisible with the abortOnFailure parameter set to false I expect the test to carry on without failures if the element is present and remains visible in excess of my specified wait time for it to no longer be visible. Conversely, if I use waitForElementVisible with abortOnFailure set to false and the element is present, but doesn't become visible within the specified duration parameter I expect the test to carry on without failure after waiting unsuccessfully for the condition.

However, in both cases the test fails with expected "not visible" but got: "visible" or expected "visible" but got: "not visible" respectively. It doesn't seem to matter if I use the abortOnFailure parameter. It seemingly is ignored.

Steps to reproduce

import { NightwatchAPI, NightwatchTests } from 'nightwatch';

const waitForIt: NightwatchTests = {
  'wait for not': () => {
    browser.url('https://www.nightwatchjs.org');
    browser.waitForElementNotVisible('#header', 1000, 100, false);
  },
  'wait for': () => {
    browser.url('https://www.nightwatchjs.org');
    browser.setAttribute('nav.navigation', 'hidden', 'true');
    browser.waitForElementVisible('nav.navigation', 1000, 100, false);
  },
};

export default waitForIt;

Sample test

import { NightwatchAPI, NightwatchTests } from 'nightwatch';

const waitForIt: NightwatchTests = {
  'wait for not': () => {
    browser.url('https://www.nightwatchjs.org');
    browser.waitForElementNotVisible('#header', 1000, 100, false);
  },
  'wait for': () => {
    browser.url('https://www.nightwatchjs.org');
    browser.setAttribute('nav.navigation', 'hidden', 'true');
    browser.waitForElementVisible('nav.navigation', 1000, 100, false);
  },
};

export default waitForIt;

Command to run

npx nightwatch

Verbose Output

npx nightwatch --verbose
 Launching up to 1 concurrent test worker processes...

Running   default: waitForIt.ts  

DevTools listening on ws://127.0.0.1:58275/devtools/browser/70fa88b8-7543-4362-b032-68a82ad1ffbd
[32240:14260:1011/153258.730:ERROR:cert_issuer_source_aia.cc(36)] Error parsing cert retrieved from AIA (as DER):
ERROR: Couldn't read tbsCertificate as SEQUENCE
ERROR: Failed parsing Certificate

[32240:14260:1011/153259.151:ERROR:cert_issuer_source_aia.cc(36)] Error parsing cert retrieved from AIA (as DER):
ERROR: Couldn't read tbsCertificate as SEQUENCE
ERROR: Failed parsing Certificate

┌ ────────────────── ×  default: waitForIt.ts  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                                                                                                                                                                                             │
│   default [Nightwatch\wait For It] Test Suite                                                                                                                                                                                                               │
│   default ──────────────────────────────────────────────────────────────────────                                                                                                                                                                            │
│   default Starting ChromeDriver...                                                                                                                                                                                                                          │
│   default Selenium Manager binary found at C:\Users\Mr\Desktop\temp\node_modules\selenium-webdriver\bin\windows\selenium-manager.exe                                                                                                                        │
│   default Driver path: C:\Users\Mr\.cache\selenium\chromedriver\win64\117.0.5938.149\chromedriver.exe                                                                                                                                                       │
│   default Browser path: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe                                                                                                                                                                         │
│   default   Request POST /session                                                                                                                                                                                                                           │
│   default {                                                                                                                                                                                                                                                 │
│   default      capabilities: {                                                                                                                                                                                                                              │
│   default        firstMatch: [ {} ],                                                                                                                                                                                                                        │
│   default        alwaysMatch: {                                                                                                                                                                                                                             │
│   default          browserName: 'chrome',                                                                                                                                                                                                                   │
│   default          'goog:chromeOptions': {                                                                                                                                                                                                                  │
│   default            binary: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'                                                                                                                                                             │
│   default          }                                                                                                                                                                                                                                        │
│   default        }                                                                                                                                                                                                                                          │
│   default      }                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default   Response 200 POST /session (553ms)                                                                                                                                                                                                              │
│   default {                                                                                                                                                                                                                                                 │
│   default      value: {                                                                                                                                                                                                                                     │
│   default        capabilities: {                                                                                                                                                                                                                            │
│   default          acceptInsecureCerts: false,                                                                                                                                                                                                              │
│   default          browserName: 'chrome',                                                                                                                                                                                                                   │
│   default          browserVersion: '117.0.5938.150',                                                                                                                                                                                                        │
│   default          chrome: {                                                                                                                                                                                                                                │
│   default            chromedriverVersion: '117.0.5938.149 (e3344ddefa12e60436fa28c81cf207c1afb4d0a9-refs/branch-heads/5938@{#1539})',                                                                                                                       │
│   default            userDataDir: 'C:\\Users\\Mr\\AppData\\Local\\Temp\\scoped_dir4724_1601529795'                                                                                                                                                          │
│   default          },                                                                                                                                                                                                                                       │
│   default          'fedcm:accounts': true,                                                                                                                                                                                                                  │
│   default          'goog:chromeOptions': { debuggerAddress: 'localhost:58275' },                                                                                                                                                                            │
│   default          networkConnectionEnabled: false,                                                                                                                                                                                                         │
│   default          pageLoadStrategy: 'normal',                                                                                                                                                                                                              │
│   default          platformName: 'windows',                                                                                                                                                                                                                 │
│   default          proxy: {},                                                                                                                                                                                                                               │
│   default          setWindowRect: true,                                                                                                                                                                                                                     │
│   default          strictFileInteractability: false,                                                                                                                                                                                                        │
│   default          timeouts: { implicit: 0, pageLoad: 300000, script: 30000 },                                                                                                                                                                              │
│   default          unhandledPromptBehavior: 'dismiss and notify',                                                                                                                                                                                           │
│   default          'webauthn:extension:credBlob': true,                                                                                                                                                                                                     │
│   default          'webauthn:extension:largeBlob': true,                                                                                                                                                                                                    │
│   default          'webauthn:extension:minPinLength': true,                                                                                                                                                                                                 │
│   default          'webauthn:extension:prf': true,                                                                                                                                                                                                          │
│   default          'webauthn:virtualAuthenticators': true                                                                                                                                                                                                   │
│   default        },                                                                                                                                                                                                                                         │
│   default        sessionId: 'a4d508c55b90ef7466c54a735b6f1c89'                                                                                                                                                                                              │
│   default      }                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default Using: chrome (117.0.5938.150) on WINDOWS.                                                                                                                                                                                                        │
│   default Received session with ID: a4d508c55b90ef7466c54a735b6f1c89                                                                                                                                                                                        │
│   default                                                                                                                                                                                                                                                   │
│   default → Running [before]:                                                                                                                                                                                                                               │
│   default → Completed [before].                                                                                                                                                                                                                             │
│   default – wait for not                                                                                                                                                                                                                                    │
│   default → Running [beforeEach]:                                                                                                                                                                                                                           │
│   default → Completed [beforeEach].                                                                                                                                                                                                                         │
│   default → Running command: url ('https://www.nightwatchjs.org')                                                                                                                                                                                           │
│   default - Loading url: https://www.nightwatchjs.org                                                                                                                                                                                                       │
│   default   Request POST /session/a4d508c55b90ef7466c54a735b6f1c89/url                                                                                                                                                                                      │
│   default { url: 'https://www.nightwatchjs.org' }                                                                                                                                                                                                           │
│   default   Response 200 POST /session/a4d508c55b90ef7466c54a735b6f1c89/url (2249ms)                                                                                                                                                                        │
│   default { value: null }                                                                                                                                                                                                                                   │
│   default ℹ Loaded url https://www.nightwatchjs.org in 2251ms                                                                                                                                                                                               │
│   default → Completed command: url ('https://www.nightwatchjs.org') (2252ms)                                                                                                                                                                                │
│   default → Running command: waitForElementNotVisible ('#header', 1000, 100, false)                                                                                                                                                                         │
│   default   Request POST /session/a4d508c55b90ef7466c54a735b6f1c89/elements                                                                                                                                                                                 │
│   default { using: 'css selector', value: '#header' }                                                                                                                                                                                                       │
│   default   Response 200 POST /session/a4d508c55b90ef7466c54a735b6f1c89/elements (11ms)                                                                                                                                                                     │
│   default {                                                                                                                                                                                                                                                 │
│   default      value: [                                                                                                                                                                                                                                     │
│   default        {                                                                                                                                                                                                                                          │
│   default          'element-6066-11e4-a52e-4f735466cecf': '6B589FC67F868155674D785C24185514_element_38'                                                                                                                                                     │
│   default        }                                                                                                                                                                                                                                          │
│   default      ]                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default   Request POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync                                                                                                                                                                             │
│   default {                                                                                                                                                                                                                                                 │
│   default      script: '/* isDisplayed */return (function(){return (function(){var k=this||self;function aa(a){return"string"==typeof a}function ba(a,b){a=a.split(".");var c=k;a[0]in c||"undefined"==typeof c.execScript||c.ex... (44044 characters)',    │
│   default      args: [                                                                                                                                                                                                                                      │
│   default        {                                                                                                                                                                                                                                          │
│   default          'element-6066-11e4-a52e-4f735466cecf': '6B589FC67F868155674D785C24185514_element_38',                                                                                                                                                    │
│   default          ELEMENT: '6B589FC67F868155674D785C24185514_element_38'                                                                                                                                                                                   │
│   default        }                                                                                                                                                                                                                                          │
│   default      ]                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default   Response 200 POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync (12ms)                                                                                                                                                                 │
│   default { value: true }                                                                                                                                                                                                                                   │
│   default   Request POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync                                                                                                                                                                             │
│   default {                                                                                                                                                                                                                                                 │
│   default      script: '/* isDisplayed */return (function(){return (function(){var k=this||self;function aa(a){return"string"==typeof a}function ba(a,b){a=a.split(".");var c=k;a[0]in c||"undefined"==typeof c.execScript||c.ex... (44044 characters)',    │
│   default      args: [                                                                                                                                                                                                                                      │
│   default        {                                                                                                                                                                                                                                          │
│   default          'element-6066-11e4-a52e-4f735466cecf': '6B589FC67F868155674D785C24185514_element_38',                                                                                                                                                    │
│   default          ELEMENT: '6B589FC67F868155674D785C24185514_element_38'                                                                                                                                                                                   │
│   default        }                                                                                                                                                                                                                                          │
│   default      ]                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default   Response 200 POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync (12ms)                                                                                                                                                                 │
│   default { value: true }                                                                                                                                                                                                                                   │
│   default   Request POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync                                                                                                                                                                             │
│   default {                                                                                                                                                                                                                                                 │
│   default      script: '/* isDisplayed */return (function(){return (function(){var k=this||self;function aa(a){return"string"==typeof a}function ba(a,b){a=a.split(".");var c=k;a[0]in c||"undefined"==typeof c.execScript||c.ex... (44044 characters)',    │
│   default      args: [                                                                                                                                                                                                                                      │
│   default        {                                                                                                                                                                                                                                          │
│   default          'element-6066-11e4-a52e-4f735466cecf': '6B589FC67F868155674D785C24185514_element_38',                                                                                                                                                    │
│   default          ELEMENT: '6B589FC67F868155674D785C24185514_element_38'                                                                                                                                                                                   │
│   default        }                                                                                                                                                                                                                                          │
│   default      ]                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default   Response 200 POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync (10ms)                                                                                                                                                                 │
│   default { value: true }                                                                                                                                                                                                                                   │
│   default   Request POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync                                                                                                                                                                             │
│   default {                                                                                                                                                                                                                                                 │
│   default      script: '/* isDisplayed */return (function(){return (function(){var k=this||self;function aa(a){return"string"==typeof a}function ba(a,b){a=a.split(".");var c=k;a[0]in c||"undefined"==typeof c.execScript||c.ex... (44044 characters)',    │
│   default      args: [                                                                                                                                                                                                                                      │
│   default        {                                                                                                                                                                                                                                          │
│   default          'element-6066-11e4-a52e-4f735466cecf': '6B589FC67F868155674D785C24185514_element_38',                                                                                                                                                    │
│   default          ELEMENT: '6B589FC67F868155674D785C24185514_element_38'                                                                                                                                                                                   │
│   default        }                                                                                                                                                                                                                                          │
│   default      ]                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default   Response 200 POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync (10ms)                                                                                                                                                                 │
│   default { value: true }                                                                                                                                                                                                                                   │
│   default   Request POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync                                                                                                                                                                             │
│   default {                                                                                                                                                                                                                                                 │
│   default      script: '/* isDisplayed */return (function(){return (function(){var k=this||self;function aa(a){return"string"==typeof a}function ba(a,b){a=a.split(".");var c=k;a[0]in c||"undefined"==typeof c.execScript||c.ex... (44044 characters)',    │
│   default      args: [                                                                                                                                                                                                                                      │
│   default        {                                                                                                                                                                                                                                          │
│   default          'element-6066-11e4-a52e-4f735466cecf': '6B589FC67F868155674D785C24185514_element_38',                                                                                                                                                    │
│   default          ELEMENT: '6B589FC67F868155674D785C24185514_element_38'                                                                                                                                                                                   │
│   default        }                                                                                                                                                                                                                                          │
│   default      ]                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default   Response 200 POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync (10ms)                                                                                                                                                                 │
│   default { value: true }                                                                                                                                                                                                                                   │
│   default   Request POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync                                                                                                                                                                             │
│   default {                                                                                                                                                                                                                                                 │
│   default      script: '/* isDisplayed */return (function(){return (function(){var k=this||self;function aa(a){return"string"==typeof a}function ba(a,b){a=a.split(".");var c=k;a[0]in c||"undefined"==typeof c.execScript||c.ex... (44044 characters)',    │
│   default      args: [                                                                                                                                                                                                                                      │
│   default        {                                                                                                                                                                                                                                          │
│   default          'element-6066-11e4-a52e-4f735466cecf': '6B589FC67F868155674D785C24185514_element_38',                                                                                                                                                    │
│   default          ELEMENT: '6B589FC67F868155674D785C24185514_element_38'                                                                                                                                                                                   │
│   default        }                                                                                                                                                                                                                                          │
│   default      ]                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default   Response 200 POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync (10ms)                                                                                                                                                                 │
│   default { value: true }                                                                                                                                                                                                                                   │
│   default   Request POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync                                                                                                                                                                             │
│   default {                                                                                                                                                                                                                                                 │
│   default      script: '/* isDisplayed */return (function(){return (function(){var k=this||self;function aa(a){return"string"==typeof a}function ba(a,b){a=a.split(".");var c=k;a[0]in c||"undefined"==typeof c.execScript||c.ex... (44044 characters)',    │
│   default      args: [                                                                                                                                                                                                                                      │
│   default        {                                                                                                                                                                                                                                          │
│   default          'element-6066-11e4-a52e-4f735466cecf': '6B589FC67F868155674D785C24185514_element_38',                                                                                                                                                    │
│   default          ELEMENT: '6B589FC67F868155674D785C24185514_element_38'                                                                                                                                                                                   │
│   default        }                                                                                                                                                                                                                                          │
│   default      ]                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default   Response 200 POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync (9ms)                                                                                                                                                                  │
│   default { value: true }                                                                                                                                                                                                                                   │
│   default   Request POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync                                                                                                                                                                             │
│   default {                                                                                                                                                                                                                                                 │
│   default      script: '/* isDisplayed */return (function(){return (function(){var k=this||self;function aa(a){return"string"==typeof a}function ba(a,b){a=a.split(".");var c=k;a[0]in c||"undefined"==typeof c.execScript||c.ex... (44044 characters)',    │
│   default      args: [                                                                                                                                                                                                                                      │
│   default        {                                                                                                                                                                                                                                          │
│   default          'element-6066-11e4-a52e-4f735466cecf': '6B589FC67F868155674D785C24185514_element_38',                                                                                                                                                    │
│   default          ELEMENT: '6B589FC67F868155674D785C24185514_element_38'                                                                                                                                                                                   │
│   default        }                                                                                                                                                                                                                                          │
│   default      ]                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default   Response 200 POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync (8ms)                                                                                                                                                                  │
│   default { value: true }                                                                                                                                                                                                                                   │
│   default   Request POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync                                                                                                                                                                             │
│   default {                                                                                                                                                                                                                                                 │
│   default      script: '/* isDisplayed */return (function(){return (function(){var k=this||self;function aa(a){return"string"==typeof a}function ba(a,b){a=a.split(".");var c=k;a[0]in c||"undefined"==typeof c.execScript||c.ex... (44044 characters)',    │
│   default      args: [                                                                                                                                                                                                                                      │
│   default        {                                                                                                                                                                                                                                          │
│   default          'element-6066-11e4-a52e-4f735466cecf': '6B589FC67F868155674D785C24185514_element_38',                                                                                                                                                    │
│   default          ELEMENT: '6B589FC67F868155674D785C24185514_element_38'                                                                                                                                                                                   │
│   default        }                                                                                                                                                                                                                                          │
│   default      ]                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default   Response 200 POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync (9ms)                                                                                                                                                                  │
│   default { value: true }                                                                                                                                                                                                                                   │
│   default   Request POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync                                                                                                                                                                             │
│   default {                                                                                                                                                                                                                                                 │
│   default      script: '/* isDisplayed */return (function(){return (function(){var k=this||self;function aa(a){return"string"==typeof a}function ba(a,b){a=a.split(".");var c=k;a[0]in c||"undefined"==typeof c.execScript||c.ex... (44044 characters)',    │
│   default      args: [                                                                                                                                                                                                                                      │
│   default        {                                                                                                                                                                                                                                          │
│   default          'element-6066-11e4-a52e-4f735466cecf': '6B589FC67F868155674D785C24185514_element_38',                                                                                                                                                    │
│   default          ELEMENT: '6B589FC67F868155674D785C24185514_element_38'                                                                                                                                                                                   │
│   default        }                                                                                                                                                                                                                                          │
│   default      ]                                                                                                                                                                                                                                            │
│   default   }                                                                                                                                                                                                                                               │
│   default   Response 200 POST /session/a4d508c55b90ef7466c54a735b6f1c89/execute/sync (9ms)                                                                                                                                                                  │
│   default { value: true }                                                                                                                                                                                                                                   │
│   default ✖ NightwatchAssertError                                                                                                                                                                                                                           │
│   default    Timed out while waiting for element <#header> to not be visible for 1000 milliseconds. - expected "not visible" but got: "visible" (1116ms)                                                                                                    │
│   default                                                                                                                                                                                                                                                   │
│   default     Error location:                                                                                                                                                                                                                               │
│   default     C:\Users\Mr\Desktop\temp\nightwatch\waitForIt.ts:                                                                                                                                                                                             │
│   default     ––––––––––––––––––––––––––––––––––––––––––––––––––                                                                                                                                                                                            │
│   default      4 |   'wait for not': () => {                                                                                                                                                                                                                │
│   default      5 |     browser.url('https://www.nightwatchjs.org');                                                                                                                                                                                         │
│   default      6 |     browser.waitForElementNotVisible('#header', 1000, 100, false);                                                                                                                                                                       │
│   default      7 |   },                                                                                                                                                                                                                                     │
│   default      8 |   'wait for': () => {                                                                                                                                                                                                                    │
│   default     ––––––––––––––––––––––––––––––––––––––––––––––––––                                                                                                                                                                                            │
│   default → Completed command: waitForElementNotVisible ('#header', 1000, 100, false) (1120ms)                                                                                                                                                              │
│   default → Running [afterEach]:                                                                                                                                                                                                                            │
│   default → Completed [afterEach].                                                                                                                                                                                                                          │
│   default × default [Nightwatch\wait For It] wait for not (3.456s)                                                                                                                                                                                          │
│   default    Timed out while waiting for element <#header> to not be visible for 1000 milliseconds. - expected "not visible" but got: "visible" (1116ms)                                                                                                    │
│   default        at Object.wait for not (C:\Users\Mr\Desktop\temp\nightwatch\waitForIt.ts:6:13)                                                                                                                                                             │
│   default → Running [after]:                                                                                                                                                                                                                                │
│   default → Completed [after].                                                                                                                                                                                                                              │
│   default → Running command: end (true)                                                                                                                                                                                                                     │
│   default → Running command: session ('delete', [Function])                                                                                                                                                                                                 │
│   default   Request DELETE /session/a4d508c55b90ef7466c54a735b6f1c89                                                                                                                                                                                        │
│   default   Response 200 DELETE /session/a4d508c55b90ef7466c54a735b6f1c89 (52ms)                                                                                                                                                                            │
│   default { value: null }                                                                                                                                                                                                                                   │
│   default → Completed command: end (true) (72ms)                                                                                                                                                                                                            │
│   default → Completed command: session ('delete', [Function]) (57ms)                                                                                                                                                                                        │
│                                                                                                                                                                                                                                                             │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  ️TEST FAILURE (6.114s):
   - 1 assertions failed; 0 passed
   - 1 skipped

   × 1) nightwatch\waitForIt

   – wait for not (3.456s)

   → ✖ NightwatchAssertError
   Timed out while waiting for element <#header> to not be visible for 1000 milliseconds. - expected "not visible" but got: "visible" (1116ms)

    Error location:
    C:\Users\Mr\Desktop\temp\nightwatch\waitForIt.ts:
    ––––––––––––––––––––––––––––––––––––––––––––––––––
     4 |   'wait for not': () => {
     5 |     browser.url('https://www.nightwatchjs.org');
     6 |     browser.waitForElementNotVisible('#header', 1000, 100, false);
     7 |   },
     8 |   'wait for': () => {
    ––––––––––––––––––––––––––––––––––––––––––––––––––

    SKIPPED (at runtime):
    - wait for

 Wrote HTML report file to: C:\Users\Mr\Desktop\temp\tests_output\nightwatch-html-report\index.html

 Wrote Rerun Json report file to: C:\Users\Mr\Desktop\temp\tests_output\minimal_report.json
 Wrote JSON report file to: C:\Users\Mr\Desktop\temp\tests_output\nightwatch\CHROME_117.0.5938.150__waitForIt.json
 Wrote XML report file to: C:\Users\Mr\Desktop\temp\tests_output\nightwatch\CHROME_117.0.5938.150__waitForIt.xml

Nightwatch Configuration

// Refer to the online docs for more details:
// https://nightwatchjs.org/gettingstarted/configuration/
//

//  _   _  _         _      _                     _          _
// | \ | |(_)       | |    | |                   | |        | |
// |  \| | _   __ _ | |__  | |_ __      __  __ _ | |_   ___ | |__
// | . ` || | / _` || '_ \ | __|\ \ /\ / / / _` || __| / __|| '_ \
// | |\  || || (_| || | | || |_  \ V  V / | (_| || |_ | (__ | | | |
// \_| \_/|_| \__, ||_| |_| \__|  \_/\_/   \__,_| \__| \___||_| |_|
//             __/ |
//            |___/

module.exports = {
  // An array of folders (excluding subfolders) where your tests are located;
  // if this is not specified, the test source must be passed as the second argument to the test runner.
  src_folders: ['test','nightwatch'],

  // See https://nightwatchjs.org/guide/concepts/page-object-model.html
  page_objects_path: [],

  // See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html
  custom_commands_path: [],

  // See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-assertions.html
  custom_assertions_path: [],

  // See https://nightwatchjs.org/guide/extending-nightwatch/adding-plugins.html
  plugins: [],

  // See https://nightwatchjs.org/guide/concepts/test-globals.html
  globals_path: '',

  webdriver: {},

  test_workers: {
    enabled: true
  },

  test_settings: {
    default: {
      disable_error_log: false,
      launch_url: 'http://localhost',

      screenshots: {
        enabled: false,
        path: 'screens',
        on_failure: true
      },

      desiredCapabilities: {
        browserName: 'chrome'
      },

      webdriver: {
        start_process: true,
        server_path: ''
      },

    },

    chrome: {
      desiredCapabilities: {
        browserName: 'chrome',
        'goog:chromeOptions': {
          // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
          //
          // w3c:false tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
          w3c: true,
          args: [
            //'--no-sandbox',
            //'--ignore-certificate-errors',
            //'--allow-insecure-localhost',
            //'--headless'
          ]
        }
      },

      webdriver: {
        start_process: true,
        server_path: '',
        cli_args: [
          // --verbose
        ]
      }
    },

  },

};

Nightwatch.js Version

3.2.1

Node Version

18.16.0

Browser

Chrome 117

Operating System

Windows 10

Additional Information

image

reallymello commented 1 year ago

Here is a zip of the entire test project

exampleRepo.zip

reallymello commented 1 year ago

I also want to clarify my expectation is that on reporting that if the waitFor fails with abortOnFailure false that the test is still considered passing as well

reallymello commented 1 year ago

https://nightwatchjs.org/api/waitForElementVisible.html#waitForElementVisible

image

gravityvi commented 1 year ago

WaitForElement commands always had hard asserts. For soft asserts we can use verify. We need to change the documentation.

gravityvi commented 1 year ago

Raised a PR to fix the doc: https://github.com/nightwatchjs/nightwatch/pull/3934

gravityvi commented 1 year ago

Closing this issue as this is not an actual problem. There is a problem related to it which is explained in this #3939