From 89b7547b2554cbc6ff0bfdaba2d2e55b62dfb87a Mon Sep 17 00:00:00 2001 From: Bucky Schwarz Date: Fri, 25 Oct 2019 15:02:20 -0700 Subject: [PATCH] test(ui): add e2e regression test for issue #15239 --- ui/cypress/e2e/dashboardsView.test.ts | 34 +++++++++++++++++++++- ui/src/dashboards/components/VEOHeader.tsx | 1 + 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/ui/cypress/e2e/dashboardsView.test.ts b/ui/cypress/e2e/dashboardsView.test.ts index cf6f6fd86d1..b0703e0626a 100644 --- a/ui/cypress/e2e/dashboardsView.test.ts +++ b/ui/cypress/e2e/dashboardsView.test.ts @@ -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}) => { @@ -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 diff --git a/ui/src/dashboards/components/VEOHeader.tsx b/ui/src/dashboards/components/VEOHeader.tsx index 9f838610139..a2e8fcd5f0c 100644 --- a/ui/src/dashboards/components/VEOHeader.tsx +++ b/ui/src/dashboards/components/VEOHeader.tsx @@ -49,6 +49,7 @@ class VEOHeader extends PureComponent { icon={IconFont.Remove} onClick={onCancel} size={ComponentSize.Small} + testID="cancel-cell-edit--button" />