Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

nightwatch-commands support for nightwatch v1 #86

Open
samtbabu opened this issue Aug 14, 2019 · 0 comments
Open

nightwatch-commands support for nightwatch v1 #86

samtbabu opened this issue Aug 14, 2019 · 0 comments

Comments

@samtbabu
Copy link

Summary

nightwatch-commands support for nightwatch v1
I tried integrating the nightwatch-commands package with nightwatch (version 1.2.1) and I am getting the below issue.

@ellenmobify - It will be greatly appreciated if you can look at this issue.

Console Error Log

λ npm run chrome

> [email protected] chrome C:\Users\sthoma40\MyDocs\Officeworks\Automation\nightwatchjs-selenium-example
> nightwatch -e chrome


[Github] Test Suite
===================
Running:  Demo test GitHub

   TypeError: Error while running "waitForCondition" command: "TypeError: Class constructor ProtocolActions cannot be invoked without 'new'
  "


FAILED: 1 errors (1.355s)
   TypeError: Error while running "waitForCondition" command: "TypeError: Class constructor ProtocolActions cannot be invoked without 'new'
  "

github.js

module.exports = {
  tags: ['git'],
  'Demo test GitHub': function (client) {
    client
      .url('https://github.com/nightwatchjs/nightwatch')
      .waitForAjaxCompleted()
      .waitForElementVisible('body', 1000)
      .getTitle(function (result) {
        client.assert.equal(result.indexOf('GitHub - nightwatchjs/nightwatch'), 0, 'Page title starts with nightwatch')
      })
      .assert.visible('.container h1 strong a')
      .assert.containsText('.container h1 strong a', 'nightwatch', 'Checking project title is set to nightwatch');
  },

  after: function (client) {
    client.end();
  }
};

nightwatch.conf.js

module.exports = {
  src_folders: ['tests'],
  output_folder: 'output/reports',
  custom_commands_path: './node_modules/nightwatch-commands/commands',
  custom_assertions_path: '',
  page_objects_path: '',

Package.json

  "devDependencies": {
    "chromedriver": "^75.1.0",
    "edgedriver": "^4.17134.1",
    "geckodriver": "^1.16.2",
    "iedriver": "^3.14.1",
    "nightwatch": "^1.2.1",
    "nightwatch-commands": "^3.0.0",
    "selenium-server": "^3.141.59"
  }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant