-
Notifications
You must be signed in to change notification settings - Fork 392
Fix time range tests by aligning assertions with timezone #13237
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
Closed
agorthi-akamai
wants to merge
7
commits into
linode:develop
from
agorthi-akamai:timezone-bugfix_linode_January_01
Closed
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
095c511
fixing failure spec
agorthi-akamai 48e44a6
fixing failure spec
agorthi-akamai 33ad5d8
Merge branch 'develop' into timezone-bugfix_linode_January_01
venkymano-akamai feafa74
fixing failure spec
agorthi-akamai 2f7a04b
Merge branch 'timezone-bugfix_linode_January_01' of https://github.coβ¦
agorthi-akamai f964c99
fixing failure spec
agorthi-akamai 3122524
fixing failure spec
agorthi-akamai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@linode/manager": Tests | ||
| --- | ||
|
|
||
| Fix flaky CI failures by removing invalid UI-to-UTC time comparisons in metrics tests ([#13237](https://github.com/linode/manager/pull/13237)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,7 +97,7 @@ const databaseMock: Database = databaseFactory.build({ | |
| }); | ||
| // Profile timezone is set to 'UTC' | ||
| const mockProfile = profileFactory.build({ | ||
| timezone: 'UTC', | ||
| timezone: 'America/New_York', | ||
| }); | ||
| /** | ||
| * Generates a date in Indian Standard Time (IST) based on a specified number of days offset, | ||
|
||
|
|
@@ -149,30 +149,23 @@ const getDateRangeInGMT = ( | |
| * @returns {{start: string, end: string}} - The start and end dates of the current month in ISO 8601 format. | ||
| */ | ||
|
|
||
| const getThisMonthRange = (): DateTimeWithPreset => { | ||
| const nowUtc = DateTime.utc(); // Current time in UTC | ||
|
|
||
| const startOfMonthUtc = nowUtc.startOf('month'); // Start of current month in UTC | ||
| const getThisMonthRange = (timeZone: string): DateTimeWithPreset => { | ||
| const now = DateTime.now().setZone(timeZone); | ||
|
|
||
| return { | ||
| start: startOfMonthUtc.toFormat(formatter), | ||
| end: nowUtc.toFormat(formatter), | ||
| start: now.startOf('month').toUTC().toFormat(formatter), | ||
| end: now.toUTC().toFormat(formatter), | ||
| }; | ||
| }; | ||
| const getLastMonthRange = (): DateTimeWithPreset => { | ||
| // Get current time in UTC | ||
| const now = DateTime.utc(); | ||
|
|
||
| // Get last month in UTC | ||
| const lastMonth = now.minus({ months: 1 }); | ||
| const getLastMonthRange = (timeZone: string): DateTimeWithPreset => { | ||
| const now = DateTime.now().setZone(timeZone); | ||
|
|
||
| // Get start and end of last month in UTC and format | ||
| const start = lastMonth.startOf('month').toFormat(formatter); | ||
| const end = lastMonth.endOf('month').toFormat(formatter); | ||
| const lastMonth = now.minus({ months: 1 }); | ||
|
|
||
| return { | ||
| start, | ||
| end, | ||
| start: lastMonth.startOf('month').toUTC().toFormat(formatter), | ||
| end: lastMonth.endOf('month').toUTC().toFormat(formatter), | ||
| }; | ||
| }; | ||
|
|
||
|
|
@@ -522,7 +515,7 @@ describe('Integration tests for verifying Cloudpulse custom and preset configura | |
| }); | ||
|
|
||
| it('Select the "Last Month" preset from the "Time Range" dropdown and verify its functionality.', () => { | ||
| const { end, start } = getLastMonthRange(); | ||
| const { start, end } = getLastMonthRange(mockProfile.timezone); | ||
|
|
||
| ui.button.findByTitle('Last hour').as('startDateInput'); | ||
| cy.get('@startDateInput').scrollIntoView(); | ||
|
|
@@ -558,7 +551,7 @@ describe('Integration tests for verifying Cloudpulse custom and preset configura | |
| }); | ||
|
|
||
| it('Select the "This Month" preset from the "Time Range" dropdown and verify its functionality.', () => { | ||
| const { end, start } = getThisMonthRange(); | ||
| const { start, end } = getThisMonthRange(mockProfile.timezone); | ||
|
|
||
| ui.button.findByTitle('Last hour').as('startDateInput'); | ||
| cy.get('@startDateInput').scrollIntoView(); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.