Skip to content

Run Tests

Jacky Sun edited this page May 30, 2024 · 29 revisions

We introduce a new way to run nala tests

Usage: node run.js [options]

Options:
  -p, --project Specify the project to run tests on, e.g., milo-live-chrome. use 'all' for all or comma-separated list of projects
  -c, --config Specify name of configuration file, e.g., milo.
  -g, --grep Filter tests by grep pattern, e.g., '@milo'.
  -r, --reporter Specify the reporter to use, e.g., 'html'.
  -h, --help Display this help message and exit.\

  --headed Run tests in headed mode.
  --headless Run tests in headless mode (default).

Examples:

  • run uar test on uar-live: node run.js -c uar -g "@uar-quiz-basic-milo" -p uar-live-chrome

  • run uar test on milo-live: node run.js -c uar -g "@uar-quiz-basic-milo" -p milo-live-chrome

  • run milo test on milo-live: node run.js -c milo -g "@milo" -p milo-live-chrome

  • you can also use '=': node run.js -c=milo -g="@milo" -p=milo-live-chrome

  • or long options: node run.js --config=milo --grep="@milo" --project=milo-live-chrome

  • support run on all projects with -p 'all': node run.js -c milo -p all -g "@milo"

  • support run some projects with comma-separated list of projects: node run.js -c milo -p milo-live-chrome,milo-live-firefox -g "@milo"

Some rules:

We set "testDir: '../tests/xxx'" in xxx.config.js to control test scopes, in another words, you can run others' tests, but you can run your tests in different websites.

For example: if you want to run milo tests all bacom, you need to add this into milo.config.js
`` { name: 'bacom-live-chrome', use: { ...devices['Desktop Chrome'], baseURL: envs['@bacom_live'], }, }, { name: 'bacom-live-firefox', use: { ...devices['Desktop Firefox'], baseURL: envs['@bacom_live'], }, }, { name: 'bacom-live-webkit', use: { ...devices['Desktop Safari'], baseURL: envs['@bacom_live'], }, },

Clone this wiki locally