-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ui): front end sorting for numeric values now being handled correctly #16237
Changes from all commits
41a7c50
9b55897
e34b1c7
0181561
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -599,7 +599,9 @@ describe('DataExplorer', () => { | |
}) | ||
}) | ||
|
||
describe('visualize tables', () => { | ||
// skipping until the sigin flake gets resolve in: | ||
// https://github.com/influxdata/influxdb/issues/16253 | ||
describe.skip('visualize tables', () => { | ||
const numLines = 360 | ||
|
||
beforeEach(() => { | ||
|
@@ -623,7 +625,7 @@ describe('DataExplorer', () => { | |
}) | ||
}) | ||
|
||
it('can view table data', () => { | ||
it('can view table data & sort values numerically', () => { | ||
// build the query to return data from beforeEach | ||
cy.getByTestID(`selector-list m`).click() | ||
cy.getByTestID('selector-list v').click() | ||
|
@@ -654,8 +656,23 @@ describe('DataExplorer', () => { | |
}) | ||
cy.getByTestID('_value-table-header').click() | ||
cy.get('.table-graph-cell__sort-asc').should('exist') | ||
// TODO: complete testing when FE sorting functionality is sorted | ||
// https://github.com/influxdata/influxdb/issues/16200 | ||
cy.getByTestID('_value-table-header').click() | ||
cy.get('.table-graph-cell__sort-desc').should('exist') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i like the eagerness to test a lot of things, but i think this is bit too implementation heavy, in that it's testing implementation over behavior. it's an implementation detail that we change the class to reflect the sort order. the behavior is that we change the sort order, which you're testing below. i think testing this will lead to brittle tests, because if we ever want to change the name of the class, or the component the class targets, or any implementation detail around showing an indicator of the sort order, these tests will likely break. i don't think we should assert on these things. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit of both. The only indication that a specific cell header isn't toggled by the front end sort is the classname associated with it, hence the check for it. I do think it's necessary in this case to perform this check here so that we can validate that an action has occurred that is reflected in the UI, in addition to its functionality There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i don't think it's necessary at all - it really feels like an implementation detail: we could change our underlying css so that we render columns sorted ascending with some kind squiggly underline and columns sorted descending with a dashed outline. making those changes would render this test invalid. either way, i think it's enough discussion on a test - i think this is a bit implementation heavy, but if you're comfortable with this, go for it |
||
cy.getByTestID('_value-table-header') | ||
.should('exist') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fyi, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, but it is a way of maintaining UI stability in that we want to know whether the UI is manipulated by the click event There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
i'm curious how |
||
.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 | ||
} | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test fails when run with
it.only
which means it's coupled to another part of the test. i think this needs to get fixed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look and try to reproduce it locally and see whether I can make it less flakey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
until we sort this out, i think you should
skip
this test and link to this issue: #16253