I have successfully hosted my Playwright tests on AWS CodeBuild, and the report is generated as expected when all test cases pass. However, if any test case fails, the build fails and throws an error. The error message reads: Serving HTML report at http://localhost:9323. Press Ctrl+C to quit. Failed to open browser on http://localhost:9323
To resolve this, I configured headless mode to true and added 'reporter: [['html', { open: 'never' }]]' to the playwright.config.js file to stop the browser from automatically opening. This works perfectly on my local Windows machine, but when I run it on AWS CodeBuild, it throws a different error saying it can't find the test report.
The error message reads: [Container] 2023/03/16 10:22:51 Command did not exit successfully npm run test --reporter=html exit status 1 [Container] 2023/03/16 10:22:51 Phase complete: BUILD State: FAILED [Container] 2023/03/16 10:22:51 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm run test --reporter=html. Reason: exit status 1 [Container] 2023/03/16 10:22:56 Phase complete: UPLOAD_ARTIFACTS State: FAILED [Container] 2023/03/16 10:22:56 Phase context status code: CLIENT_ERROR Message: no matching artifact paths found