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

How to use folder_format? #310

Open
jpratt2 opened this issue Jul 15, 2024 · 2 comments
Open

How to use folder_format? #310

jpratt2 opened this issue Jul 15, 2024 · 2 comments

Comments

@jpratt2
Copy link

jpratt2 commented Jul 15, 2024

Can I have an example of the use of "folder_format" that is listed here?
https://nightwatchjs.org/guide/configuration/customising-test-output.html
How can it be used to retain reports over test runs?

From documentation: "Used as a prefix for HTML report folder. This can be utilised to retain HTML report across test runs"

@jpratt2
Copy link
Author

jpratt2 commented Jul 15, 2024

It may be related to nightwatchjs/nightwatch#3309 for "retain_report".

@garg3133
Copy link
Member

@jpratt2 If you set the folder_format, it would be used as a parent folder name inside which the HTML report for the current test run will be saved.

For ex., if you set folder_format to say "html_reports", then your HTML report will be saved inside test_output/html_reports/nightwatch-html-report/. But since your folder_format would be the same for each test run, it would just overwrite the previous test HTML report.

So, to retain your HTML reports, the idea here is to use different values in folder_format for each test run. This can be done by setting the folder_format to a function, like below:

folder_format: function() {
  return `html-report-${Date.now().toString()}`;
},

Doing so would create a new folder inside test_output every time you run a test containing the HTML report for that test run.

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