Skip to content

Commit

Permalink
update readme with nala commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Santoshkumar Sharanappa Nateekar authored and Santoshkumar Sharanappa Nateekar committed Sep 19, 2024
1 parent 54c3cc0 commit a86fe94
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ https://feat-branch--project--owner.hlx.page/?milolibs=local (feature code, stag
```

## Testing
### Unit Testing
```sh
npm run test
```
Expand All @@ -69,3 +70,42 @@ 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

#### Running Nala Tests
Nala tests are run using the `npm run nala <env> [options]` command:

```sh
npm run nala <env> [options]
```
```sh
# env: [local | libs | branch | stage | etc ] default: local

# options:
- browser=<chrome|firefox|webkit> # Browser to use (default: chrome)
- device=<desktop|mobile> # Device (default: desktop)
- test=<.test.js> # Specific test file to run (runs all tests in the file)
- tag=<@tag> # Tags to filter tests by annotations ex: @test1 @accordion @marquee
- -g, --g=<@tag> # Tags to filter tests by annotations ex: @test1 @accordion @marquee
- mode=<headless|ui|debug|headed> # Mode (default: headless)
- config=<config-file> # Configuration file (default: Playwright default)
- project=<project-name> # Project configuration (default: milo-live-chromium)
- milolibs=<local|prod|feature|any|> # Milolibs?=<env>

```
#### 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 changes: 2 additions & 1 deletion nala/utils/nala.run.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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
-----------
Expand Down

0 comments on commit a86fe94

Please sign in to comment.