Test(explorer): add end-to-end test for buckets in dropdown in query builder

pull/12312/head
Alirie Gray 2019-03-01 14:55:27 -08:00
parent c0a155f679
commit 2c3fb1fe5f
2 changed files with 17 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import {Doc} from 'codemirror' import {Doc} from 'codemirror'
import {Organization} from '@influxdata/influx'
import {FROM, RANGE, MEAN} from '../../src/shared/constants/fluxFunctions' import {FROM, RANGE, MEAN} from '../../src/shared/constants/fluxFunctions'
interface HTMLElementCM extends HTMLElement { interface HTMLElementCM extends HTMLElement {
@ -13,7 +14,9 @@ describe('DataExplorer', () => {
beforeEach(() => { beforeEach(() => {
cy.flush() cy.flush()
cy.signin() cy.signin().then(({body}) => {
cy.wrap(body.org).as('org')
})
cy.fixture('routes').then(({explorer}) => { cy.fixture('routes').then(({explorer}) => {
cy.visit(explorer) cy.visit(explorer)
@ -104,9 +107,20 @@ describe('DataExplorer', () => {
}) })
describe('query builder', () => { describe('query builder', () => {
it('show an empty state for tag keys when the bucket is empty', () => { it('shows an empty state for tag keys when the bucket is empty', () => {
cy.getByTestID('empty-tag-keys').should('exist') cy.getByTestID('empty-tag-keys').should('exist')
}) })
it('shows the correct number of buckets in the buckets dropdown', () => {
cy.get<Organization>('@org').then(({id, name}) => {
cy.createBucket(id, name, 'newBucket')
})
cy.getByTestID('buckets--button').click()
cy.getByTestID('dropdown--item defbuck').should('exist')
cy.getByTestID('dropdown--item newBucket').should('exist')
})
}) })
describe('visualizations', () => { describe('visualizations', () => {

View File

@ -14,7 +14,7 @@ interface Props {
selected?: boolean selected?: boolean
checkbox?: boolean checkbox?: boolean
onClick?: (value: any) => void onClick?: (value: any) => void
testid?: string testID?: string
} }
@ErrorHandling @ErrorHandling