Skip to content

Commit

Permalink
docs: add documentation for npmExecuteTests step
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Germanov committed Oct 10, 2024
1 parent cf6af6f commit 5dc002b
Showing 1 changed file with 113 additions and 0 deletions.
113 changes: 113 additions & 0 deletions documentation/docs/steps/npmExecuteTests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# ${docGenStepName}

## ${docGenDescription}

## ${docGenParameters}

## ${docGenConfiguration}

## Examples

### Simple example using wdi5

```yaml
stages:
- name: Test
steps:
- name: npmExecuteTests
type: npmExecuteTests
params:
baseUrl: "http://example.com/index.html"
```
This will run your wdi5 tests with the given baseUrl.
### Advanced example using custom test script with credentials using Vault
```yaml
stages:
- name: Test
steps:
- name: npmExecuteTests
type: npmExecuteTests
params:
installCommand: "npm install"
runCommand: "npm run custom-e2e-test"
usernameEnvVar: "e2e_username"
passwordEnvVar: "e2e_password"
baseUrl: "http://example.com/index.html"
urlOptionPrefix: "--base-url="
```
and Vault configuration in PIPELINE-GROUP-<id>/PIPELINE-<id>/appMetadata
```json
{
"appSecrets": {
"urls": [
{
"url": "http://one.example.com/index.html",
"username": "some-username1",
"password": "some-password1"
},
{
"url": "http://two.example.com/index.html",
"username": "some-username2",
"password": "some-password2"
}
],
"username": "base-url-username",
"password": "base-url-password"
}
}
```

This will run your custom install and run script for each URL from secrets and use the given URL like so:

```shell
npm run custom-e2e-test --base-url=http://one.example.com/index.html
```

Each test run will have their own environment variables set:

```shell
e2e_username=some-username1
e2e_password=some-password1
```

Environment variables are reset before each test run with their corresponding values from the secrets

### Custom environment variables and $PATH

```yaml
stages:
- name: Test
steps:
- name: npmExecuteTests
type: npmExecuteTests
params:
envs:
- "MY_ENV_VAR=value"
paths:
- "/path/to/add"
```
If you're running uiVeri5 tests, you might need to set additional environment variables or add paths to the $PATH variable. This can be done using the `envs` and `paths` parameters:

```yaml
stages:
- name: Test
steps:
- name: npmExecuteTests
type: npmExecuteTests
params:
runCommand: "/home/node/.npm-global/bin/uiveri5"
installCommand: "npm install @ui5/uiveri5 --global --quiet"
runOptions: ["--seleniumAddress=http://localhost:4444/wd/hub"]
usernameEnvVar: "PIPER_SELENIUM_HUB_USER"
passwordEnvVar: "PIPER_SELENIUM_HUB_PASSWORD"
envs:
- "NPM_CONFIG_PREFIX=~/.npm-global"
paths:
- "~/.npm-global/bin"
```

0 comments on commit 5dc002b

Please sign in to comment.