Skip to content

Commit 88cea1a

Browse files
authored
feat(monitor-ci/415): cleanup UI docs for cloud vs oss (#6621)
* chore: cleanup scripts for remocal versus oss, and update readme. * feat(415): get oss-e2es running locally * chore: remove old, unused artifact directories
1 parent 9764e5e commit 88cea1a

File tree

5 files changed

+69
-48
lines changed

5 files changed

+69
-48
lines changed

.circleci/config.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,6 @@ jobs:
158158
- store_artifacts:
159159
path: monitor-ci/test-artifacts/results/cloud-e2e
160160
destination: test_artifacts/results/cloud-e2e
161-
- store_artifacts:
162-
path: monitor-ci/test-artifacts/results/cloud-e2e-firefox
163-
destination: test_artifacts/results/cloud-e2e-firefox
164-
- store_artifacts:
165-
path: monitor-ci/test-artifacts/results/cloud-e2e-k8s-idpe
166-
destination: test_artifacts/results/cloud-e2e-k8s-idpe
167161
- store_artifacts:
168162
path: monitor-ci/test-artifacts/results/cloud-lighthouse
169163
destination: test_artifacts/results/cloud-lighthouse

README.md

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,35 +33,63 @@ To upgrade a single package named `packageName`:
3333
yarn upgrade packageName
3434
```
3535

36-
## Testing
37-
38-
Tests can be run via command line with `yarn test`, from within the `/ui` directory. For more detailed reporting, use `yarn test -- --reporters=verbose`.
36+
## Unit Testing
37+
38+
Unit tests can be run via command line with `yarn test`, from within the `/ui` directory. For more detailed reporting, use `yarn test -- --reporters=verbose`.
39+
40+
41+
## Local dev
42+
43+
**cloud platform**
44+
1. From k8s-idpe, start the remocal service with loopback to your local ui changes.
45+
1. have your remocal instance build and deployed. See [docs here](https://docs.influxdata.io/development/remocal/getting-started/).
46+
1. `make remocal-dev APPS=ui DETACHED=1`
47+
1. From the ui directory. Build the local dev server:
48+
1. set env vars for `PUBLIC` (your remocal url)
49+
1. `yarn install && yarn start:dev:remocal`
50+
1. `yarn link` different javascript libraries (e.g. giraffe, clockface, flux-lsp) as needed.
51+
* note that the flux-lsp wasm build produces an output directory which contains a package.json for the release. Make sure to `yarn link` to this directory.
52+
53+
**oss platform**
54+
1. From oss/influxdb repo, start the backend service.
55+
1. setup service following the [contributing guide](https://github.com/influxdata/influxdb/blob/master/CONTRIBUTING.md#how-to-build-influxdb-from-source).
56+
1. run the service, goto browser `localhost:8086`
57+
1. create a login/password. (Remember these!)
58+
1. **CAVEAT**: influxdb/oss does not have live reload.
59+
* instead, run `make` and restart influxdb
60+
1. From the ui directory. Build the local dev server:
61+
1. `yarn install && yarn start:dev:oss`
62+
1. goto browser `localhost:8080`
63+
1. the same login/password pair should work.
64+
1. **CAVEAT**: live reload does not work, so you need to refresh the browser page.
3965

4066
## Cypress Testing
4167

42-
e2e tests:
43-
For the end to end tests to run properly, the server needs to be running in the e2e testing mode with the in-memory data store.
44-
From the influxdb directory:
45-
`$ ./bin/darwin/influxd --assets-path=ui/build --e2e-testing --store=memory`
68+
**cloud platform**
69+
1. have your local dev running (see above).
70+
1. `export NS=<your-remocal-namespace>`
71+
1. run cypress test:
72+
* `yarn test:e2e:remocal` to test on tsm storage
73+
* `yarn test:e2e:remocal:iox` to test on iox storage
4674

47-
**monitor-ci**
48-
From the ui directory. Build the javascript with
49-
`$ yarn start`
50-
To run Cypress locally with monitor-ci:
51-
`$ yarn cy:dev`
75+
**oss platform**
76+
1. have your local dev running (see above).
77+
* Make sure to start your oss backend service with `--e2e-testing` flag.
78+
1. run cypress test:
79+
* `yarn test:e2e:oss`
5280

53-
**k8s-idpe**
54-
From the ui directory. Build the javascript with
55-
`$ yarn start:kind`
56-
To run Cypress locally with k8s-idpe:
57-
`$ yarn test:e2e:kind`
81+
**Generating Test Reports**
82+
* to run all tests [in series] locally, and generate a report: `yarn test:e2e:<whatever>:report`
83+
* e.g. `yarn test:e2e:remocal:report`, `yarn test:e2e:remocal:iox:report`, `yarn test:e2e:oss:report`
84+
* this will run in headless mode, so no browser will be shown. Just a stdout waiting as each test runs.
85+
* **WARNING**: This takes a long time, unlike CI which runs in parallel.
86+
* after all tests complete, it will automatically open a test result viewer.
87+
* any screenshots or vids will be saved in `cypress/videos` and `cypress/screenshots`
5888

59-
## Starting Dev Server
6089

61-
Running `/ui` locally depends on `monitor-ci` or `k8s-idpe`.
90+
## What is oats?
91+
Oats is how we automatically generate our typescript definitions based open the openapi contract. See [here for more details](https://github.com/influxdata/oats). After one of the `yarn generate` scripts are run, the typescript definitions are usually output to `./src/client/`.
6292

63-
- [Monitor-ci Quickstart](https://github.com/influxdata/monitor-ci#quickstart-for-local-development)
64-
- [Remocal Quickstart](https://docs.influxdata.io/development/remocal/development/#ui-development)
6593

6694
## Zuora Form
6795

cypress/support/commands.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ Cypress.Commands.add(
107107
)
108108

109109
// login via the purple OSS screen by typing in username/password
110-
// this is only used if you're using monitor-ci + DEV_MODE_CLOUD=0
111110
export const loginViaOSS = (username: string, password: string) => {
112111
cy.visit('/')
113112
cy.get('#login').type(username)
@@ -1000,7 +999,8 @@ export const setupUser = (useIox: boolean = false): Cypress.Chainable<any> => {
1000999

10011000
export const flush = (): Cypress.Chainable<Cypress.Response<any>> => {
10021001
const defaultUser = Cypress.env('defaultUser')
1003-
if (defaultUser) {
1002+
const isOssLocalTesting = Cypress.env(DEX_URL_VAR) === 'OSS'
1003+
if (defaultUser && !isOssLocalTesting) {
10041004
return cy
10051005
.request({method: 'POST', url: `/debug/flush?user=${defaultUser}`})
10061006
.then(response => {
@@ -1009,13 +1009,12 @@ export const flush = (): Cypress.Chainable<Cypress.Response<any>> => {
10091009
.log(`flushed user ${defaultUser} successfully`)
10101010
.then(() => response)
10111011
})
1012-
} else {
1013-
// this isn't really needed - just need to return a chainable cypress obj
1014-
return cy.request({method: 'GET', url: '/debug/flush'}).then(response => {
1015-
expect(response.status).to.eq(200)
1016-
return response
1017-
})
10181012
}
1013+
1014+
return cy.request({method: 'GET', url: '/debug/flush'}).then(response => {
1015+
expect(response.status).to.eq(200)
1016+
return response
1017+
})
10191018
}
10201019

10211020
/**

package.json

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
},
1818
"scripts": {
1919
"start": "yarn install && yarn generate && cross-env TS_NODE_PROJECT=\"webpack.tsconfig.json\" && yarn run start:dev",
20-
"start:cloud": "yarn install && yarn generate && cross-env TS_NODE_PROJECT=\"webpack.tsconfig.json\" && yarn run start:dev-cloud",
2120
"start:dev": "webpack-dev-server --config ./webpack.dev.ts",
22-
"start:dev-cloud": "cross-env CLOUD_LOGOUT_URL=http://localhost:8080/api/v2/signout CLOUD_URL=http://localhost:4000 webpack-dev-server --config ./webpack.dev.ts",
21+
"start:dev:oss": "yarn start:dev",
22+
"start:dev:remocal": "NODE_ENV=development UI_SHA=local_dev_mode BASE_PATH=/ API_BASE_PATH=/ PORT=8080 PUBLIC=${PUBLIC:-https://twodotoh.a.influxcloud.dev.local/} CLOUD_URL=/auth yarn start",
23+
"start:kind": "echo 'please start using `yarn start:dev:remocal`' && yarn start:dev:remocal",
2324
"start:docker": "yarn generate && yarn run start:dev",
24-
"start:kind": "NODE_ENV=development UI_SHA=local_dev_mode BASE_PATH=/ API_BASE_PATH=/ PORT=8080 PUBLIC=${PUBLIC:-https://twodotoh.a.influxcloud.dev.local/} CLOUD_URL=/auth yarn start",
2525
"build": "yarn install --silent && yarn build:ci",
2626
"build:ci": "yarn generate && webpack --config webpack.prod.ts",
2727
"build:fast": "webpack --config webpack.fast.ts",
@@ -31,14 +31,16 @@
3131
"test:watch": "jest --watch --verbose false",
3232
"test:update": "jest --updateSnapshot",
3333
"test:debug": "node --inspect-brk $(npm bin)/jest --runInBand --watch --verbose false",
34-
"test:e2e": "CYPRESS_dexUrl=https://$INGRESS_HOST:$PORT_HTTPS CYPRESS_baseUrl=http://localhost:9999 cypress run --browser chrome --reporter junit --reporter-options 'mochaFile=junit-results/test-output-[hash].xml'",
35-
"test:e2e:ci": "CYPRESS_dexUrl=https://$INGRESS_HOST:$PORT_HTTPS CYPRESS_baseUrl=https://localhost:443 cypress run --parallel --browser chrome --reporter junit --reporter-options 'mochaFile=junit-results/test-output-[hash].xml'",
36-
"test:e2e:report": "junit-viewer --results=junit-results --save-file=cypress/site/junit-report.html",
37-
"test:e2e:clean": "rm junit-results/*.xml",
38-
"test:e2e:all": "yarn test:e2e:clean && yarn test:e2e; yarn test:e2e:report;",
39-
"test:e2e:kind": "CYPRESS_dexUrl=http://dex-twodotoh.a.influxcloud.dev.local CYPRESS_baseUrl=https://twodotoh.a.influxcloud.dev.local CYPRESS_password=password cypress open --browser chrome --config chromeWebSecurity=false",
40-
"test:e2e:remocal": "CYPRESS_dexUrl=https://dex-${NS}.remocal.influxdev.co CYPRESS_baseUrl=https://${NS}.remocal.influxdev.co CYPRESS_password=password cypress open --browser chrome --config chromeWebSecurity=false",
34+
"test:e2e:open": "CYPRESS_password=password cypress open --browser chrome --config chromeWebSecurity=false",
35+
"test:e2e:closed": "CYPRESS_password=password cypress run --browser chrome --config chromeWebSecurity=false --reporter junit --reporter-options 'mochaFile=junit-results/test-output-[hash].xml'",
36+
"test:e2e:report": "junit-viewer --results=junit-results --save-file=junit-results/junit-report.html && open ./junit-results/junit-report.html",
37+
"test:e2e:clean": "rm -rf cypress/screenshots && rm -rf cypress/videos && rm -f junit-results/*",
38+
"test:e2e:oss": "CYPRESS_dexUrl=OSS CYPRESS_baseUrl=http://localhost:8080 yarn test:e2e:open -- --config testFiles='{oss,shared}/**/*.*'",
39+
"test:e2e:oss:report": "yarn test:e2e:clean && CYPRESS_dexUrl=OSS CYPRESS_baseUrl=http://localhost:8080 yarn test:e2e:closed -- --config testFiles='{oss,shared}/**/*.*'; yarn test:e2e:report;",
40+
"test:e2e:remocal": "CYPRESS_dexUrl=https://dex-${NS}.remocal.influxdev.co CYPRESS_baseUrl=https://${NS}.remocal.influxdev.co yarn test:e2e:open -- --config testFiles='{cloud,shared}/**/*.*'",
4141
"test:e2e:remocal:iox": "CYPRESS_useIox=true yarn test:e2e:remocal",
42+
"test:e2e:remocal:report": "yarn test:e2e:clean && CYPRESS_dexUrl=https://dex-${NS}.remocal.influxdev.co CYPRESS_baseUrl=https://${NS}.remocal.influxdev.co yarn test:e2e:closed -- --config testFiles='{cloud,shared}/**/*.*'; yarn test:e2e:report;",
43+
"test:e2e:remocal:iox:report": "CYPRESS_useIox=true yarn test:e2e:remocal:report",
4244
"test:circleci": "yarn run test:ci --runInBand",
4345
"test:ci": "JEST_JUNIT_OUTPUT_DIR=\"./coverage\" jest --ci --coverage",
4446
"lint": "yarn tsc && yarn prettier && yarn eslint",
@@ -50,9 +52,6 @@
5052
"prettier:fix": "pretty-quick --config .prettierrc.json --write '{src,cypress}/**/*.{ts,tsx}'",
5153
"tsc": "tsc -p ./tsconfig.json --noEmit --pretty --skipLibCheck",
5254
"tsc:watch": "yarn tsc --watch",
53-
"cy": "CYPRESS_dexUrl=https://$INGRESS_HOST:$PORT_HTTPS CYPRESS_baseUrl=http://localhost:9999 cypress open",
54-
"cy:dev": "source ../monitor-ci/.env && CYPRESS_dexUrl=CLOUD CYPRESS_baseUrl=https://$INGRESS_HOST:$PORT_HTTPS cypress open --config testFiles='{cloud,shared}/**/*.*'",
55-
"cy:dev-oss": "source ../monitor-ci/.env && CYPRESS_dexUrl=OSS CYPRESS_baseUrl=https://$INGRESS_HOST:$PORT_HTTPS cypress open --config testFiles='{oss,shared}/**/*.*'",
5655
"generate": "export SHA=db14de0d91be00e75eb946d768e88d771b20a2a9 && export REMOTE=https://raw.githubusercontent.com/influxdata/openapi/${SHA}/ && yarn generate-meta",
5756
"generate-local": "export REMOTE=../openapi/ && yarn generate-meta",
5857
"generate-local-cloud": "export REMOTE=../openapi/ && yarn generate-meta-cloud",

webpack.dev.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = mergeDev(commonDev, {
2828
proxy: {
2929
'/api/v2': 'http://localhost:8086',
3030
'/debug/flush': 'http://localhost:8086',
31+
'/debug/provision': 'http://localhost:8086',
3132
'/oauth': 'http://localhost:8086',
3233
'/health': 'http://localhost:8086',
3334
},

0 commit comments

Comments
 (0)