Skip to content

Commit

Permalink
add config to support remote endpoint test (#27)
Browse files Browse the repository at this point in the history
Signed-off-by: Tengda He <tengh@amazon.com>
  • Loading branch information
Tengda-He authored Nov 16, 2021
1 parent 6164d43 commit 4c2c219
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
cypress/videos/
cypress/results/
.DS_Store
**/.DS_Store
**/.DS_Store

29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
- [Contributing to OpenSearch](#contributing-to-opensearch)
- [Developer Guide](#developer-guide)
- [Run Tests](#run-tests)
- [First Things First](#first-things-first)
- [Ways to Contribute](#ways-to-contribute)
- [Bug Reports](#bug-reports)
Expand All @@ -13,6 +15,33 @@

OpenSearch is a community project that is built and maintained by people just like **you**. We're glad you're interested in helping out. There are several different ways you can do it, but before we talk about that, let's talk about how to get started.

## Developer Guide

### Run Tests

You can run the cypress tests by cli:

```
$ npx cypress run --spec "cypress/integration/security-disabled/*.js"
```

By default, it uses headless mode (hide the broswer) You can turn on the brower display by:

```
$ npx cypress run --spec "cypress/integration/security-disabled/*.js --headed"
```

You can also manually trigger the test via browser UI by:

```
$ npx 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/security-disabled/*.js" --env "openSearchUrl=https://foo.com" --config "baseUrl=https://foo.com/_dashboards"
```

## First Things First

1. **When in doubt, open an issue** - For almost any type of contribution, the first step is opening an issue. Even if you think you already know what the solution is, writing down a description of the problem you're trying to solve will help everyone get context when they review your pull request. If it's truly a trivial change (e.g. spelling error), you can skip this step -- but as the subject says, when it doubt, [open an issue](issues).
Expand Down
5 changes: 5 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@
"reporter": "cypress-multi-reporters",
"reporterOptions": {
"configFile": "reporter-config.json"
},
"env": {
"openSearchUrl": "http://localhost:9200",
"userName": "admin",
"password": "admin"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { TestFixtureHandler, CommonUI, DashboardPage, MiscUtils } from '@opensea
* 8) Test adding another pie graph to the dashboard and applying a filter to both graphs
*/

const testFixtureHandler = new TestFixtureHandler(cy)
const testFixtureHandler = new TestFixtureHandler(cy, Cypress.env('openSearchUrl'))
const commonUI = new CommonUI(cy)
const dashboardPage = new DashboardPage(cy)
const miscUtils = new MiscUtils(cy)
Expand Down
6 changes: 3 additions & 3 deletions cypress/integration/security-enabled/login-page-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ const loginPage = new LoginPage(cy);

describe('login into security enabled cluster', () => {
beforeEach(() => {
cy.visit('localhost:5601');
cy.visit('/');
})

it('type user name and password to login', () => {
loginPage.enterUserName('admin')
loginPage.enterUserName(Cypress.env('userName'))

loginPage.enterPassword('admin')
loginPage.enterPassword(Cypress.env('password'))

loginPage.submit()

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"homepage": "https://github.com/opensearch-project/opensearch-dashboards-functional-test",
"dependencies": {
"@opensearch-dashboards-test/opensearch-dashboards-test-library": "^1.0.2"
"@opensearch-dashboards-test/opensearch-dashboards-test-library": "^1.0.3"
},
"devDependencies": {
"cypress": "^6.9.1",
Expand Down

0 comments on commit 4c2c219

Please sign in to comment.