vanilla-basic icon indicating copy to clipboard operation
vanilla-basic copied to clipboard

Optimize for local playwright tests

Open TroyWitthoeft opened this issue 2 years ago • 1 comments

It's really cool to see this project updated with playwright tests. However, like most folks I like to test locally first, and then automate it.

After cloning this project, I struggled to get local testing setup.
The Test.README.md states to run npm run playwright_test If we just naively run this we'll get an error ...

image

[WebServer] 'sirv' is not recognized as an internal or external command,
operable program or batch file.
Error: Process from config.webServer was not able to start. Exit code: 1

Luckily, we've got the playwright-onDemand.yml that hints at what is needed for local testing. Specifically, we need to install the dependencies. npx playwright install --with-deps npm install --g sirv-cli

After getting those dependencies installed locally, I was up and running tests locally! 🎉 However, the test results made a bit of a mess inside the project.

image

We've now got new files in root, new folders, and none of them were part of the .gitignore so, they are set to get committed. Proposal, we're already ignoring the test-results folder. In order to optimize the experience for local testing, would it make sense to do two things ...

  • Update that Test.README.md with the explicit steps to get local testing working.
  • Re-arrange our testing config to drop all of the results into the test-results` folder so we don't have to update the gitignore file? Something like this?
    image

Alternatively, it might be that using a GitHub Codespace or using VS Code with the remote containers extension, resolves this? Didn't try that. But, would prefer to NOT have those local environment dependencies if possible.

I know we'd have to touch a few files to make this happen. The workflows, playwright.config.ts, etc ...
However, I am happy to take a swing PR'ing this! I really just want the local playwright experience to be optimized. Thanks!

TroyWitthoeft avatar Aug 21 '22 19:08 TroyWitthoeft

Your explanation of the error saved me time and confusion during my Hello World journey for SWA. Thank you!

MaxWilson avatar Sep 30 '22 23:09 MaxWilson