From fe7e08f6624af4d4f5c1168d2a6dca186572494b Mon Sep 17 00:00:00 2001 From: Ian Mayo Date: Thu, 3 Apr 2025 12:35:05 +0100 Subject: [PATCH] Remove console.log statements from time filter and step interval tests --- .../time-filter-step-forward.spec.ts | 16 ++++++++-------- tests/control-panel/time-step-interval.spec.ts | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/control-panel/time-filter-step-forward.spec.ts b/tests/control-panel/time-filter-step-forward.spec.ts index ef5facf4..0006d3fe 100644 --- a/tests/control-panel/time-filter-step-forward.spec.ts +++ b/tests/control-panel/time-filter-step-forward.spec.ts @@ -42,7 +42,7 @@ 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() @@ -50,11 +50,11 @@ test('Open Sample Plot, apply time filter, and step forward in time', async ({ p // 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 @@ -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() @@ -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') @@ -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') diff --git a/tests/control-panel/time-step-interval.spec.ts b/tests/control-panel/time-step-interval.spec.ts index 2aaa35a9..e025c391 100644 --- a/tests/control-panel/time-step-interval.spec.ts +++ b/tests/control-panel/time-step-interval.spec.ts @@ -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 @@ -72,7 +72,7 @@ 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 @@ -80,7 +80,7 @@ test('Test time step interval selection in control panel', async ({ page }) => { // 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)