Skip to content

Commit

Permalink
test(ui): add e2e regression test for issue #15239
Browse files Browse the repository at this point in the history
  • Loading branch information
hoorayimhelping committed Oct 25, 2019
1 parent cfa00d8 commit 89b7547
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
34 changes: 33 additions & 1 deletion ui/cypress/e2e/dashboardsView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Dashboard', () => {
})
})

it('can edit a dashboards name', () => {
it("can edit a dashboard's name", () => {
cy.get('@org').then(({id: orgID}: Organization) => {
cy.createDashboard(orgID).then(({body}) => {
cy.fixture('routes').then(({orgs}) => {
Expand Down Expand Up @@ -60,6 +60,38 @@ describe('Dashboard', () => {
cy.getByTestID('cell--view-empty').should('have.length', 1)
})

// fix for https://github.com/influxdata/influxdb/issues/15239
it('retains the cell content after canceling an edit to the cell', () => {
cy.get('@org').then(({id: orgID}: Organization) => {
cy.createDashboard(orgID).then(({body}) => {
cy.fixture('routes').then(({orgs}) => {
cy.visit(`${orgs}/${orgID}/dashboards/${body.id}`)
})
})
})

// Add an empty celly cell
cy.getByTestID('add-cell--button').click()
cy.getByTestID('save-cell--button').click()
cy.getByTestID('cell--view-empty').should('be.visible')

cy.getByTestID('cell--view-empty')
.invoke('text')
.then(cellContent => {
// cellContent is yielded as a cutesy phrase from src/shared/copy/cell

// open Cell Editor Overlay
cy.getByTestID('cell-context-menu--edit').click()
cy.getByTestID('cell-context-menu-item--configure').click()

// Cancel edit
cy.getByTestID('cancel-cell-edit--button').click()

// Cell content should remain
cy.getByTestID('cell--view-empty').contains(cellContent)
})
})

const getSelectedVariable = (contextID: string, variableID: string) => win =>
win.store.getState().variables.values[contextID].values[variableID]
.selectedValue
Expand Down
1 change: 1 addition & 0 deletions ui/src/dashboards/components/VEOHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class VEOHeader extends PureComponent<Props> {
icon={IconFont.Remove}
onClick={onCancel}
size={ComponentSize.Small}
testID="cancel-cell-edit--button"
/>
<SquareButton
className={saveButtonClass}
Expand Down

0 comments on commit 89b7547

Please sign in to comment.