dperini / nwsapi

Fast CSS Selectors API Engine
MIT License
105 stars 36 forks source link

Set up CI environment and use it to run automated tests #30

Closed ExE-Boss closed 4 years ago

ExE-Boss commented 4 years ago

Currently, NWSAPI tests are a mess that have to be run in the browser.

I recommend creating a test suite that can be ran using a test framework (eg.: Jest) in a CI environment (eg.: GitHub Actions or Travis CI).

dperini commented 4 years ago

@ExE-Boss you are missing the thorough and complete set of selectors test performed by jsdom tests which uses the W3C own "web-platform-tests/wpt": https://github.com/web-platform-tests/wpt This obviously adds to the many other in browsers tests you mentioned and between them the same WPT tests which I slightly modified to be run directly in the browser:

$ cd nwsapi/test/
$ sh w3c-test.sh

Then open up your browser and load from http://localhost:8000

An helper trick I have put to work with these selected WPT tests is that you can press combined keys "ALT+CTRL" to switch from testing nwsapi Selector API to testing native Query Selector API built into browsers. The shortcut key switch will reload the page and target one or the other API. Not a big automation example though, but enough for me while developing the code.

Obviously if you can contribute some other form of testing (like Continuous Integration) I will be happy to add your code to the project. However this is not an issue either so submit a Pull request instead and I will apply it asap.