So I am currently in the process of uploading the Html report into a server to be accessed over a webpage. Now what I read was Playwright creates the Html report once the global tear down is executed. I was wondering if there is a way to create the Html report in the global tear down only.
2
Answers
You can’t do this. Playwright reports executed after all tests and teardowns.
But you can archive it with several npm commands – one for test execution and another for HTML publishing.
You may explore the onExit method as newly introduced in v1.33.
This is called immediately before test runner exits. At this point all the reporters have received the reporter.onEnd() signal, so all the reports should be build. You can run the code that uploads the reports in this hook.