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.32k forks source link

If the last `verify` command inside an `it-block` fails, the rest of tests are skipped. #3513

Closed swrdfish closed 1 year ago

swrdfish commented 1 year ago

Description of the bug/issue

If the last verify command inside an it-block fails, the rest of tests are skipped. Ideally the tests should keep running.

Steps to reproduce

Run the provided test.

Sample test

describe('Ecosia.org Demo', function() {

  before(browser => {
    browser
      .navigateTo('https://www.ecosia.org/');
  });

  it('Demo test ecosia.org pass', function(browser) {
    browser
      .waitForElementVisible('body')
      .assert.titleContains('Ecosia')
      .assert.visible('input[type=search]')
      .setValue('input[type=search]', 'nightwatch')
      .assert.visible('button[type=submit]')
      .click('button[type=submit]')
      .verify.textContains('.layout__content', 'foo');
  });

  it('Demo test ecosia.org fail', function(browser) {
    browser
      .waitForElementVisible('body');
  });

  after(browser => browser.end());
});

Command to run

nightwatch test/sampleTest.js

Verbose Output

[Ecosia.org Demo] Test Suite
────────────────────────────────────────────────────────
 Starting ChromeDriver with server_path=/Users/binayakghosh/projects/nightwatch/node_modules/chromedriver/lib/chromedriver/chromedriver...
   Request POST /session  
   {
     capabilities: {
       firstMatch: [ {} ],
       alwaysMatch: {
         browserName: 'chrome',
         'goog:chromeOptions': { w3c: true, args: [] }
       }
     }
  }
   Response 200 POST /session (1160ms)
   {
     value: {
       capabilities: {
         acceptInsecureCerts: false,
         browserName: 'chrome',
         browserVersion: '108.0.5359.98',
         chrome: {
           chromedriverVersion: '107.0.5304.62 (1eec40d3a5764881c92085aaee66d25075c159aa-refs/branch-heads/5304@{#942})',
           userDataDir: '/var/folders/c4/v7pl5j0s34qg1yb4b34_lg300000gq/T/.com.google.Chrome.31xNul'
         },
         'goog:chromeOptions': { debuggerAddress: 'localhost:51193' },
         networkConnectionEnabled: false,
         pageLoadStrategy: 'normal',
         platformName: 'mac os x',
         proxy: {},
         setWindowRect: true,
         strictFileInteractability: false,
         timeouts: { implicit: 0, pageLoad: 300000, script: 30000 },
         unhandledPromptBehavior: 'dismiss and notify',
         'webauthn:extension:credBlob': true,
         'webauthn:extension:largeBlob': true,
         'webauthn:virtualAuthenticators': true
       },
       sessionId: 'd8f15edea24521a6d6820a972acfffc4'
     }
  }
  Using: chrome (108.0.5359.98) on MAC OS X.

 Received session with ID: d8f15edea24521a6d6820a972acfffc4

 → Running [before]:

 → Running command: navigateTo ('https://www.ecosia.org/')
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/url  
   { url: 'https://www.ecosia.org/' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/url (3364ms)
   { value: null }
  → Completed command: navigateTo ('https://www.ecosia.org/') (3366ms)
 → Completed [before].

  Running Demo test ecosia.org pass:
───────────────────────────────────────────────────────────────────────────────────────────────────
 → Running [beforeEach]:
 → Completed [beforeEach].

 → Running command: waitForElementVisible ('body')
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: 'body' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (13ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '9513f290-3001-4c3c-8619-d2650af7aaa5'
       }
     ]
  }
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/execute/sync  
   {
     script: '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.execScript("var "+a... (44027 characters)',
     args: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '9513f290-3001-4c3c-8619-d2650af7aaa5',
         ELEMENT: '9513f290-3001-4c3c-8619-d2650af7aaa5'
       }
     ]
  }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/execute/sync (17ms)
   { value: true }
  ✔ Element <body> was visible after 33 milliseconds.
  → Completed command: waitForElementVisible ('body') (36ms)

 → Running command: assert.titleContains ('Ecosia')

 → Running command: title ([Function])
   Request GET /session/d8f15edea24521a6d6820a972acfffc4/title  

   Response 200 GET /session/d8f15edea24521a6d6820a972acfffc4/title (5ms)
   { value: 'Ecosia - the search engine that plants trees' }
  ✔ Testing if the page title contains 'Ecosia' (9ms)
  → Completed command: title ([Function]) (7ms)
  → Completed command: assert.titleContains ('Ecosia') (12ms)

 → Running command: assert.visible ('input[type=search]')

 → Running command: isVisible ({selector, suppressNotFoundErrors}, [Function])
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: 'input[type=search]' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (9ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '9e8a382c-0d24-4925-8489-0c1816266cb5'
       }
     ]
  }
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/execute/sync  
   {
     script: '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.execScript("var "+a... (44027 characters)',
     args: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '9e8a382c-0d24-4925-8489-0c1816266cb5',
         ELEMENT: '9e8a382c-0d24-4925-8489-0c1816266cb5'
       }
     ]
  }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/execute/sync (14ms)
   { value: true }
  ✔ Testing if element <input[type=search]> is visible (29ms)
  → Completed command: isVisible ({selector, suppressNotFoundErrors}, [Function]) (28ms)
  → Completed command: assert.visible ('input[type=search]') (32ms)

 → Running command: setValue ('input[type=search]', 'nightwatch')
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: 'input[type=search]' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (5ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '9e8a382c-0d24-4925-8489-0c1816266cb5'
       }
     ]
  }
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/element/9e8a382c-0d24-4925-8489-0c1816266cb5/clear  
{}
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/element/9e8a382c-0d24-4925-8489-0c1816266cb5/clear (23ms)
   { value: null }
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/element/9e8a382c-0d24-4925-8489-0c1816266cb5/value  
   {
     text: 'nightwatch',
     value: [
       'n', 'i', 'g', 'h',
       't', 'w', 'a', 't',
       'c', 'h'
     ]
  }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/element/9e8a382c-0d24-4925-8489-0c1816266cb5/value (75ms)
   { value: null }
  → Completed command: setValue ('input[type=search]', 'nightwatch') (107ms)

 → Running command: assert.visible ('button[type=submit]')

 → Running command: isVisible ({selector, suppressNotFoundErrors}, [Function])
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: 'button[type=submit]' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (7ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '2b41f791-0685-41ae-ac1a-fe6b3e81d267'
       }
     ]
  }
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/execute/sync  
   {
     script: '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.execScript("var "+a... (44027 characters)',
     args: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '2b41f791-0685-41ae-ac1a-fe6b3e81d267',
         ELEMENT: '2b41f791-0685-41ae-ac1a-fe6b3e81d267'
       }
     ]
  }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/execute/sync (7ms)
   { value: true }
  ✔ Testing if element <button[type=submit]> is visible (18ms)
  → Completed command: isVisible ({selector, suppressNotFoundErrors}, [Function]) (17ms)
  → Completed command: assert.visible ('button[type=submit]') (19ms)

 → Running command: click ('button[type=submit]')
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: 'button[type=submit]' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (5ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '2b41f791-0685-41ae-ac1a-fe6b3e81d267'
       }
     ]
  }
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/element/2b41f791-0685-41ae-ac1a-fe6b3e81d267/click  
{}
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/element/2b41f791-0685-41ae-ac1a-fe6b3e81d267/click (3854ms)
   { value: null }
  → Completed command: click ('button[type=submit]') (3862ms)

 → Running command: verify.textContains ('.layout__content', 'foo')

 → Running command: getText ({selector, suppressNotFoundErrors}, [Function])
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: '.layout__content' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (6ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '6ee19519-2b0c-4103-87c3-e095d595f59f'
       }
     ]
  }
   Request GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text  

   Response 200 GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text (68ms)
   {
     value: 'Search\n' +
       'https://nightwatchjs.org\n' +
       'Nightwatch.js | Node.js powered End-to-End testing framework\n' +
       'Nightwa...',
     suppressBase64Data: true
  }
  → Completed command: getText ({selector, suppressNotFoundErrors}, [Function]) (77ms)

 → Running command: getText ({selector, suppressNotFoundErrors}, [Function])
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: '.layout__content' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (19ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '6ee19519-2b0c-4103-87c3-e095d595f59f'
       }
     ]
  }
   Request GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text  

   Response 200 GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text (78ms)
   {
     value: 'Search\n' +
       'https://nightwatchjs.org\n' +
       'Nightwatch.js | Node.js powered End-to-End testing framework\n' +
       'Nightwa...',
     suppressBase64Data: true
  }
  → Completed command: getText ({selector, suppressNotFoundErrors}, [Function]) (101ms)

 → Running command: getText ({selector, suppressNotFoundErrors}, [Function])
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: '.layout__content' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (12ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '6ee19519-2b0c-4103-87c3-e095d595f59f'
       }
     ]
  }
   Request GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text  

   Response 200 GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text (81ms)
   {
     value: 'Search\n' +
       'https://nightwatchjs.org\n' +
       'Nightwatch.js | Node.js powered End-to-End testing framework\n' +
       'Nightwa...',
     suppressBase64Data: true
  }
  → Completed command: getText ({selector, suppressNotFoundErrors}, [Function]) (95ms)

 → Running command: getText ({selector, suppressNotFoundErrors}, [Function])
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: '.layout__content' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (7ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '6ee19519-2b0c-4103-87c3-e095d595f59f'
       }
     ]
  }
   Request GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text  

   Response 200 GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text (93ms)
   {
     value: 'Search\n' +
       'https://nightwatchjs.org\n' +
       'Nightwatch.js | Node.js powered End-to-End testing framework\n' +
       'Nightwa...',
     suppressBase64Data: true
  }
  → Completed command: getText ({selector, suppressNotFoundErrors}, [Function]) (103ms)

 → Running command: getText ({selector, suppressNotFoundErrors}, [Function])
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: '.layout__content' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (6ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '6ee19519-2b0c-4103-87c3-e095d595f59f'
       }
     ]
  }
   Request GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text  

   Response 200 GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text (78ms)
   {
     value: 'Search\n' +
       'https://nightwatchjs.org\n' +
       'Nightwatch.js | Node.js powered End-to-End testing framework\n' +
       'Nightwa...',
     suppressBase64Data: true
  }
  → Completed command: getText ({selector, suppressNotFoundErrors}, [Function]) (86ms)

 → Running command: getText ({selector, suppressNotFoundErrors}, [Function])
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: '.layout__content' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (7ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '6ee19519-2b0c-4103-87c3-e095d595f59f'
       }
     ]
  }
   Request GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text  

   Response 200 GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text (68ms)
   {
     value: 'Search\n' +
       'https://nightwatchjs.org\n' +
       'Nightwatch.js | Node.js powered End-to-End testing framework\n' +
       'Nightwa...',
     suppressBase64Data: true
  }
  → Completed command: getText ({selector, suppressNotFoundErrors}, [Function]) (77ms)

 → Running command: getText ({selector, suppressNotFoundErrors}, [Function])
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: '.layout__content' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (13ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '6ee19519-2b0c-4103-87c3-e095d595f59f'
       }
     ]
  }
   Request GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text  

   Response 200 GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text (79ms)
   {
     value: 'Search\n' +
       'https://nightwatchjs.org\n' +
       'Nightwatch.js | Node.js powered End-to-End testing framework\n' +
       'Nightwa...',
     suppressBase64Data: true
  }
  → Completed command: getText ({selector, suppressNotFoundErrors}, [Function]) (95ms)

 → Running command: getText ({selector, suppressNotFoundErrors}, [Function])
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: '.layout__content' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (11ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '6ee19519-2b0c-4103-87c3-e095d595f59f'
       }
     ]
  }
   Request GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text  

   Response 200 GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text (80ms)
   {
     value: 'Search\n' +
       'https://nightwatchjs.org\n' +
       'Nightwatch.js | Node.js powered End-to-End testing framework\n' +
       'Nightwa...',
     suppressBase64Data: true
  }
  → Completed command: getText ({selector, suppressNotFoundErrors}, [Function]) (93ms)

 → Running command: getText ({selector, suppressNotFoundErrors}, [Function])
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: '.layout__content' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (6ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '6ee19519-2b0c-4103-87c3-e095d595f59f'
       }
     ]
  }
   Request GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text  

   Response 200 GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text (84ms)
   {
     value: 'Search\n' +
       'https://nightwatchjs.org\n' +
       'Nightwatch.js | Node.js powered End-to-End testing framework\n' +
       'Nightwa...',
     suppressBase64Data: true
  }
  → Completed command: getText ({selector, suppressNotFoundErrors}, [Function]) (93ms)

 → Running command: getText ({selector, suppressNotFoundErrors}, [Function])
   Request POST /session/d8f15edea24521a6d6820a972acfffc4/elements  
   { using: 'css selector', value: '.layout__content' }
   Response 200 POST /session/d8f15edea24521a6d6820a972acfffc4/elements (4ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '6ee19519-2b0c-4103-87c3-e095d595f59f'
       }
     ]
  }
   Request GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text  

   Response 200 GET /session/d8f15edea24521a6d6820a972acfffc4/element/6ee19519-2b0c-4103-87c3-e095d595f59f/text (56ms)
   {
     value: 'Search\n' +
       'https://nightwatchjs.org\n' +
       'Nightwatch.js | Node.js powered End-to-End testing framework\n' +
       'Nightwa...',
     suppressBase64Data: true
  }
  ✖ NightwatchAssertError
   Testing if element <.layout__content> contains text 'foo' in 5000ms - expected "contains text 'foo'" but got: "does not contain 'foo'" (5406ms)

    Error location:
    /Users/binayakghosh/projects/nightwatch/lib/api/index.js:
    ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
     147 |           }
     148 | 
     149 |           return target[name]({negate: false, args}); 
     150 |         };
     151 |       }
    ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

  → Completed command: getText ({selector, suppressNotFoundErrors}, [Function]) (64ms)
  → Completed command: verify.textContains ('.layout__content', 'foo') (5410ms)
 → Running [afterEach]:
 → Completed [afterEach].

  FAILED: 1 assertions failed and  4 passed (9.534s)
 → Running [after]:

 → Running command: end ()

 → Running command: session ('delete', [Function])
   Request DELETE /session/d8f15edea24521a6d6820a972acfffc4  

   Response 200 DELETE /session/d8f15edea24521a6d6820a972acfffc4 (53ms)
   { value: null }
  → Completed command: session ('delete', [Function]) (54ms)
 Wrote log file to: /Users/binayakghosh/projects/nightwatch/logs/ecosia_chromedriver.log.
  → Completed command: end () (58ms)
 → Completed [after].

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

  ️TEST FAILURE (14.283s):  
   - 1 assertions failed; 4 passed
   - 1 skipped

   ✖ 1) ecosia

   – Demo test ecosia.org pass (9.534s)

   → ✖ NightwatchAssertError
   Testing if element <.layout__content> contains text 'foo' in 5000ms - expected "contains text 'foo'" but got: "does not contain 'foo'" (5406ms)

    Error location:
    /Users/binayakghosh/projects/nightwatch/examples/tests/ecosia.js:
    ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
     14 |       .assert.visible('button[type=submit]')
     15 |       .click('button[type=submit]')
     16 |       .verify.textContains('.layout__content', 'foo'); 
     17 |   });
     18 | 
    ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

    SKIPPED:
    - Demo test ecosia.org fail

 ChromeDriver process closed.
 Wrote XML report file to: /Users/binayakghosh/projects/nightwatch/tests_output/CHROME_108.0.5359.98__ecosia.xml
 Wrote JSON report file to: /Users/binayakghosh/projects/nightwatch/tests_output/CHROME_108.0.5359.98__ecosia.json
 Wrote HTML report file to: /Users/binayakghosh/projects/nightwatch/tests_output/nightwatch-html-report/index.html

Nightwatch Configuration

//
// Refer to the online docs for more details:
// https://nightwatchjs.org/guide/configuration/nightwatch-configuration-file.html
//
//  _   _  _         _      _                     _          _
// | \ | |(_)       | |    | |                   | |        | |
// |  \| | _   __ _ | |__  | |_ __      __  __ _ | |_   ___ | |__
// | . ` || | / _` || '_ \ | __|\ \ /\ / / / _` || __| / __|| '_ \
// | |\  || || (_| || | | || |_  \ 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: [],

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

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

  // 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#external-test-globals
  // globals_path: '../nightwatch-demo/lib/globals.js',

  globals: {
    abortOnElementLocateError: true
  },

  webdriver: {},

  test_workers: {
    enabled: true,
    workers: 'auto'
  },

  test_settings: {
    default: {
      disable_error_log: false,
      launch_url: 'https://nightwatchjs.org',

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

      desiredCapabilities: {
        browserName : 'firefox'
      },

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

    safari: {
      desiredCapabilities : {
        browserName : 'safari',
        alwaysMatch: {
          acceptInsecureCerts: false
        }
      },
      webdriver: {
        start_process: true,
        server_path: ''
      }
    },

    firefox: {
      desiredCapabilities : {
        browserName : 'firefox',
        alwaysMatch: {
          acceptInsecureCerts: true,
          'moz:firefoxOptions': {
            args: [
              // '-headless',
              // '-verbose'
            ]
          }
        }
      },
      webdriver: {
        start_process: true,
        server_path: '',
        cli_args: [
          // very verbose geckodriver logs
          // '-vv'
        ]
      }
    },

    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
        ]
      }
    },

    edge: {
      desiredCapabilities : {
        browserName : 'MicrosoftEdge',
        'ms:edgeOptions' : {
          w3c: true,
          // More info on EdgeDriver: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options
          args: [
            //'--headless'
          ]
        }
      },

      webdriver: {
        start_process: true,
        // Download msedgedriver from https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/
        //  and set the location below:
        server_path: '',
        cli_args: [
          // --verbose
        ]
      }
    },

    //////////////////////////////////////////////////////////////////////////////////
    // Configuration for when using cucumber-js (https://cucumber.io)                |
    //                                                                               |
    // It uses the bundled examples inside the nightwatch examples folder; feel free |
    // to adapt this to your own project needs                                       |
    //////////////////////////////////////////////////////////////////////////////////
    'cucumber-js': {
      extends: 'chrome',

      src_folders: ['examples/cucumber-js/features/step_definitions'],

      test_runner: {
        // set cucumber as the runner
        type: 'cucumber',

        // define cucumber specific options
        options: {
          //set the feature path
          feature_path: 'examples/cucumber-js/*/*.feature'

          // start the webdriver session automatically (enabled by default)
          // auto_start_session: true

          // use parallel execution in Cucumber
          // workers: 2 // set number of workers to use (can also be defined in the cli as --workers=2
        }
      }
    },

    //////////////////////////////////////////////////////////////////////////////////
    // Configuration for when using the browserstack.com cloud service               |
    //                                                                               |
    // Please set the username and access key by setting the environment variables:  |
    // - BROWSERSTACK_USERNAME                                                       |
    // - BROWSERSTACK_ACCESS_KEY                                                     |
    // .env files are supported                                                      |
    //////////////////////////////////////////////////////////////////////////////////
    browserstack: {
      selenium: {
        host: 'hub.browserstack.com',
        port: 443
      },
      // More info on configuring capabilities can be found on:
      // https://www.browserstack.com/automate/capabilities?tag=selenium-4
      desiredCapabilities: {
        'bstack:options' : {
          userName: '${BROWSERSTACK_USERNAME}',
          accessKey: '${BROWSERSTACK_ACCESS_KEY}',
        }
      },

      disable_error_log: true,
      webdriver: {
        timeout_options: {
          timeout: 15000,
          retry_attempts: 3
        },
        keep_alive: true,
        start_process: false
      }
    },

    'browserstack.local': {
      extends: 'browserstack',
      desiredCapabilities: {
        'browserstack.local': true
      }
    },

    'browserstack.chrome': {
      extends: 'browserstack',
      desiredCapabilities: {
        browserName: 'chrome',
        chromeOptions : {
          w3c: true
        }
      }
    },

    'browserstack.firefox': {
      extends: 'browserstack',
      desiredCapabilities: {
        browserName: 'firefox'
      }
    },

    'browserstack.ie': {
      extends: 'browserstack',
      desiredCapabilities: {
        browserName: 'internet explorer',
        browserVersion: '11.0'
      }
    },

    'browserstack.safari': {
      extends: 'browserstack',
      desiredCapabilities: {
        browserName: 'safari'
      }
    },

    'browserstack.local_chrome': {
      extends: 'browserstack.local',
      desiredCapabilities: {
        browserName: 'chrome'
      }
    },

    'browserstack.local_firefox': {
      extends: 'browserstack.local',
      desiredCapabilities: {
        browserName: 'firefox'
      }
    },
    //////////////////////////////////////////////////////////////////////////////////
    // Configuration for when using the SauceLabs cloud service                      |
    //                                                                               |
    // Please set the username and access key by setting the environment variables:  |
    // - SAUCE_USERNAME                                                              |
    // - SAUCE_ACCESS_KEY                                                            |
    //////////////////////////////////////////////////////////////////////////////////
    saucelabs: {
      selenium: {
        host: 'ondemand.saucelabs.com',
        port: 443
      },
      // More info on configuring capabilities can be found on:
      // https://docs.saucelabs.com/dev/test-configuration-options/
      desiredCapabilities: {
        'sauce:options' : {
          username: '${SAUCE_USERNAME}',
          accessKey: '${SAUCE_ACCESS_KEY}',
          screenResolution: '1280x1024'
          // https://docs.saucelabs.com/dev/cli/sauce-connect-proxy/#--region
          // region: 'us-west-1'
          // https://docs.saucelabs.com/dev/test-configuration-options/#tunnelidentifier
          // parentTunnel: '',
          // tunnelIdentifier: '',
        }
      },
      disable_error_log: false,
      webdriver: {
        start_process: false
      }
    },
    'saucelabs.chrome': {
      extends: 'saucelabs',
      desiredCapabilities: {
        browserName: 'chrome',
        browserVersion: 'latest',
        javascriptEnabled: true,
        acceptSslCerts: true,
        timeZone: 'London',
        chromeOptions : {
          w3c: true
        }
      }
    },
    'saucelabs.firefox': {
      extends: 'saucelabs',
      desiredCapabilities: {
        browserName: 'firefox',
        browserVersion: 'latest',
        javascriptEnabled: true,
        acceptSslCerts: true,
        timeZone: 'London'
      }
    },
    //////////////////////////////////////////////////////////////////////////////////
    // Configuration for when using the Selenium service, either locally or remote,  |
    //  like Selenium Grid                                                           |
    //////////////////////////////////////////////////////////////////////////////////
    selenium_server: {
      // Selenium Server is running locally and is managed by Nightwatch
      // Install the NPM package @nightwatch/selenium-server or download the selenium server jar file from https://github.com/SeleniumHQ/selenium/releases/, e.g.: selenium-server-4.1.1.jar
      selenium: {
        start_process: true,
        port: 4444,
        server_path: '', // Leave empty if @nightwatch/selenium-server is installed
        command: 'standalone', // Selenium 4 only
        cli_args: {
          //'webdriver.gecko.driver': '',
          //'webdriver.chrome.driver': ''
        }
      },
      webdriver: {
        start_process: false,
        default_path_prefix: '/wd/hub'
      }
    },

    'selenium.chrome': {
      extends: 'selenium_server',
      desiredCapabilities: {
        browserName: 'chrome',
        chromeOptions : {
          w3c: true
        }
      }
    },

    'selenium.firefox': {
      extends: 'selenium_server',
      desiredCapabilities: {
        browserName: 'firefox',
        'moz:firefoxOptions': {
          args: [
            // '-headless',
            // '-verbose'
          ]
        }
      }
    }
  }
};

Nightwatch.js Version

2.5.2

Node Version

v17.4.0

Browser

Chrome 108.0.5359.98

Operating System

Mac OS Ventura

Additional Information

No response

beatfactor commented 1 year ago

@swrdfish What happens if you set skip_testcases_on_fail to false? The .verify assertions should only control behaviour inside a specific testcase and would not determine if the rest of testcases should fail or not.

swrdfish commented 1 year ago

Same behaviour with skip_testcases_on_fail set to false.

gravityvi commented 1 year ago

Actually, it started breaking from this PR: https://github.com/nightwatchjs/nightwatch/pull/3380/ . The current PR is like a patch. We should fix things in asynctree.js