dasher-project / dasher-web

Dasher text entry in HTML, CSS, JavaScript, and SVG
https://dasher-project.github.io/dasher-web/browser/
MIT License
43 stars 8 forks source link

Testing Framework - Github Actions #108

Closed jcope closed 2 years ago

jcope commented 2 years ago

Uses Jest to run javascript tests on dasher core. Uses puppeteer to launch Dasher in headless chrome, for End-to-end testing. Run tests locally, see tests/Readme.md Tests are executed via Github Actions on each commit.

netlify[bot] commented 2 years ago

✔️ Deploy Preview for dasherv6demo ready!

🔨 Explore the source changes: 8ead191215cb9da313b357b0b6efff23c5b2b374

🔍 Inspect the deploy log: https://app.netlify.com/sites/dasherv6demo/deploys/61608255517c5c0008939333

😎 Browse the preview: https://deploy-preview-108--dasherv6demo.netlify.app

gavinhenderson commented 2 years ago

Looks awesome! Love the Github Actions automation :D

Did you consider Cypress? Personally, I prefer Cypress over Puppeteer for E2E tests, mainly because it has a really great development experience and also has handy tools like outputting screen recordings for debugging.

I think you can achieve all the same stuff in Puppeteer but it is just a little more effort.

jcope commented 2 years ago

Did you consider Cypress? Personally, I prefer Cypress over Puppeteer for E2E tests, mainly because it has a really great development experience and also has handy tools like outputting screen recordings for debugging.

I didn't know of Cypress- seems to have few advantages, so I can swap it out if others prefer. I haven't used either extensively, but I do know Puppeteer takes screen shots (but perhaps not recordings?).

Only one test written so far using Puppeteer (launch Dasher, take screenshot) so before writing others, now would be good to decide

gavinhenderson commented 2 years ago

Yeah definitely good to decide before we start writing lots of tests.

My vote would be Cypress. Its worth noting that there is also a paid for service (thats free for OSS) you can use with Cypress that allows you to view your test runs in a nice UI, although its by no means required and can be added later if we end up with a huge suite of tests. You can still export videos as an artifact from actions without it. Its also worth noting that cypress has a prebuilt github action, to make running it slightly simpler.

Shameless plug, you can see an example of all this in action on the AceCentre website repo 😉

jcope commented 2 years ago

Updated to use Cypress- Testing Check passes- currently failing ESLint rules (in a future PR).

sjjhsjjh commented 2 years ago

Does it run the tests on every commit or only on commit to main?

jcope commented 2 years ago

Tests can be run locally, but the actions are setup to run on every push. So if the commit is pushed to Git, then it will trigger a run.