Skip to content

Commit

Permalink
Merge pull request #13378 from influxdata/fix/dashboards-test
Browse files Browse the repository at this point in the history
fix(tests): fix flaky dashboards e2e test
  • Loading branch information
AlirieGray authored Apr 15, 2019
2 parents f24db5e + 0bd62f4 commit 401ec79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ui/cypress/e2e/dashboardsIndex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Panel,
EmptyState,
ComponentSize,
ComponentStatus,
} from '@influxdata/clockface'
import {Overlay, ResponsiveGridSizer} from 'src/clockface'
import {
Expand Down Expand Up @@ -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')}
/>
Expand Down Expand Up @@ -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}
/>,
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 401ec79

Please sign in to comment.