Skip to content

Commit b8d65ad

Browse files
authored
fix: make legends test support iox (#6591)
1 parent 022199e commit b8d65ad

File tree

5 files changed

+35
-16
lines changed

5 files changed

+35
-16
lines changed

cypress/e2e/shared/legends.test.ts

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,26 @@ const VIS_TYPES = [
1313
'table',
1414
]
1515

16-
describe.skip('Legends', () => {
16+
const CLOUD = Cypress.env('dexUrl') === 'OSS' ? false : true
17+
18+
const dataExplorerFeatureFlags = {
19+
showDashboardsInNewIOx: true,
20+
showOldDataExplorerInNewIOx: true,
21+
showTasksInNewIOx: true,
22+
}
23+
24+
// Absence of this feature (legends - old data explorer) in IOx is tested
25+
// in the Data Explorer tests.
26+
describe('Legends', () => {
1727
describe('in the Data Explorer', () => {
1828
beforeEach(() => {
1929
cy.flush()
2030
cy.signin()
31+
32+
if (CLOUD) {
33+
cy.setFeatureFlags(dataExplorerFeatureFlags)
34+
}
35+
2136
cy.get('@org').then(({id}: Organization) => {
2237
cy.createMapVariable(id)
2338
cy.fixture('routes').then(({orgs, explorer}) => {
@@ -348,8 +363,7 @@ describe.skip('Legends', () => {
348363
)
349364
})
350365

351-
// Skip for now because Firefox does not run the test correctly with a newly created cell with query and view options included
352-
it.skip('saves to a dashboard as a cell with the static legend options open and with the query pre-submitted', () => {
366+
it('saves to a dashboard as a cell with the static legend options open and with the query pre-submitted', () => {
353367
const cellName = 'anti-crash test pre-submitted data explorer'
354368
cy.writeData(points(100))
355369

@@ -411,10 +425,19 @@ describe.skip('Legends', () => {
411425
})
412426
})
413427

428+
const dashboardsFeatureFlags = {
429+
showDashboardsInNewIOx: true,
430+
}
431+
414432
describe('in Dashboards', () => {
415433
beforeEach(() => {
416434
cy.flush()
417435
cy.signin()
436+
437+
if (CLOUD) {
438+
cy.setFeatureFlags(dashboardsFeatureFlags)
439+
}
440+
418441
cy.fixture('routes').then(({orgs}) => {
419442
cy.get('@org').then(({id}: Organization) => {
420443
cy.visit(`${orgs}/${id}/dashboards-list`)
@@ -475,16 +498,15 @@ describe.skip('Legends', () => {
475498
.click()
476499
.type(cellName + '{enter}')
477500

478-
// Without submitting the query, save it to a dashboard
501+
cy.get('.veo-contents').click() // click out of inline editor
479502
cy.getByTestID('save-cell--button').click()
480503
cy.get('.cell--name').should('have.text', cellName)
481504
cy.getByTestID('giraffe-legend-table').should('not.exist')
482505
}
483506
)
484507
})
485508

486-
// Skip for now because Firefox does not run the test correctly with a newly created cell with query and view options included
487-
it.skip('adds a new cell to a dashboard with the static legend options open and with the query pre-submitted', () => {
509+
it('adds a new cell to a dashboard with the static legend options open and with the query pre-submitted', () => {
488510
const cellName = 'anti-crash test pre-submitted dashboard add cell'
489511
cy.writeData(points(100))
490512

@@ -540,6 +562,7 @@ describe.skip('Legends', () => {
540562
cy.getByTestID('page-header').click().type(cellName)
541563

542564
// Save it to a dashboard
565+
cy.get('.veo-contents').click() // click out of inline editor
543566
cy.getByTestID('save-cell--button').click()
544567
cy.get('.cell--name').should('have.text', cellName)
545568
cy.getByTestID('giraffe-legend-table').should('be.visible')

src/dataExplorer/components/DataExplorerPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import {
1515
InputLabel,
1616
SlideToggle,
1717
} from '@influxdata/clockface'
18-
import SaveAsButton from 'src/dataExplorer/components/SaveAsButton'
18+
import {SaveAsButton} from 'src/dataExplorer/components/SaveAsButton'
1919
import VisOptionsButton from 'src/timeMachine/components/VisOptionsButton'
2020
import GetResources from 'src/resources/components/GetResources'
2121
import TimeZoneDropdown from 'src/shared/components/TimeZoneDropdown'
22-
import SaveAsOverlay from 'src/dataExplorer/components/SaveAsOverlay'
22+
import {SaveAsOverlay} from 'src/dataExplorer/components/SaveAsOverlay'
2323
import ViewTypeDropdown from 'src/timeMachine/components/ViewTypeDropdown'
2424
import {AddAnnotationDEOverlay} from 'src/overlays/components/index'
2525
import {EditAnnotationDEOverlay} from 'src/overlays/components/index'
@@ -137,7 +137,7 @@ const DataExplorerPage: FC = () => {
137137
(scriptQueryBuilder && isFlagEnabled('newDataExplorer')) || isNewIOxOrg
138138

139139
const shouldShowSaveAsButton =
140-
!isNewIOxOrg ||
140+
!useSelector(selectIsNewIOxOrg) ||
141141
shouldShowNotebooks ||
142142
isFlagEnabled('showTasksInNewIOx') ||
143143
isFlagEnabled('showDashboardsInNewIOx') ||

src/dataExplorer/components/SaveAsButton.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {screen} from '@testing-library/react'
44
import {renderWithReduxAndRouter} from 'src/mockState'
55

66
// Components
7-
import SaveAsButton from 'src/dataExplorer/components/SaveAsButton'
7+
import {SaveAsButton} from 'src/dataExplorer/components/SaveAsButton'
88

99
const setup = () => {
1010
renderWithReduxAndRouter(<SaveAsButton />)

src/dataExplorer/components/SaveAsButton.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {useHistory, useLocation} from 'react-router-dom'
55
// Components
66
import {IconFont, Button, ComponentColor} from '@influxdata/clockface'
77

8-
const SaveAsButton: FC = () => {
8+
export const SaveAsButton: FC = () => {
99
const history = useHistory()
1010
const {pathname} = useLocation()
1111

@@ -24,5 +24,3 @@ const SaveAsButton: FC = () => {
2424
/>
2525
)
2626
}
27-
28-
export default SaveAsButton

src/dataExplorer/components/SaveAsOverlay.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ enum SaveAsOption {
3131
Variable = 'variable',
3232
}
3333

34-
const SaveAsOverlay: FC = () => {
34+
export const SaveAsOverlay: FC = () => {
3535
const history = useHistory()
3636
const isNewIOxOrg = useSelector(selectIsNewIOxOrg)
3737
const shouldShowNotebooks = useSelector(selectShouldShowNotebooks)
@@ -139,5 +139,3 @@ const SaveAsOverlay: FC = () => {
139139
</Overlay>
140140
)
141141
}
142-
143-
export default SaveAsOverlay

0 commit comments

Comments
 (0)