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

Junit XML is overwritten when running parallel envs on same browser #4236

Open
mostmentor opened this issue Jul 17, 2024 · 5 comments
Open

Comments

@mostmentor
Copy link

Description of the bug/issue

I'm running a test on multiple envs (dev,qa,stage,...) all on same browser (Chrome).
I noticed that only one XML is found at the end of the run because each time the Junit XML is overwritten with same reportPrefix (check here https://github.dev/nightwatchjs/nightwatch/blob/b7339c46ea3eb395ae790ade62061fd7037f836c/lib/reporter/reporters/junit.js#L61 )
I tried to log reportPrefix at the end of the tests and it always has same name reportPrefix: 'CHROME_126.0.6478.127__'

Steps to reproduce

  1. Go to '...'
  2. Click on '...'
  3. Scroll down to '...'
  4. See error

Sample test

No response

Command to run

nigtwatch -e dev,qa

Verbose Output

No response

Nightwatch Configuration

const settings = {
     "src_folders": [
          "tests"
     ],
     "webdriver": {
          "keep_alive": true
     },
     "test_workers": {
          "enabled": true,
          "workers": 5
     },
     "test_settings": {
          "default": {
               "localOption": true,
               "skip_testcases_on_fail": false,
               "end_session_on_fail": false,
               "disable_error_log": false,
               "screenshots": {
                    "enabled": false,
                    "path": "screens",
                    "on_failure": true
               },
               "desiredCapabilities": {
                    "browserName": "chrome"
               },
               "webdriver": {
                    "port": 9515,
                    "start_process": true,
                    "server_path": "node_modules/chromedriver/lib/chromedriver/chromedriver.exe"
               }
          },
          "qa": {
               "launch_url": "some_url"
          },
          "dev": {
               "launch_url": "some_url"
          }
     },
     "live_output": true,
     "silent": true,
     "output_folder": "./reports/test-reports/merged",
     "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

3.7.0

Node Version

No response

Browser

No response

Operating System

No response

Additional Information

No response

@mostmentor
Copy link
Author

Any updates on this issue ?

@garg3133
Copy link
Member

@mostmentor One way to solve this is to use different output_folder for different envs.

For example:

"test_settings": {
          "default": {
               "localOption": true,
               "skip_testcases_on_fail": false,
               "end_session_on_fail": false,
               "disable_error_log": false,
               "screenshots": {
                    "enabled": false,
                    "path": "screens",
                    "on_failure": true
               },
               "desiredCapabilities": {
                    "browserName": "chrome"
               },
               "webdriver": {
                    "port": 9515,
                    "start_process": true,
                    "server_path": "node_modules/chromedriver/lib/chromedriver/chromedriver.exe"
               },
               "reporter_options": {
                 "output_folder": "tests_output/default"
               }
          },
          "qa": {
               "launch_url": "some_url",
               "reporter_options": {
                 "output_folder": "tests_output/qa"
               }
          },
          "dev": {
               "launch_url": "some_url",
               "reporter_options": {
                 "output_folder": "tests_output/dev"
               }
          }
     },

@mostmentor
Copy link
Author

@garg3133 It's not working

@garg3133
Copy link
Member

@mostmentor That would mean you already have output_folder set somewhere. Try mentioning output_folder directly inside the envs instead of inside reporter_options, like below:

  "qa": {
       "launch_url": "some_url",
       "output_folder": "tests_output/qa"
  },
  "dev": {
       "launch_url": "some_url",
       "output_folder": "tests_output/dev"
  }

@mostmentor
Copy link
Author

@garg3133 This didn't work either. The html,xml and json reports are exported to tests_output
When I used --trace the snapshots got added to output/qa and output/dev but the other reports(xml,html,json) are still exported to test_output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants