Skip to content

Commit dbe90ed

Browse files
authored
fix: flaky behavior of previously added test (#2893)
* fix: repair null file download * fix: adjust test for new version of UI * chore: remove test skipping in Firefox * chore: run prettier to correct formating
1 parent 5215eec commit dbe90ed

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

cypress/e2e/shared/dashboardsIndex.test.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ describe('Dashboards', () => {
1010
cy.flush().then(() =>
1111
cy.signin().then(() =>
1212
cy.fixture('routes').then(({orgs}) => {
13-
cy.get<Organization>('@org').then(({id}: Organization) => {
14-
cy.visit(`${orgs}/${id}/dashboards-list`)
13+
cy.get('@org').then(({id: orgID}: Organization) => {
14+
cy.visit(`${orgs}/${orgID}/dashboards-list`)
1515
cy.getByTestID('tree-nav')
16-
cy.exec('rm cypress/downloads/*', {
17-
log: true,
18-
failOnNonZeroExit: false,
19-
})
2016
})
2117
})
2218
)
@@ -553,23 +549,34 @@ describe('Dashboards', () => {
553549
})
554550
})
555551

556-
// Skipping until https://github.com/influxdata/ui/issues/2864 is resolved by Bonitoo
557-
it.skip('creates a dashboard and downloads JSON', () => {
552+
before(() =>
553+
cy.exec('rm cypress/downloads/*', {
554+
log: true,
555+
failOnNonZeroExit: false,
556+
})
557+
)
558+
559+
it('creates a dashboard and downloads JSON', () => {
558560
cy.get('@org').then(({id: orgID}: Organization) => {
559561
cy.createDashboard(orgID).then(({body}) => {
560562
cy.fixture('routes').then(({orgs}) => {
561563
cy.visit(`${orgs}/${orgID}/dashboards/${body.id}`)
562-
cy.getByTestID('tree-nav')
563564
cy.getByTestID('nav-item-dashboards').click()
564565
cy.getByTestID('dashboard-card--name').click()
565566
cy.getByTestID('page-title').type('dashboard') // dashboard name added to prevent failure due to downloading JSON with a different name
567+
cy.getByTestID('add-note--button').click()
568+
cy.getByTestID('note-editor--overlay').should('be.visible')
569+
cy.getByTestID('markdown-editor').type('test note added')
570+
cy.getByTestID('save-note--button').click() // note added to add content to be downloaded in the JSON file
566571
cy.getByTestID('nav-item-dashboards').click()
567572
cy.getByTestID('dashboard-card').invoke('hover')
568573
cy.getByTestID('context-menu-dashboard').click()
569574
cy.getByTestID('context-export-dashboard').click()
575+
cy.getByTestID('form-container').should('be.visible')
576+
cy.getByTestID('export-overlay--text-area').should('be.visible')
570577
cy.getByTestID('button').click()
571578
// readFile has a 4s timeout before the test fails
572-
cy.readFile('cypress/downloads/dashboard.json').should('exist')
579+
cy.readFile('cypress/downloads/dashboard.json').should('not.be.null')
573580
})
574581
})
575582
})

0 commit comments

Comments
 (0)