Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MWPW-158021] Update Milo README with Nala commands details #2909

Merged
merged 6 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 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,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 <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)
- -g, --g=<@tag> # Tag 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>

```
#### 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).






14 changes: 7 additions & 7 deletions nala/utils/nala.run.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ function displayHelp() {

\x1b[1m2] Options:\x1b[0m

\x1b[33m* browser=<chrome|firefox|webkit>\x1b[0m Browser to use (default: chrome)
\x1b[33m* device=<desktop|mobile>\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=<chrome|firefox|webkit>\x1b[0m Browser to run the test in
\x1b[33m* device=<desktop|mobile>\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=<headless|ui|debug|headed>\x1b[0m Mode (default: headless)
\x1b[33m* config=<config-file>\x1b[0m Configuration file (default: Playwright default)
\x1b[33m* config=<config-file>\x1b[0m Custom configuration file to use (default: Playwright's default)
\x1b[33m* project=<project-name>\x1b[0m Project configuration (default: milo-live-chromium)
\x1b[33m* milolibs=<local|prod|code|feature>\x1b[0m Milo library environment (default: none)

Expand All @@ -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
-----------
Expand Down
Loading