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.79k stars 1.31k forks source link

Parallel environment is not working on windows powershell #3424

Open mostmentor opened 2 years ago

mostmentor commented 2 years ago

Description of the bug/issue

When I try to run https://nightwatchjs.org/guide/running-tests/parallel-running.html#via-workers-multiple-environments I got error "Invalid testing environment specified:"

I found this can be fixed by just update line 133 in lib/runner/cli/cli.js to be : - this.testEnvArray = this.testEnv.split(' ');

After updating this it started but the test is running default only

Command to run

nightwatch -e firefox,MicrosoftEdge,default --parallel 30

Nightwatch Configuration

const settings = {
     "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_settings": {
          "default": {
               "deviceFarmProject": "xxxx",
               "selenium": {
                    "start_process": false,
                    "host": "testgrid-devicefarm.us-west-2.amazonaws.com",
                    "default_path_prefix": "xxxx",
                    "port": 443
               },
               "skip_testcases_on_fail": false,
               "parallel_process_delay": 185,
               "silent": true,
               "exclude": [
                    "tests/sample-suite/*"
               ],
               "request_timeout_options": {
                    "timeout": 180000,
                    "retry_attempts": 2
               },
               "output_folder": "./reports",
               "end_session_on_fail": false,
               "desiredCapabilities": {
                    "browserName": "chrome"
               }
          },
          "firefox": {
               "deviceFarmProject": "xxxx",
               "selenium": {
                    "start_process": false,
                    "host": "testgrid-devicefarm.us-west-2.amazonaws.com",
                    "default_path_prefix": "xxxx",
                    "port": 443
               },
               "skip_testcases_on_fail": false,
               "parallel_process_delay": 185,
               "silent": true,
               "exclude": [
                    "tests/sample-suite/*"
               ],
               "request_timeout_options": {
                    "timeout": 180000,
                    "retry_attempts": 2
               },
               "output_folder": "./reports",
               "end_session_on_fail": false,
               "desiredCapabilities": {
                    "browserName": "firefox"
               }
          },
          "MicrosoftEdge": {
               "deviceFarmProject": "xxxx",
               "selenium": {
                    "start_process": false,
                    "host": "testgrid-devicefarm.us-west-2.amazonaws.com",
                    "default_path_prefix": "xxxx",
                    "port": 443
               },
               "skip_testcases_on_fail": false,
               "parallel_process_delay": 185,
               "silent": true,
               "exclude": [
                    "tests/sample-suite/*"
               ],
               "request_timeout_options": {
                    "timeout": 180000,
                    "retry_attempts": 2
               },
               "output_folder": "./reports",
               "end_session_on_fail": false,
               "desiredCapabilities": {
                    "browserName": "MicrosoftEdge",
                    "ms:edgeChromium": true
               }
          }
     },
     "live_output": true,
     "detailed_output": true,
     "test_runner": {
          "type": "default",
          "options": {
               "bail": false,
               "retries": 0
          }
     }
}
 module.exports = new Promise(resolve => {
     resolve(settings);
   });
 module.exports.settings = settings

Nightwatch.js Version

2.3.9

Node Version

16.17.0

Browser

firefox, edge, chrome

Operating System

win 10

Additional Information

No response

AutomatedTester commented 2 years ago

PR #3425

swrdfish commented 1 year ago

After some investigation @mostmentor reported that the issue is with powershell:

We need to handle this case for windows.