Skip to content

Commit

Permalink
test: fix flaky explorer tests by targeting .CodeMirror and not force…
Browse files Browse the repository at this point in the history
… typing
  • Loading branch information
hoorayimhelping committed Jan 3, 2020
1 parent 2ee493f commit 90cbfd2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ node_modules:

e2e: node_modules
yarn generate
yarn test:junit
yarn test:e2e

build: node_modules $(UISOURCES)
yarn build
Expand Down
21 changes: 9 additions & 12 deletions ui/cypress/e2e/explorer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ describe('DataExplorer', () => {
})
})

// todo: investigate flakiness of this test: https://github.com/influxdata/influxdb/issues/16330
describe.skip('raw script editing', () => {
describe('raw script editing', () => {
beforeEach(() => {
cy.getByTestID('switch-to-script-editor').click()
})
Expand All @@ -359,16 +358,16 @@ describe('DataExplorer', () => {
cy.getByTestID('time-machine-submit-button').should('be.disabled')

cy.getByTestID('flux-editor').within(() => {
cy.get('textarea').type('yo', {force: true})
cy.get('.CodeMirror').type('yo')
cy.getByTestID('time-machine-submit-button').should('not.be.disabled')
})
})

it('disables submit when a query is deleted', () => {
cy.getByTestID('time-machine--bottom').then(() => {
cy.get('textarea').type('from(bucket: "foo")', {force: true})
cy.get('.CodeMirror').type('from(bucket: "foo")')
cy.getByTestID('time-machine-submit-button').should('not.be.disabled')
cy.get('textarea').type('{selectall} {backspace}', {force: true})
cy.get('.CodeMirror').type('{selectall} {backspace}')
})

cy.getByTestID('time-machine-submit-button').should('be.disabled')
Expand Down Expand Up @@ -450,11 +449,10 @@ describe('DataExplorer', () => {

it('shows the empty state when the query returns no results', () => {
cy.getByTestID('time-machine--bottom').within(() => {
cy.get('textarea').type(
cy.get('.CodeMirror').type(
`from(bucket: "defbuck")
|> range(start: -10s)
|> filter(fn: (r) => r._measurement == "no exist")`,
{force: true}
|> filter(fn: (r) => r._measurement == "no exist")`
)
cy.getByTestID('time-machine-submit-button').click()
})
Expand All @@ -466,11 +464,10 @@ describe('DataExplorer', () => {
const taskName = 'tax'
// begin flux
cy.getByTestID('flux-editor').within(() => {
cy.get('textarea').type(
cy.get('.CodeMirror').type(
`from(bucket: "defbuck")
|> range(start: -15m, stop: now())
|> filter(fn: (r) => r._measurement == `,
{force: true}
|> filter(fn: (r) => r._measurement == `
)
})

Expand All @@ -479,7 +476,7 @@ describe('DataExplorer', () => {
cy.get('.variables-toolbar--label').click()
// finish flux
cy.getByTestID('flux-editor').within(() => {
cy.get('textarea').type(`)`, {force: true})
cy.get('.CodeMirror').type(`)`)
})

cy.getByTestID('save-query-as').click()
Expand Down
8 changes: 4 additions & 4 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
"test:watch": "jest --watch --verbose false",
"test:update": "jest --updateSnapshot",
"test:debug": "node --inspect-brk $(npm bin)/jest --runInBand --watch --verbose false",
"test:junit": "CYPRESS_baseUrl=http://localhost:9999 cypress run --browser chrome --reporter junit --reporter-options 'mochaFile=junit-results/test-output-[hash].xml'",
"test:ju:report": "junit-viewer --results=junit-results --save-file=cypress/site/junit-report.html",
"test:ju:clean": "rm junit-results/*.xml",
"test:ju:all": "yarn test:ju:clean && yarn test:junit; yarn test:ju:report;",
"test:e2e": "CYPRESS_baseUrl=http://localhost:9999 cypress run --browser chrome --reporter junit --reporter-options 'mochaFile=junit-results/test-output-[hash].xml'",
"test:e2e:report": "junit-viewer --results=junit-results --save-file=cypress/site/junit-report.html",
"test:e2e:clean": "rm junit-results/*.xml",
"test:e2e:all": "yarn test:e2e:clean && yarn test:e2e; yarn test:e2e:report;",
"test:circleci": "yarn run test:ci --maxWorkers=2",
"test:ci": "JEST_JUNIT_OUTPUT_DIR=\"./coverage\" jest --ci --coverage",
"lint": "yarn tsc && yarn prettier && yarn eslint",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ describe('Onboarding.Components.DataListening', () => {
describe('if button is clicked', () => {
it('displays connection information', () => {
const {getByTitle, getByText} = renderWithRedux(
<DataListening bucket="bucket" />)
<DataListening bucket="bucket" />
)

const button = getByTitle('Listen for Data')

Expand Down

0 comments on commit 90cbfd2

Please sign in to comment.