Merge pull request #13378 from influxdata/fix/dashboards-test

fix(tests): fix flaky dashboards e2e test
pull/13412/head
Alirie Gray 2019-04-15 11:44:54 -07:00 committed by GitHub
commit 401ec79bff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -65,6 +65,8 @@ describe('Dashboards', () => {
cy.getByTestID('card-select-Bashboard-Template').click()
cy.getByTestID('template-panel').should('exist')
cy.getByTestID('create-dashboard-button').click()
cy.getByTestID('dashboard-card').should('have.length', 1)

View File

@ -11,6 +11,7 @@ import {
Panel,
EmptyState,
ComponentSize,
ComponentStatus,
} from '@influxdata/clockface'
import {Overlay, ResponsiveGridSizer} from 'src/clockface'
import {
@ -80,7 +81,10 @@ class DashboardImportFromTemplateOverlay extends PureComponent<
</GetResources>
{!selectedTemplateSummary && this.emptyState}
{selectedTemplateSummary && (
<Panel className="import-template-overlay--details">
<Panel
className="import-template-overlay--details"
testID="template-panel"
>
<Panel.Header
title={_.get(selectedTemplateSummary, 'meta.name')}
/>
@ -132,6 +136,11 @@ class DashboardImportFromTemplateOverlay extends PureComponent<
text="Create Dashboard"
onClick={this.onSubmit}
key="submit-button"
status={
this.state.selectedTemplate
? ComponentStatus.Default
: ComponentStatus.Disabled
}
testID="create-dashboard-button"
color={ComponentColor.Primary}
/>,
@ -189,9 +198,9 @@ class DashboardImportFromTemplateOverlay extends PureComponent<
private selectTemplate = (
selectedTemplateSummary: TemplateSummary
) => async (): Promise<void> => {
this.setState({selectedTemplateSummary})
const selectedTemplate = await getTemplateByID(selectedTemplateSummary.id)
this.setState({
selectedTemplateSummary,
selectedTemplate,
variables: this.getVariablesForTemplate(selectedTemplate),
cells: this.getCellsForTemplate(selectedTemplate),