From 89c453a7e785df2008f6804311ff637984a138d9 Mon Sep 17 00:00:00 2001 From: dfldr Date: Tue, 26 Oct 2021 12:59:40 +0200 Subject: [PATCH 1/4] fix: repair null file download --- cypress/e2e/shared/dashboardsIndex.test.ts | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/cypress/e2e/shared/dashboardsIndex.test.ts b/cypress/e2e/shared/dashboardsIndex.test.ts index 2836d7d4f0..7644bb0dbd 100644 --- a/cypress/e2e/shared/dashboardsIndex.test.ts +++ b/cypress/e2e/shared/dashboardsIndex.test.ts @@ -13,10 +13,6 @@ describe('Dashboards', () => { cy.get('@org').then(({id}: Organization) => { cy.visit(`${orgs}/${id}/dashboards-list`) cy.getByTestID('tree-nav') - cy.exec('rm cypress/downloads/*', { - log: true, - failOnNonZeroExit: false, - }) }) }) ) @@ -552,9 +548,14 @@ describe('Dashboards', () => { }) }) }) + before(() => + cy.exec('rm cypress/downloads/*', { + log: true, + failOnNonZeroExit: false, + }) + ) - // Skipping until https://github.com/influxdata/ui/issues/2864 is resolved by Bonitoo - it.skip('creates a dashboard and downloads JSON', () => { + it('creates a dashboard and downloads JSON', {browser: '!firefox'}, () => { cy.get('@org').then(({id: orgID}: Organization) => { cy.createDashboard(orgID).then(({body}) => { cy.fixture('routes').then(({orgs}) => { @@ -563,13 +564,21 @@ describe('Dashboards', () => { cy.getByTestID('nav-item-dashboards').click() cy.getByTestID('dashboard-card--name').click() cy.getByTestID('page-title').type('dashboard') // dashboard name added to prevent failure due to downloading JSON with a different name + cy.getByTestID('add-note--button').click() + cy.getByTestID('note-editor--overlay').should('be.visible') + cy.getByTestID('markdown-editor').type('test note added') + cy.getByTestID('save-note--button').click() // note added to add content to be downloaded in the JSON file cy.getByTestID('nav-item-dashboards').click() cy.getByTestID('dashboard-card').invoke('hover') cy.getByTestID('context-menu-dashboard').click() cy.getByTestID('context-export-dashboard').click() + cy.getByTestID('context-export-menu').click() + cy.getByTestID('context-menu-item-export').click() + cy.getByTestID('form-container').should('be.visible') + cy.getByTestID('export-overlay--text-area').should('be.visible') cy.getByTestID('button').click() // readFile has a 4s timeout before the test fails - cy.readFile('cypress/downloads/dashboard.json').should('exist') + cy.readFile('cypress/downloads/dashboard.json') }) }) }) From 89a86d4d9469fcc4bac77405fc07f8280d3e4f6c Mon Sep 17 00:00:00 2001 From: dfldr Date: Fri, 29 Oct 2021 16:20:45 +0200 Subject: [PATCH 2/4] fix: adjust test for new version of UI --- cypress/e2e/shared/dashboardsIndex.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cypress/e2e/shared/dashboardsIndex.test.ts b/cypress/e2e/shared/dashboardsIndex.test.ts index 7644bb0dbd..53d4d020da 100644 --- a/cypress/e2e/shared/dashboardsIndex.test.ts +++ b/cypress/e2e/shared/dashboardsIndex.test.ts @@ -572,13 +572,11 @@ describe('Dashboards', () => { cy.getByTestID('dashboard-card').invoke('hover') cy.getByTestID('context-menu-dashboard').click() cy.getByTestID('context-export-dashboard').click() - cy.getByTestID('context-export-menu').click() - cy.getByTestID('context-menu-item-export').click() cy.getByTestID('form-container').should('be.visible') cy.getByTestID('export-overlay--text-area').should('be.visible') cy.getByTestID('button').click() // readFile has a 4s timeout before the test fails - cy.readFile('cypress/downloads/dashboard.json') + cy.readFile('cypress/downloads/dashboard.json').should('not.be.null') }) }) }) From 22d423c69b7fe16a33efb72885a24d85c3583952 Mon Sep 17 00:00:00 2001 From: dfldr Date: Fri, 5 Nov 2021 16:41:21 +0100 Subject: [PATCH 3/4] chore: remove test skipping in Firefox --- cypress/e2e/shared/dashboardsIndex.test.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/shared/dashboardsIndex.test.ts b/cypress/e2e/shared/dashboardsIndex.test.ts index 53d4d020da..1fdfe2e6e9 100644 --- a/cypress/e2e/shared/dashboardsIndex.test.ts +++ b/cypress/e2e/shared/dashboardsIndex.test.ts @@ -548,6 +548,7 @@ describe('Dashboards', () => { }) }) }) + before(() => cy.exec('rm cypress/downloads/*', { log: true, @@ -555,12 +556,10 @@ describe('Dashboards', () => { }) ) - it('creates a dashboard and downloads JSON', {browser: '!firefox'}, () => { + it('creates a dashboard and downloads JSON', () => { cy.get('@org').then(({id: orgID}: Organization) => { cy.createDashboard(orgID).then(({body}) => { cy.fixture('routes').then(({orgs}) => { - cy.visit(`${orgs}/${orgID}/dashboards/${body.id}`) - cy.getByTestID('tree-nav') cy.getByTestID('nav-item-dashboards').click() cy.getByTestID('dashboard-card--name').click() cy.getByTestID('page-title').type('dashboard') // dashboard name added to prevent failure due to downloading JSON with a different name From 1b73d2fe2e63457ba4b4291f0111238c99ff3437 Mon Sep 17 00:00:00 2001 From: dfldr Date: Fri, 5 Nov 2021 18:20:36 +0100 Subject: [PATCH 4/4] chore: run prettier to correct formating --- cypress/e2e/shared/dashboardsIndex.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/shared/dashboardsIndex.test.ts b/cypress/e2e/shared/dashboardsIndex.test.ts index 1fdfe2e6e9..d6c7fa209a 100644 --- a/cypress/e2e/shared/dashboardsIndex.test.ts +++ b/cypress/e2e/shared/dashboardsIndex.test.ts @@ -10,8 +10,8 @@ describe('Dashboards', () => { cy.flush().then(() => cy.signin().then(() => cy.fixture('routes').then(({orgs}) => { - cy.get('@org').then(({id}: Organization) => { - cy.visit(`${orgs}/${id}/dashboards-list`) + cy.get('@org').then(({id: orgID}: Organization) => { + cy.visit(`${orgs}/${orgID}/dashboards-list`) cy.getByTestID('tree-nav') }) }) @@ -556,10 +556,11 @@ describe('Dashboards', () => { }) ) - it('creates a dashboard and downloads JSON', () => { + it('creates a dashboard and downloads JSON', () => { cy.get('@org').then(({id: orgID}: Organization) => { cy.createDashboard(orgID).then(({body}) => { cy.fixture('routes').then(({orgs}) => { + cy.visit(`${orgs}/${orgID}/dashboards/${body.id}`) cy.getByTestID('nav-item-dashboards').click() cy.getByTestID('dashboard-card--name').click() cy.getByTestID('page-title').type('dashboard') // dashboard name added to prevent failure due to downloading JSON with a different name