Solution and cypress testing documentation

The solution for the issue is present as well as the cypress testing documentation
pull/15355/head
Zoe Steinkamp 2019-10-07 13:05:14 -06:00
parent 5afb613fce
commit a40f77c0ac
4 changed files with 22 additions and 3 deletions

View File

@ -37,6 +37,19 @@ yarn upgrade packageName
Tests can be run via command line with `yarn test`, from within the `/ui` directory. For more detailed reporting, use `yarn test -- --reporters=verbose`.
## Cypress Testing
e2e tests:
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.
From the influxdb directory
`$ ./bin/darwin/influxd --assets-path=ui/build --e2e-testing --store=memory`
From the ui directory. Build the javascript with
`$ yarn start`
To run Cypress locally
`$ yarn cy:dev`
## Starting Dev Server
The assets are built by running `yarn start` from withing the `/ui` directory. The dev server with hot reloading runs at `localhost:8080`.

View File

View File

@ -1,5 +1,7 @@
// Libraries
import {Dispatch} from 'react'
import {push} from 'react-router-redux'
// Constants
import * as copy from 'src/shared/copy/notifications'
@ -68,8 +70,7 @@ export const removeLabelFromCheck = (checkID: string, label: Label) => ({
})
export const getChecks = () => async (
dispatch: Dispatch<
Action | NotificationAction | ReturnType<typeof checkChecksLimits>
dispatch: Dispatch<Action | NotificationAction | ReturnType<typeof checkChecksLimits>
>,
getState: GetState
) => {
@ -97,14 +98,18 @@ export const getChecks = () => async (
}
export const getCheckForTimeMachine = (checkID: string) => async (
dispatch: Dispatch<TimeMachineAction | NotificationAction>
dispatch: Dispatch<TimeMachineAction | NotificationAction>, getState: GetState
) => {
try {
dispatch(setCheckStatus(RemoteDataState.Loading))
const {
orgs: {org}
} = getState()
const resp = await api.getCheck({checkID})
if (resp.status !== 200) {
dispatch(push(`/orgs/${org.id}/alerting`))
throw new Error(resp.data.message)
}

View File

@ -163,6 +163,7 @@ class Root extends PureComponent {
<Route path="/">
<IndexRoute component={RouteToOrg} />
<Route path="orgs" component={App}>
<Route path="new" component={CreateOrgOverlay} />
<Route path=":orgID" component={SetOrg}>
<IndexRoute component={MePage} />