question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'lastIndexOf' of undefined

See original GitHub issue

I’m submitting a … (check one with “x”)

[X] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead use https://groups.google.com/d/forum/nightwatch-cucumber

Current behavior

Starting selenium server in parallel mode... started - PID:  15495

Started child process for: features/home
Started child process for: features/how-to-apply
Started child process for: features/lending-criteria
Started child process for: features/partners

  >> features/home finished.


  >> features/how-to-apply finished.


  >> features/lending-criteria finished.


  >> features/partners finished.

Started child process for: features/top-navigation

  >> features/top-navigation finished.


Unhandled Rejection at: Promise Promise {
  <rejected> TypeError: Cannot read property 'lastIndexOf' of undefined
    at Runner.addIndexToFileName (/Users/arozwalak/Sites/brokers/node_modules/nightwatch-cucumber/lib/runner.js:70:30)
    at /Users/arozwalak/Sites/brokers/node_modules/nightwatch-cucumber/lib/runner.js:122:45
    at Generator.next (<anonymous>)
    at onFulfilled (/Users/arozwalak/Sites/brokers/node_modules/co/index.js:65:19)
    at /Users/arozwalak/Sites/brokers/node_modules/co/index.js:54:5
    at co (/Users/arozwalak/Sites/brokers/node_modules/co/index.js:50:10)
    at createPromise (/Users/arozwalak/Sites/brokers/node_modules/co/index.js:30:15)
    at args.(anonymous function) (/Users/arozwalak/Sites/brokers/node_modules/nightwatch-cucumber/lib/hook-utils.js:23:28)
    at /Users/arozwalak/Sites/brokers/node_modules/nightwatch/lib/runner/cli/clirunner.js:922:13
    at ChildProcess.<anonymous> (/Users/arozwalak/Sites/brokers/node_modules/nightwatch/lib/runner/cli/child-process.js:87:7)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) } reason: TypeError: Cannot read property 'lastIndexOf' of undefined
    at Runner.addIndexToFileName (/Users/arozwalak/Sites/brokers/node_modules/nightwatch-cucumber/lib/runner.js:70:30)
    at /Users/arozwalak/Sites/brokers/node_modules/nightwatch-cucumber/lib/runner.js:122:45
    at Generator.next (<anonymous>)
    at onFulfilled (/Users/arozwalak/Sites/brokers/node_modules/co/index.js:65:19)
    at /Users/arozwalak/Sites/brokers/node_modules/co/index.js:54:5
    at co (/Users/arozwalak/Sites/brokers/node_modules/co/index.js:50:10)
    at createPromise (/Users/arozwalak/Sites/brokers/node_modules/co/index.js:30:15)
    at args.(anonymous function) (/Users/arozwalak/Sites/brokers/node_modules/nightwatch-cucumber/lib/hook-utils.js:23:28)
    at /Users/arozwalak/Sites/brokers/node_modules/nightwatch/lib/runner/cli/clirunner.js:922:13
    at ChildProcess.<anonymous> (/Users/arozwalak/Sites/brokers/node_modules/nightwatch/lib/runner/cli/child-process.js:87:7)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

Reproduction of the problem If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://c9.io, http://www.koding.com, https://www.nitrous.io or similar.

Nightwatch.config

require('nightwatch-cucumber')({
  nightwatchClientAsParameter: true,
  cucumberArgs: [
    '--require', 'test/features/step_definitions',
    '--format', 'progress',
    '--format', 'json:test/reports/cucumber.json',
    '--format-options', '{"colorsEnabled": false}',
    'test/features'
  ]
});

module.exports = {
  "output_folder": "test/reports",
  "page_objects_path" : "test/features/page-objects",
  "selenium": {
    "start_process": true,
    "server_path": BINPATH + "selenium.jar",
    "log_path" : "test/logs",
    "host": "127.0.0.1",
    "port": 4444,
    "cli_args": {
      "webdriver.chrome.driver" : BINPATH + "chromedriver"
    }
  },
  "test_workers": {
    "enabled": true,
    "workers": "auto"
  },
  "test_settings": {
    "default": {
      "globals": {
        "url": "http://brokers.project.dev:8080",
        "waitForConditionTimeout": 5000
      },
      "desiredCapabilities": {
        "browserName": "chrome"
      },
      "screenshots" : {
        "enabled" : true,
        "on_failure" : true,
        "on_error" : true,
        "path" : SCREENSHOT_PATH
      }
    },
    "uat": {
      "disable_colors": true,
      "globals": {
        "url": "http://intermediaries.uatenv.landbay.co.uk",
      },
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true,
        "acceptSslCerts": true,
        "chromeOptions": {
          "args": ["--no-sandbox"]
        }
      }
    }
  }
}

Please tell us about your environment:

OS X El Capitan

  • nightwatch-cucumber version: 7.0.5

  • nightwatch version: 0.9.11

  • cucumber version: 2.0.0-rc.5

  • Node.js version: 7.3.0

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
florentduboiscommented, Jun 23, 2017

I had the same issue but I found the problem, when you run parallel tests, '--format', 'json:reports/cucumber.json' must be present in cucumberArgs

0reactions
mucsi96commented, Nov 8, 2017

I am closing this because of no response

Read more comments on GitHub >

github_iconTop Results From Across the Web

“Cannot read property 'lastIndexOf' of undefined” when ...
0 I get the Cannot read property 'lastIndexOf' of undefined error. Downgrading to 5.2.0 doesn't solve the issue - so it must be...
Read more >
Cannot read property 'indexOf' of undefined - Stack Overflow
The problem is that you're modifying the array while jQuery's $.each is looping over it, so by the time it gets to the...
Read more >
How to fix "Uncaught TypeError: Cannot read property indexOf ...
The solution to fix Uncaught TypeError: Cannot read property 'indexOf' of undefined ... There is a really simple fix for this JS error!...
Read more >
TypeError: Cannot read property 'indexOf' of undefined
Hello, When I go to Analytics > VARIATIONS and when I set more than 3-5 days (different dates react differently) – data loading…...
Read more >
PH36402: CANNOT READ PROPERTY 'INDEXOF' OF ... - IBM
When expanding the "Module Where Used" section of a module, users may see the following error:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found