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

nightwatch-commands support for nightwatch v1  #86

@samtbabu

Description

@samtbabu

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

> nightwatchjs-selenium-example@1.0.0 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"
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions