From 63b81291887f87e821ba6e8c250f1efaf920d57b Mon Sep 17 00:00:00 2001 From: Ariel Salem Date: Wed, 18 Dec 2019 14:03:31 -0800 Subject: [PATCH] fix(ui): fixed flakey tests (#16268) fix(ui): fixed flakey tests --- CHANGELOG.md | 1 + ui/cypress/e2e/explorer.test.ts | 75 +++++++-------------------------- 2 files changed, 16 insertions(+), 60 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b0551adabb..1f764e046f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ 1. [16237](https://github.com/influxdata/influxdb/pull/16237): Updated Sortby functionality for table frontend sorts to sort numbers correctly 1. [16249](https://github.com/influxdata/influxdb/pull/16249): Prevent potential infinite loop when finding tasks by organization. 1. [16255](https://github.com/influxdata/influxdb/pull/16255): Retain user input when parsing invalid JSON during import +1. [16268](https://github.com/influxdata/influxdb/pull/16268): Fixed test flakiness that stemmed from multiple flush/signins being called in the same test suite ### UI Improvements diff --git a/ui/cypress/e2e/explorer.test.ts b/ui/cypress/e2e/explorer.test.ts index 822e07a9692..5bd58e880c4 100644 --- a/ui/cypress/e2e/explorer.test.ts +++ b/ui/cypress/e2e/explorer.test.ts @@ -26,6 +26,7 @@ describe('DataExplorer', () => { cy.signin().then(({body}) => { cy.wrap(body.org).as('org') cy.createMapVariable(body.org.id) + cy.wrap(body.bucket).as('bucket') }) cy.fixture('routes').then(({orgs, explorer}) => { @@ -551,26 +552,9 @@ describe('DataExplorer', () => { describe('visualize with 360 lines', () => { const numLines = 360 - beforeEach(() => { - cy.flush() - - cy.signin().then(({body}) => { - const { - org: {id}, - bucket, - } = body - cy.wrap(body.org).as('org') - cy.wrap(bucket).as('bucket') - - // POST 360 lines to the server - cy.writeData(lines(numLines)) - - // start at the data explorer - cy.fixture('routes').then(({orgs, explorer}) => { - cy.visit(`${orgs}/${id}${explorer}`) - }) - }) + // POST 360 lines to the server + cy.writeData(lines(numLines)) }) it('can view time-series data', () => { @@ -597,33 +581,6 @@ describe('DataExplorer', () => { cy.getByTestID('raw-data-table').should('exist') cy.getByTestID('raw-data--toggle').click() }) - }) - - // skipping until the sigin flake gets resolve in: - // https://github.com/influxdata/influxdb/issues/16253 - describe.skip('visualize tables', () => { - const numLines = 360 - - beforeEach(() => { - cy.flush() - - cy.signin().then(({body}) => { - const { - org: {id}, - bucket, - } = body - cy.wrap(body.org).as('org') - cy.wrap(bucket).as('bucket') - - // POST 360 lines to the server - cy.writeData(lines(numLines)) - - // start at the data explorer - cy.fixture('routes').then(({orgs, explorer}) => { - cy.visit(`${orgs}/${id}${explorer}`) - }) - }) - }) it('can view table data & sort values numerically', () => { // build the query to return data from beforeEach @@ -658,21 +615,19 @@ describe('DataExplorer', () => { cy.get('.table-graph-cell__sort-asc').should('exist') cy.getByTestID('_value-table-header').click() cy.get('.table-graph-cell__sort-desc').should('exist') - cy.getByTestID('_value-table-header') - .should('exist') - .then(el => { - // get the column index - const columnIndex = el[0].getAttribute('data-column-index') - let prev = Infinity - // get all the column values for that one and see if they are in order - cy.get(`[data-column-index="${columnIndex}"]`).each(val => { - const num = Number(val.text()) - if (isNaN(num) === false) { - expect(num < prev).to.equal(true) - prev = num - } - }) + cy.getByTestID('_value-table-header').then(el => { + // get the column index + const columnIndex = el[0].getAttribute('data-column-index') + let prev = Infinity + // get all the column values for that one and see if they are in order + cy.get(`[data-column-index="${columnIndex}"]`).each(val => { + const num = Number(val.text()) + if (isNaN(num) === false) { + expect(num < prev).to.equal(true) + prev = num + } }) + }) }) }) })