Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/control-panel/time-filter-step-forward.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ test('Open Sample Plot, apply time filter, and step forward in time', async ({ p

// Get the initial time text before any actions
const timeTextBeforeFilter = await page.locator('.time-period-panel p').textContent()
console.log('Time period before filter:', timeTextBeforeFilter)


// check time step buttons are disabled
await expect(page.locator('.step-forward')).toBeDisabled()
await expect(page.locator('.step-backward')).toBeDisabled()

// Get the time text after clicking step forward (should be unchanged)
const timeTextAfterClick = await page.locator('.time-period-panel p').textContent()
console.log('Time period after clicking step forward (before filter):', timeTextAfterClick)


// Verify that the time text has NOT changed (because filter is not applied)
expect(timeTextAfterClick).toEqual(timeTextBeforeFilter)
console.log('Verified: Time period did not change when filter is not applied')


// Find and click the time filter button in the control panel
// Based on the application code, it's a button with FilterOutlined/FilterFilled icon
Expand Down Expand Up @@ -88,7 +88,7 @@ test('Open Sample Plot, apply time filter, and step forward in time', async ({ p

// Get the text content of the TimePeriod before stepping forward
const initialTimeText = await page.locator('.time-period-panel p').textContent()
console.log('Initial time period:', initialTimeText)


// Click the step forward button again
await stepForwardButton.click()
Expand All @@ -98,11 +98,11 @@ test('Open Sample Plot, apply time filter, and step forward in time', async ({ p

// Get the updated text content
const updatedTimeText = await page.locator('.time-period-panel p').textContent()
console.log('Updated time period:', updatedTimeText)


// Verify that the time text has changed
expect(updatedTimeText).not.toEqual(initialTimeText)
console.log('Time period changed successfully from', initialTimeText, 'to', updatedTimeText)


// check the time start and end times have moved forwards
expect(await timeStart.textContent()).toEqual('Nov 141800Z')
Expand All @@ -117,11 +117,11 @@ test('Open Sample Plot, apply time filter, and step forward in time', async ({ p

// Get the updated text content
const updatedTimeText2 = await page.locator('.time-period-panel p').textContent()
console.log('Updated time period:', updatedTimeText2)


// Verify that the time text has changed
expect(updatedTimeText2).not.toEqual(initialTimeText)
console.log('Time period changed successfully from', initialTimeText, 'to', updatedTimeText2)


// check the time start and end times have moved to end
expect(await timeStart.textContent()).toEqual('Nov 151000Z')
Expand Down
6 changes: 3 additions & 3 deletions tests/control-panel/time-step-interval.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ test('Test time step interval selection in control panel', async ({ page }) => {
// The difference should be 15 minutes (our selected interval)
// We can verify this by checking the format (MMM ddHHmm'Z')
// Format example: 'Nov 141600Z'
console.log('Time values:', trimmedStart, updatedStart)


// Extract hours and minutes from the time strings
// The format is 'MMM ddHHmmZ' where HH is at position 6-8 and mm is at position 8-10
Expand All @@ -72,15 +72,15 @@ test('Test time step interval selection in control panel', async ({ page }) => {
const updatedHour = parseInt(updatedStart?.substring(6, 8) || '0')
const updatedMinute = parseInt(updatedStart?.substring(8, 10) || '0')

console.log('Parsed time components:', initialHour, initialMinute, updatedHour, updatedMinute)


// Calculate the time in minutes for comparison
const initialTimeInMinutes = initialHour * 60 + initialMinute
const updatedTimeInMinutes = updatedHour * 60 + updatedMinute

// Check if the difference is approximately 15 minutes (allowing for rounding)
const timeDiff = Math.abs(updatedTimeInMinutes - initialTimeInMinutes)
console.log('Time difference in minutes:', timeDiff)


// We selected 15 minutes as the step, so expect a difference of about 15 minutes
expect(timeDiff).toEqual(15)
Expand Down