This POC is to show that with Dart 2, we should be able to run functional/acceptance tests with CodeceptJS and Puppeteer without having to run the dart2js compiler. It also attempts to show that we can use hot reloading, and the idea that unit tests should run each time a code change is detected.
- Clone the repo to your workspace
cdinto the root directory- Run
pub getto retrieve packages - Run
webdev serveto start (add--hot-reloadto enable hot reloading)
To run unit tests, run the command pub run test test/unit and view the
results. To enable re-running unit tests on code change, run npm install -g watch to install the watch package. In the terminal, at the root
directory, run watch "pub run test test/unit" web test to re-run the unit
tests each time code is changed in the web and test directories. You
can add any directories you'd like to this list.
To run functional tests, cd into the test directory and run the command
codeceptjs run to run all functional tests. For CodeceptJS to recognize a
test file, its name must be in the format *_test.js.
Add the flag --steps to view all steps in the terminal as the test takes them.
Do NOT use this flag in CI as it will print out whatever you fill fields or
forms with.
For more information on how to configure Puppeteer settings, see: Testing With Puppeteer
For advanced CodeceptJS usage, see: Advanced CodeceptJS