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

V2 - Error TypeError: Cannot read property 'toLowerCase' of undefined at new Promise (<anonymous>) when running tests with AWS device farm settings #2955

Closed
mostmentor opened this issue Nov 19, 2021 · 5 comments
Assignees
Labels
Milestone

Comments

@mostmentor
Copy link

Describe the bug

I'm trying to run tests on AWS device farm after upgrading to Nightwatch v2 but getting this error
TypeError: Cannot read property 'toLowerCase' of undefined at new Promise (<anonymous>)
The test is running when adding other configuration (BrowserStack & local chrome webdriver)

Sample test

sampleTest.js

describe('Demo test Ecosia.org', function() {
  test('search for nightwatch', function(browser) {
    browser
      .url('https://www.ecosia.org/')
      .waitForElementVisible('body')
      .assert.titleContains('Ecosia')
      .assert.visible('input[type=search]')
      .sendKeys('input[type=search]', 'nightwatch')
      .assert.visible('button[type=submit]')
      .click('button[type=submit]')
      .assert.containsText('.mainline-results', 'Nightwatch.js')
      .end();
  })
});

Run with command

$ nightwatch Ecosia.js --verbose

Verbose output

debug.log

No output

Configuration

nightwatch.json

{
  "src_folders": "./tests",
  "page_objects_path": [
    "./page_object"
  ],
  "globals_path": "globals.js",
  "webdriver": {
    "keep_alive": true
  },
  "custom_commands_path": [
    "./lib/custom_commands",
    "./node_modules/nightwatch-xhr/es5/commands"
  ],
  "custom_assertions_path": [
    "./node_modules/nightwatch-xhr/es5/assertions"
  ],
  "test_workers": {
    "enabled": false,
    "workers": 0
  },
  "test_settings": {
    "default": {
      "selenium": {
        "start_process": false,
        "host": "testgrid-devicefarm.us-west-2.amazonaws.com",
        "default_path_prefix": "generated from aws device farm sdk",
        "port": 443
      },
      "skip_testcases_on_fail": false,
      "silent": true,
      "exclude": [
        "tests/*sample*.js"
      ],
      "request_timeout_options": {
        "timeout": 180000,
        "retry_attempts": 0
      },
      "output_folder": false,
      "end_session_on_fail": false,
      "desiredCapabilities": {
        "browserName": "chrome",
        "resolution": "1920x1080",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      },
      "capabilities": {}
    }
  },
  "live_output": true,
  "detailed_output": true,
  "test_runner": {
    "type": "default",
    "options": {
      "bail": "false",
      "retries": 0
    }
  }
}

Your Environment

Executable Version
nightwatch --version 2.0.0-beta.1
npm --version 6.14.15
node --version 14.18.0
Browser driver Version
Chrome Latest
@vaibhavsingh97
Copy link
Member

Thanks for reporting the issue, can you please share the verbose log with us, it will help us a lot to understand the problem.

@mostmentor
Copy link
Author

It's not even starting session to start logging any verbose
image

@mostmentor
Copy link
Author

I've found the problem it's the "capabilities": {} It was required to be added in nightwatch v1.7 but looks like it causes conflict here
If you can show to the user which line is causing the problem it would be much easier to catch the problems afterwards

@gravityvi gravityvi reopened this Nov 22, 2021
@gravityvi
Copy link
Member

Nightwatch uses capabilities instead of desiredCapabilities if capabilities is present and is an object.

setInitialCapabilities(value) {

Using default browser(firefox) in case no browserName is found in capabilities will resolve this issue.

@AutomatedTester
Copy link
Member

Some of the details of what capabilities we need to be aware of can be found in the webdriver spec

harshit-bs pushed a commit to harshit-bs/nightwatch that referenced this issue Nov 26, 2021
@gravityvi gravityvi linked a pull request Nov 26, 2021 that will close this issue
8 tasks
@beatfactor beatfactor added this to the Nightwatch v2 milestone Nov 28, 2021
harshit-bs added a commit to harshit-bs/nightwatch that referenced this issue Nov 30, 2021
harshit-bs added a commit to harshit-bs/nightwatch that referenced this issue Dec 15, 2021
@harshit-bs harshit-bs self-assigned this Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants