Skip to content

Commit

Permalink
Make scripts more verbose; updated CONTRIBUTING with examples
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
  • Loading branch information
ohltyler committed Feb 9, 2022
1 parent 0a866dc commit 03b59b3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
uses: cypress-io/github-action@v2
with:
working-directory: monetery-test
command: yarn cypress:run --spec 'cypress/integration/core-opensearch-dashboards/vanilla-opensearch-dashboards/*.js'
command: yarn cypress:run-without-security --spec 'cypress/integration/core-opensearch-dashboards/vanilla-opensearch-dashboards/*.js'
wait-on: 'http://localhost:5601'
# Screenshots are only captured on failure, will change this once we do visual regression tests
- uses: actions/upload-artifact@v1
Expand Down
18 changes: 10 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ opensearch-dashboards-test-library is the test utility library used by this proj
"@opensearch-dashboards-test/opensearch-dashboards-test-library": "^1.0.1"
```

You can aslo import from the git repository target branch to use the development code directly
You can also import from the git repository target branch to use the development code directly

```
"@opensearch-dashboards-test/opensearch-dashboards-test-library": "opensearch-project/opensearch-dashboards-test-library#main"
Expand All @@ -48,28 +48,30 @@ $ npm uninstall @opensearch-dashboards-test/opensearch-dashboards-test-library &

### Run Tests

You can run the cypress tests by cli:
You can run the cypress tests by cli. There are some handy sripts in [package.json](package.json) to run the tests with some pre-set configurations.

To run without security:

```
$ npx cypress run --spec "cypress/integration/core-opensearch-dashboards/vanilla-opensearch-dashboards/*.js"
$ yarn cypress run-without-security --spec "cypress/integration/core-opensearch-dashboards/vanilla-opensearch-dashboards/*.js"
```

By default, it uses headless mode (hide the broswer) You can turn on the browser display by:
To run with security:

```
$ npx cypress run --spec "cypress/integration/core-opensearch-dashboards/vanilla-opensearch-dashboards/*.js --headed"
$ yarn cypress run-with-security --spec "cypress/integration/core-opensearch-dashboards/vanilla-opensearch-dashboards/*.js"
```

You can also manually trigger the test via browser UI by:
These tests run in headless mode by default. You can also manually trigger the test via browser UI by running:

```
$ npx cypress open
$ yarn cypress open
```

And you can override certain cypress config or environment variable by appling additional cli arguments, for example to override the baseUrl and OpensearchUrl to test a remote endpoint:

```
$ npx cypress run --spec "cypress/integration/core-opensearch-dashboards/vanilla-opensearch-dashboards/*.js" --env "openSearchUrl=https://foo.com" --config "baseUrl=https://foo.com/_dashboards"
$ yarn cypress run --spec "cypress/integration/core-opensearch-dashboards/vanilla-opensearch-dashboards/*.js" --env "openSearchUrl=https://foo.com" --config "baseUrl=https://foo.com/_dashboards"
```

### Formatting
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"cypress:open": "cypress open",
"cypress:run": "env TZ=America/Los_Angeles cypress run --browser chrome --headless --env SECURITY_ENABLED=false",
"cypress:run-without-security": "env TZ=America/Los_Angeles cypress run --browser chrome --headless --env SECURITY_ENABLED=false",
"cypress:run-with-security": "env TZ=America/Los_Angeles cypress run --browser chrome --headless --env SECURITY_ENABLED=true",
"cypress:run-plugin-tests": "yarn cypress:run --spec 'cypress/integration/plugins/*/*.js'",
"cypress:run-plugin-tests-without-security": "yarn cypress:run-without-security --spec 'cypress/integration/plugins/*/*.js'",
"cypress:run-plugin-tests-with-security": "yarn cypress:run-with-security --spec 'cypress/integration/plugins/*/*.js'"
},
"repository": {
Expand Down

0 comments on commit 03b59b3

Please sign in to comment.