Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"undefined" appears instead of the environment name in the test output in console (3.0 beta) #3752

Closed
reallymello opened this issue May 24, 2023 · 1 comment · Fixed by #3758

Comments

@reallymello
Copy link
Contributor

Description of the bug/issue

When I run npx nightwatch -e chrome I expect to see my environment name (chrome) logged in the test result in console or "default" if none specified, but when I run my tests in the 3.0.0-beta.1 the environment logs as "undefined"

√ undefined [Example] Can select option (698ms)   

image

Steps to reproduce

  1. Checkout https://github.com/reallymello/nightwatchTutorials/tree/master/nw30typescriptExample
  2. npm install
  3. npx nightwatch -e chrome

This will run under 2.6.21, note "chrome" appears on the last line of the test report in console there followed by the suite name and test
image

  1. npm install nightwatch@3.0.0-beta.1
  2. npm update
  3. npx nightwatch -e chrome

Notice now how that same line shows undefined. Note that if run without an environment default should show there, but in 3.0 even running without an environment specified it will show undefined as well.

image

Sample test

https://github.com/reallymello/nightwatchTutorials/blob/master/nw30typescriptExample/nightwatch/tests/example.ts

Command to run

npx nightwatch

or

npx nightwatch -e chrome

Verbose Output

npx nightwatch -e chrome --verbose
 Now you can run TS tests directly using Nightwatch.
 Launching up to 1 concurrent test worker processes...

Running   chrome: example.ts  

DevTools listening on ws://127.0.0.1:64262/devtools/browser/ce6c0ee2-4091-49db-abe4-d77ab768e259
┌ ────────────────── √  chrome: example.ts  ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                                                                                                                                             │
│   undefined Now you can run TS tests directly using Nightwatch.                                                                                                                                             │
│   undefined [Example] Test Suite                                                                                                                                                                            │
│   undefined ────────────────────────────────────────                                                                                                                                                        │
│   undefined Starting ChromeDriver with server_path=C:\Projects\nightwatchTutorials\nw30typescriptExample\node_modules\chromedriver\lib\chromedriver\chromedriver.exe...                                     │
│   undefined   Request POST /session                                                                                                                                                                         │
│   undefined {                                                                                                                                                                                               │
│   undefined      capabilities: {                                                                                                                                                                            │
│   undefined        firstMatch: [ {} ],                                                                                                                                                                      │
│   undefined        alwaysMatch: {                                                                                                                                                                           │
│   undefined          browserName: 'chrome',                                                                                                                                                                 │
│   undefined          'goog:chromeOptions': { w3c: true, args: [] }                                                                                                                                          │
│   undefined        }                                                                                                                                                                                        │
│   undefined      }                                                                                                                                                                                          │
│   undefined   }                                                                                                                                                                                             │
│   undefined   Response 200 POST /session (674ms)                                                                                                                                                            │
│   undefined {                                                                                                                                                                                               │
│   undefined      value: {                                                                                                                                                                                   │
│   undefined        capabilities: {                                                                                                                                                                          │
│   undefined          acceptInsecureCerts: false,                                                                                                                                                            │
│   undefined          browserName: 'chrome',                                                                                                                                                                 │
│   undefined          browserVersion: '113.0.5672.127',                                                                                                                                                      │
│   undefined          chrome: {                                                                                                                                                                              │
│   undefined            chromedriverVersion: '113.0.5672.63 (0e1a4471d5ae5bf128b1bd8f4d627c8cbd55f70c-refs/branch-heads/5672@{#912})',                                                                       │
│   undefined            userDataDir: 'C:\\Users\\Mr\\AppData\\Local\\Temp\\scoped_dir14660_1534072230'                                                                                                       │
│   undefined          },                                                                                                                                                                                     │
│   undefined          'goog:chromeOptions': { debuggerAddress: 'localhost:64262' },                                                                                                                          │
│   undefined          networkConnectionEnabled: false,                                                                                                                                                       │
│   undefined          pageLoadStrategy: 'normal',                                                                                                                                                            │
│   undefined          platformName: 'windows',                                                                                                                                                               │
│   undefined          proxy: {},                                                                                                                                                                             │
│   undefined          setWindowRect: true,                                                                                                                                                                   │
│   undefined          strictFileInteractability: false,                                                                                                                                                      │
│   undefined          timeouts: { implicit: 0, pageLoad: 300000, script: 30000 },                                                                                                                            │
│   undefined          unhandledPromptBehavior: 'dismiss and notify',                                                                                                                                         │
│   undefined          'webauthn:extension:credBlob': true,                                                                                                                                                   │
│   undefined          'webauthn:extension:largeBlob': true,                                                                                                                                                  │
│   undefined          'webauthn:extension:minPinLength': true,                                                                                                                                               │
│   undefined          'webauthn:extension:prf': true,                                                                                                                                                        │
│   undefined          'webauthn:virtualAuthenticators': true                                                                                                                                                 │
│   undefined        },                                                                                                                                                                                       │
│   undefined        sessionId: 'f53bd88fd97dcea8f1eee61ae01da141'                                                                                                                                            │
│   undefined      }                                                                                                                                                                                          │
│   undefined   }                                                                                                                                                                                             │
│   undefined Using: chrome (113.0.5672.127) on WINDOWS.                                                                                                                                                      │
│   undefined Received session with ID: f53bd88fd97dcea8f1eee61ae01da141                                                                                                                                      │
│   undefined                                                                                                                                                                                                 │
│   undefined → Running [before]:                                                                                                                                                                             │
│   undefined → Completed [before].                                                                                                                                                                           │
│   undefined – Can select option                                                                                                                                                                             │
│   undefined → Running [beforeEach]:                                                                                                                                                                         │
│   undefined → Completed [beforeEach].                                                                                                                                                                       │
│   undefined                                                                                                                                                                                                 │
│   undefined  → Running command: url ('http://the-internet.herokuapp.com/dropdown', )                                                                                                                        │
│   undefined - Loading url: http://the-internet.herokuapp.com/dropdown                                                                                                                                       │
│   undefined   Request POST /session/f53bd88fd97dcea8f1eee61ae01da141/url                                                                                                                                    │
│   undefined { url: 'http://the-internet.herokuapp.com/dropdown' }                                                                                                                                           │
│   undefined   Response 200 POST /session/f53bd88fd97dcea8f1eee61ae01da141/url (693ms)                                                                                                                       │
│   undefined { value: null }                                                                                                                                                                                 │
│   undefined i Loaded url http://the-internet.herokuapp.com/dropdown in 701ms                                                                                                                                │
│   undefined → Completed command: url ('http://the-internet.herokuapp.com/dropdown', ) (702ms)                                                                                                               │
│   undefined                                                                                                                                                                                                 │
│   undefined  → Running command: waitForLoadScreen (10000)                                                                                                                                                   │
│   undefined                                                                                                                                                                                                 │
│   undefined  → Running command: expect.element ('#loadScreenOverlay')                                                                                                                                       │
│   undefined   Request POST /session/f53bd88fd97dcea8f1eee61ae01da141/elements                                                                                                                               │
│   undefined { using: 'css selector', value: '#loadScreenOverlay' }                                                                                                                                          │
│   undefined   Response 200 POST /session/f53bd88fd97dcea8f1eee61ae01da141/elements (25ms)                                                                                                                   │
│   undefined { value: [] }                                                                                                                                                                                   │
│   undefined √ Expected element <#loadScreenOverlay> to not be present in 10000ms - element was not found (30ms)                                                                                             │
│   undefined → Completed command: expect.element ('#loadScreenOverlay') (32ms)                                                                                                                               │
│   undefined → Completed command: waitForLoadScreen (10000) (37ms)                                                                                                                                           │
│   undefined                                                                                                                                                                                                 │
│   undefined  → Running command: expect.element ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...})                   │
│   undefined   Request POST /session/f53bd88fd97dcea8f1eee61ae01da141/elements                                                                                                                               │
│   undefined { using: 'css selector', value: '#dropdown' }                                                                                                                                                   │
│   undefined   Response 200 POST /session/f53bd88fd97dcea8f1eee61ae01da141/elements (33ms)                                                                                                                   │
│   undefined {                                                                                                                                                                                               │
│   undefined      value: [                                                                                                                                                                                   │
│   undefined        {                                                                                                                                                                                        │
│   undefined          'element-6066-11e4-a52e-4f735466cecf': '31050016E92702522B916A5776560653_element_3'                                                                                                    │
│   undefined        }                                                                                                                                                                                        │
│   undefined      ]                                                                                                                                                                                          │
│   undefined   }                                                                                                                                                                                             │
│   undefined   Request GET /session/f53bd88fd97dcea8f1eee61ae01da141/element/31050016E92702522B916A5776560653_element_3/property/value                                                                       │
│   undefined   Response 200 GET /session/f53bd88fd97dcea8f1eee61ae01da141/element/31050016E92702522B916A5776560653_element_3/property/value (19ms)                                                           │
│   undefined { value: '' }                                                                                                                                                                                   │
│   undefined √ Expected element @dropDown <#dropdown> to have value equal: "" (56ms)                                                                                                                         │
│   undefined → Completed command: expect.element ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...}) (57ms)           │
│   undefined                                                                                                                                                                                                 │
│   undefined  → Running command: setValue ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...}, 'Option 2')             │
│   undefined   Request POST /session/f53bd88fd97dcea8f1eee61ae01da141/elements                                                                                                                               │
│   undefined { using: 'css selector', value: '#dropdown' }                                                                                                                                                   │
│   undefined   Response 200 POST /session/f53bd88fd97dcea8f1eee61ae01da141/elements (20ms)                                                                                                                   │
│   undefined {                                                                                                                                                                                               │
│   undefined      value: [                                                                                                                                                                                   │
│   undefined        {                                                                                                                                                                                        │
│   undefined          'element-6066-11e4-a52e-4f735466cecf': '31050016E92702522B916A5776560653_element_3'                                                                                                    │
│   undefined        }                                                                                                                                                                                        │
│   undefined      ]                                                                                                                                                                                          │
│   undefined   }                                                                                                                                                                                             │
│   undefined   Request POST /session/f53bd88fd97dcea8f1eee61ae01da141/element/31050016E92702522B916A5776560653_element_3/clear                                                                               │
│   undefined {}                                                                                                                                                                                              │
│   undefined   Response 400 POST /session/f53bd88fd97dcea8f1eee61ae01da141/element/31050016E92702522B916A5776560653_element_3/clear (31ms)                                                                   │
│   undefined {                                                                                                                                                                                               │
│   undefined      value: {                                                                                                                                                                                   │
│   undefined        error: 'invalid element state',                                                                                                                                                          │
│   undefined        message: 'invalid element state\n  (Session info: chrome=113.0.5672.127)',                                                                                                               │
│   undefined        stacktrace: ''                                                                                                                                                                           │
│   undefined      }                                                                                                                                                                                          │
│   undefined   }                                                                                                                                                                                             │
│   undefined   Request POST /session/f53bd88fd97dcea8f1eee61ae01da141/element/31050016E92702522B916A5776560653_element_3/value                                                                               │
│   undefined {                                                                                                                                                                                               │
│   undefined      text: 'Option 2',                                                                                                                                                                          │
│   undefined      value: [                                                                                                                                                                                   │
│   undefined        'O', 'p', 't',                                                                                                                                                                           │
│   undefined        'i', 'o', 'n',                                                                                                                                                                           │
│   undefined        ' ', '2'                                                                                                                                                                                 │
│   undefined      ]                                                                                                                                                                                          │
│   undefined   }                                                                                                                                                                                             │
│   undefined   Response 200 POST /session/f53bd88fd97dcea8f1eee61ae01da141/element/31050016E92702522B916A5776560653_element_3/value (94ms)                                                                   │
│   undefined { value: null }                                                                                                                                                                                 │
│   undefined → Completed command: setValue ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...}, 'Option 2') (154ms)    │
│   undefined                                                                                                                                                                                                 │
│   undefined  → Running command: expect.element ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...})                   │
│   undefined   Request POST /session/f53bd88fd97dcea8f1eee61ae01da141/elements                                                                                                                               │
│   undefined { using: 'css selector', value: '#dropdown' }                                                                                                                                                   │
│   undefined   Response 200 POST /session/f53bd88fd97dcea8f1eee61ae01da141/elements (15ms)                                                                                                                   │
│   undefined {                                                                                                                                                                                               │
│   undefined      value: [                                                                                                                                                                                   │
│   undefined        {                                                                                                                                                                                        │
│   undefined          'element-6066-11e4-a52e-4f735466cecf': '31050016E92702522B916A5776560653_element_3'                                                                                                    │
│   undefined        }                                                                                                                                                                                        │
│   undefined      ]                                                                                                                                                                                          │
│   undefined   }                                                                                                                                                                                             │
│   undefined   Request GET /session/f53bd88fd97dcea8f1eee61ae01da141/element/31050016E92702522B916A5776560653_element_3/property/value                                                                       │
│   undefined   Response 200 GET /session/f53bd88fd97dcea8f1eee61ae01da141/element/31050016E92702522B916A5776560653_element_3/property/value (11ms)                                                           │
│   undefined { value: '2' }                                                                                                                                                                                  │
│   undefined √ Expected element @dropDown <#dropdown> to have value equal: "2" (29ms)                                                                                                                        │
│   undefined → Completed command: expect.element ({name, __index, __selector, locateStrategy, pseudoSelector, parent, resolvedElement, abortOnFailure, suppressNotFoundErrors, timeout...}) (29ms)           │
│   undefined → Running [afterEach]:                                                                                                                                                                          │
│   undefined → Completed [afterEach].                                                                                                                                                                        │
│   undefined √ undefined [Example] Can select option (1.02s)                                                                                                                                                 │
│   undefined → Running [after]:                                                                                                                                                                              │
│   undefined → Completed [after].                                                                                                                                                                            │
│   undefined                                                                                                                                                                                                 │
│   undefined  → Running command: end (true)                                                                                                                                                                  │
│   undefined                                                                                                                                                                                                 │
│   undefined  → Running command: session ('delete', [Function])                                                                                                                                              │
│   undefined   Request DELETE /session/f53bd88fd97dcea8f1eee61ae01da141                                                                                                                                      │
│   undefined   Response 200 DELETE /session/f53bd88fd97dcea8f1eee61ae01da141 (285ms)                                                                                                                         │
│   undefined { value: null }                                                                                                                                                                                 │
│   undefined → Completed command: end (true) (303ms)                                                                                                                                                         │
│   undefined → Completed command: session ('delete', [Function]) (288ms)                                                                                                                                     │
│                                                                                                                                                                                                             │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

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: ['nightwatch/tests'],

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

  // See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html
  custom_commands_path: ['nightwatch/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
  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.0.0-beta.1

Node Version

18.16.0

Browser

Chrome 113

Operating System

No response

Additional Information

No response

@vaibhavsingh97
Copy link
Member

vaibhavsingh97 commented May 25, 2023

Related: #3696

@vaibhavsingh97 vaibhavsingh97 marked this as a duplicate and then as not a duplicate of #3696 May 25, 2023
@swrdfish swrdfish linked a pull request May 31, 2023 that will close this issue
beatfactor pushed a commit that referenced this issue Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants