nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.8k stars 1.31k forks source link

Skiptags not registering, fails tests automatically #1915

Closed Genjidegaulle closed 5 years ago

Genjidegaulle commented 5 years ago

Hey there,

I'm trying to run some nightwatch tests, skipping those with the tag "chrome". Here's an example of a test: screen shot 2018-10-30 at 11 49 32 am

My nightwatch command is the following: screen shot 2018-10-30 at 11 52 23 am

However, no tests run. The output is the following: screen shot 2018-10-30 at 11 53 11 am

The path is correct: test_nightwatch/tests/winter_2017/ligand-bird/general-ligand_depot_page.js, but Nightwatch can't find the test and therefore fails to run at all.

Edit: this is for Nightwatch@1.0.11

Attached is my nightwatch.json file:

{
  "src_folders" : ["./test_nightwatch/tests/"],
  "output_folder" : false,
  "custom_commands_path" : ["./test_nightwatch/commands"],
  "custom_assertions_path" : ["./test_nightwatch/assertions"],
  "page_objects_path" : "",
  "globals_path" : "./test_nightwatch/globals.js",
  "selenium" : {
    "start_process" : true,
    "server_path" : "./test_nightwatch/selenium-server-standalone-3.13.0.jar",
    "log_path" : false,
    "host": "127.0.0.1",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "./node_modules/chromedriver/lib/chromedriver/chromedriver",
      "webdriver.gecko.driver" : "./node_modules/geckodriver/geckodriver",
      "webdriver.edge.driver" : ""
    }
  },

  "test_settings" : {
    "default" : {
      "launch_url" : "http://localhost:8080",
      "selenium_port"  : 4444,
      "selenium_host"  : "localhost",
      "silent": true,
      "screenshots" : {
        "enabled" : false,
        "on_failure" : true,
        "on_error" : true,
        "path" : "./test_nightwatch/failures"
      },
      "desiredCapabilities": {
        "browserName": "firefox",
        "acceptSslCerts": true,
        "javascriptEnabled": true,
        "marionette": true,
        "moz:firefoxOptions": {
            "args": []
        }
      },
      "request_timeout_options": {
        "timeout": 300000,
        "retry_attempts": 5
      },
      "globals": {
      },
      "suiteRetries": "1"
    },

    "development" : {
      "launch_url" : "https://beta.rcsb.org",
      "desiredCapabilities": {
        "browserName": "chrome",
        "acceptSslCerts": true,
        "cssSelectorsEnabled": true,
        "javascriptEnabled": true,
        "chromeOptions": {
            "args": ["start-maximized", "headless", "no-sandbox"]
        }
      }
    },

    "chrome" : {
      "desiredCapabilities": {
        "browserName": "chrome",
        "acceptSslCerts": true,
        "cssSelectorsEnabled": true,
        "acceptInsecureCerts": true,
        "javascriptEnabled": true,
        "chromeOptions": {
            "args": ["start-maximized", "headless"]
        }
      }
    },

    "firefox" : {
      "desiredCapabilities": {
        "browserName": "firefox",
        "acceptSslCerts": true,
        "acceptInsecureCerts": true,
        "javascriptEnabled": true,
        "marionette": true,
        "moz:firefoxOptions": {
            "args": ["-headless", "--window-size=1600,1200"]
        }
      }
    }
 }
}
beatfactor commented 5 years ago

Seems like a problem with your config. If you're convinced the problems lies with nightwatch, please reopen and post the content of the test that should be found. Also please avoid posting images and use inline text.

didaquis commented 5 years ago

Hi. Same situation for me after update Nightwatch from 0.9.21 to 1.0.18.

On 0.9.21 this work fine nightwatch --config ./e2e/nightwatch.conf.js --test --skiptags require-hardware. On 1.0.18 is not working!

This is my nightwatch configuration file:

'use strict';

/**
 * @fileOverview
 * End to End tests configuration and runner
 */

// https://github.com/dwyl/learn-nightwatch

module.exports = {
    src_folders: [
        './e2e/tests' // Where you are storing your Nightwatch e2e/UAT tests
    ],
    custom_commands_path: './e2e/customCommands',
    output_folder: './e2e/reports', // reports (test outcome) output by nightwatch
    selenium: { // downloaded by selenium-download module (see readme)
        start_process: true, // tells nightwatch to start/stop the selenium process
        server_path: './e2e/bin/selenium.jar',
        host: '127.0.0.1',
        port: 4444, // standard selenium port
        log_path: './e2e/logs',
        cli_args: { // chromedriver is downloaded by selenium-download (see readme)
            'webdriver.chrome.driver' : './e2e/bin/chromedriver',
            'phantomjs.cli.args': '--web-security=false --ignore-ssl-errors=true --load-images=true --local-to-remote-url-access=true --debug=true'
        }
    },
    test_settings: {
        default: {
            screenshots: {
                enabled: false, // if you want to keep screenshots of errors
                path: '' // save screenshots here
            },
            globals: {
                waitForConditionTimeout: 5000 // sometimes internet is slow so wait.
            },
            desiredCapabilities: { // use Chrome as the default browser for tests
                browserName: 'chrome'
            }
        },
        chrome: {
            desiredCapabilities: {
                browserName: 'chrome',
                javascriptEnabled: true // set to false to test progressive enhancement
            }
        }
    }
};

//Selenium download
require('selenium-download').ensure('./e2e/bin', function(error) {
    if (error) {
        return console.log(error); // eslint-disable-line no-console
    } else {
        console.log('✔ Selenium & Chromedriver downloaded to:', './e2e/bin'); // eslint-disable-line no-console
    }
});
didaquis commented 5 years ago

Hi @Genjidegaulle! Did you find any solution?

Genjidegaulle commented 5 years ago

Hi @didaquis,

I wasn't able to find a solution, so I just removed the tests that were unnecessary. Over the next few weeks I'll go back and try to figure it out.

Sorry I can't help!

didaquis commented 5 years ago

Any update about this?

@beatfactor Could you consider opening this issue again? Maybe I'm not configuring well my code or maybe is a real issue of Nightwatch. In my opinion, will be awesome if another developer with more experience in this library reviews it.

beatfactor commented 5 years ago

A fix was merged into master https://github.com/nightwatchjs/nightwatch/pull/1998

didaquis commented 5 years ago

Thank you!