-
Notifications
You must be signed in to change notification settings - Fork 363
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: [M3-8451] - List events in event landing page in chronological order #11339
base: develop
Are you sure you want to change the base?
fix: [M3-8451] - List events in event landing page in chronological order #11339
Conversation
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've extended the Event
interface to include completionTime for an event and moved the getEventTimeStamp()
to the sorting util function.
Cloud Manager UI test results🎉 455 passing tests on test run #3 ↗︎
|
|
||
export interface completionEvent extends Event { |
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.
Nit: I think completedEvent
sounds a bit better than completionEvent
const dates = tableBodyRows.map((row) => { | ||
const cells = within(row).getAllByRole('cell'); | ||
return cells[3].textContent || ''; | ||
}); | ||
|
||
// util function to check if the dates are in descending order | ||
const areDatesSorted = dates.every( | ||
(date, i, arr) => i === 0 || new Date(arr[i - 1]) >= new Date(date) | ||
); | ||
|
||
expect(areDatesSorted).toBe(true); |
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.
Can we add a test-id to the Absolute Date table cell and grab the dates that way instead of grabbing the cell at index 3?
We can also just hardcode the date string; I think the test is clearer this way:
const mockEvent1 = eventFactory.build({
...
created: '2024-12-10T16:29:52.973-05:00',
...
});
const mockEvent2 = eventFactory.build({
...
created: '2024-12-10T16:28:52.974-05:00',
...
});
expect(dates).toStrictEqual(['2024-12-11 05:30', '2024-12-11 05:28']);
To test the sorting function, we can add a separate unit test for the sortEventsChronologically
function in the utils test file
Description 📝
Currently not all events in the landing page are sorted in a chronological order. This seems to be because we adjust the event creation date to accommodate the duration for a
finished
orfailed
event.Changes 🔄
Preview 📷
How to test 🧪
Reproduction steps
This can be most easily reproduced when performing some action that triggers multiple events to happen in a short timeframe.
Verification steps
Author Checklists
As an Author, to speed up the review process, I considered 🤔
👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support
As an Author, before moving this PR from Draft to Open, I confirmed ✅