Skip to content

Commit

Permalink
fix(ui): fixed flakey tests (#16268)
Browse files Browse the repository at this point in the history
fix(ui): fixed flakey tests
  • Loading branch information
asalem1 authored Dec 18, 2019
1 parent 1db3256 commit 63b8129
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 60 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
75 changes: 15 additions & 60 deletions ui/cypress/e2e/explorer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}) => {
Expand Down Expand Up @@ -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', () => {
Expand All @@ -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
Expand Down Expand Up @@ -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
}
})
})
})
})
})
Expand Down

0 comments on commit 63b8129

Please sign in to comment.