diff --git a/README.md b/README.md index b8cbb78ba3..e5639acff0 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ https://feat-branch--project--owner.hlx.page/?milolibs=local (feature code, stag ``` ## Testing +### Unit Testing ```sh npm run test ``` @@ -69,3 +70,45 @@ npm run test:watch ### Coverage `npm run test:watch` can give misleading coverage reports. Use `npm run test` for accurate coverage reporting. +### Nala E2E UI Testing +----- + +#### 1. Running Nala Tests +Nala tests are run using the `npm run nala [options]` command: + +```sh +npm run nala [options] +``` +```sh +# env: [local | libs | branch | stage | etc ] default: local + +# options: + - browser= # Browser to use (default: chrome) + - device= # Device (default: desktop) + - test=<.test.js> # Specific test file to run (runs all tests in the file) + - -g, --g=<@tag> # Tag to filter tests by annotations ex: @test1 @accordion @marquee + - mode= # Mode (default: headless) + - config= # Configuration file (default: Playwright default) + - project= # Project configuration (default: milo-live-chromium) + - milolibs= # Milolibs?= + +``` +#### 2. Nala Help Command: +To view examples of how to use Nala commands with various options, you can run +```sh +npm run nala help +``` + +#### ⚠️ Important Note +- **Debug and UI Mode Caution**: When using `debug` or `ui` mode, it is recommended to run only a single test using annotations (e.g., `@test1`). Running multiple tests in these modes (e.g., `npm run nala local mode=debug` or `mode=ui`) will launch a separate browser or debugger window for each test, which can quickly become resource-intensive and challenging to manage. + +- **Tip**: To effectively watch or debug, focus on one test at a time to avoid opening excessive browser instances or debugger windows. + +#### 3. Nala Documentation +For detailed guides and documentation on Nala, please visit the [Nala GitHub Wiki](https://github.com/adobecom/milo/wiki/Nala#nala-introduction). + + + + + + diff --git a/nala/utils/nala.run.js b/nala/utils/nala.run.js index 11d1354006..bcda6d9ebc 100644 --- a/nala/utils/nala.run.js +++ b/nala/utils/nala.run.js @@ -13,13 +13,12 @@ function displayHelp() { \x1b[1m2] Options:\x1b[0m - \x1b[33m* browser=\x1b[0m Browser to use (default: chrome) - \x1b[33m* device=\x1b[0m Device (default: desktop) - \x1b[33m* test=<.test.js>\x1b[0m Test file to run (default: all tests) - \x1b[33m* tag=<@tag>\x1b[0m Tags to filter tests by annotations ex: @test1 @accordion @marquee - \x1b[33m* -g, --g=<@tag>\x1b[0m Tags to filter tests by annotations ex: @test1 @accordion @marquee + \x1b[33m* browser=\x1b[0m Browser to run the test in + \x1b[33m* device=\x1b[0m Device type to run the test on + \x1b[33m* test=<.test.js>\x1b[0m Specific test file to run (runs all tests in the file) + \x1b[33m* -g, --g=<@tag>\x1b[0m Annotation Tag to filter and run tests by annotation (e.g., @test1, @accordion, @marquee) \x1b[33m* mode=\x1b[0m Mode (default: headless) - \x1b[33m* config=\x1b[0m Configuration file (default: Playwright default) + \x1b[33m* config=\x1b[0m Custom configuration file to use (default: Playwright's default) \x1b[33m* project=\x1b[0m Project configuration (default: milo-live-chromium) \x1b[33m* milolibs=\x1b[0m Milo library environment (default: none) @@ -31,7 +30,8 @@ function displayHelp() { | npm run nala local @accordion | Runs only accordion annotated/tagged tests on local environment on chrome browser | | npm run nala local @accordion browser=firefox | Runs only accordion annotated/tagged tests on local environment on firefox browser | | npm run nala local mode=ui | Runs all nala tests on local environment in UI mode on chrome browser | - | npm run nala local tags=@tag1,@tag2 | Runs tests annotated with @tag1 and @tag2 on local environment on chrome browser | + | npm run nala local -g=@accordion | Runs tests annotated with tag i.e @accordion on local env on chrome browser | + | npm run nala local -g=@accordion browser=firefox | Runs tests annotated with tag i.e @accordion on local env on Firefox browser | \x1b[1mDebugging:\x1b[0m -----------