From b6193328f6d6e170f3e8bb9457958ff82926c58f Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 29 May 2025 18:51:10 -0600 Subject: [PATCH] final updates --- .../bar-chart-updates.test.ts | 55 +++++++++---------- .../pie-styling-updates.spec.ts | 16 +----- 2 files changed, 28 insertions(+), 43 deletions(-) diff --git a/web/playwright-tests/bar-chart-updates.test.ts b/web/playwright-tests/bar-chart-updates.test.ts index 6fc280513..4e5fd55a0 100644 --- a/web/playwright-tests/bar-chart-updates.test.ts +++ b/web/playwright-tests/bar-chart-updates.test.ts @@ -64,9 +64,10 @@ test.describe ); await page.getByTestId('add-to-collection-button').click(); const currentUrl = page.url(); + await page .getByRole('menuitemcheckbox', { name: 'Important Things' }) - .getByRole('button') + .getByRole('link') .click(); await page.goto('http://localhost:3000/app/collections/0ac43ae2-beda-4007-9574-71a17425da0a'); expect(page.url()).not.toBe(currentUrl); @@ -318,9 +319,11 @@ test.describe await page.mouse.up(); } - await expect( - page.getByTestId('select-axis-drop-zone-xAxis').getByRole('button', { name: 'Year' }) + page + .getByTestId('select-axis-drop-zone-xAxis') + .locator('button') + .filter({ hasText: 'Year' }) ).toBeVisible(); await page.getByTestId('select-axis-drop-zone-xAxis').getByRole('button').nth(2).click(); @@ -365,15 +368,17 @@ test.describe sourceBoundingBox.y + dy * i + sourceBoundingBox.height / 2, { steps: 1 } ); - await page.waitForTimeout(1); // Add a small delay between each movement + await page.waitForTimeout(3); // Add a small delay between each movement } await page.mouse.up(); } await page.getByRole('button', { name: 'Save' }).click(); - await page.waitForTimeout(100); + await page.waitForTimeout(250); await page.waitForLoadState('networkidle'); + await page.waitForLoadState('domcontentloaded'); + await page.waitForLoadState('load'); page.reload(); @@ -390,9 +395,12 @@ test.describe page.reload(); await expect( - page.getByTestId('select-axis-drop-zone-tooltip').getByRole('button', { name: 'Year' }) + page + .getByTestId('select-axis-drop-zone-tooltip') + .locator('button') + .filter({ hasText: 'Year' }) ).toBeVisible(); - await page.getByTestId('select-axis-drop-zone-tooltip').getByRole('button').nth(2).click(); + await page.getByTestId('select-axis-drop-zone-tooltip').getByTestId('delete-button').click(); await expect( page.getByTestId('select-axis-drop-zone-tooltip').getByText('Drag column here') ).toBeVisible(); @@ -510,6 +518,7 @@ test.describe await page.getByTestId('segmented-trigger-none').click(); await page.getByRole('button', { name: 'Save' }).click(); + await page.waitForTimeout(100); await page.waitForLoadState('networkidle'); }); @@ -550,23 +559,15 @@ test.describe await page.reload(); await page.getByTestId('segmented-trigger-Styling').click(); - await page - .getByRole('main') - .filter({ hasText: 'Jan 1, 2022 - May 2, 2025•' }) - .getByRole('button') - .nth(2) - .click(); + await page.getByTestId('delete-button').click(); await page.getByRole('button', { name: 'Save' }).click(); await page.waitForTimeout(50); + await page.waitForLoadState('networkidle'); await page.reload(); - - await expect(page.locator('body')).toMatchAriaSnapshot(` - - textbox "New chart": Yearly Sales Revenue - Signature Cycles Products (Last 3 Years + YTD) - - text: /Jan 1, \\d+ - May 2, \\d+ • What is the total yearly sales revenue for products supplied by Signature Cycles from \\d+ to present\\? Total Sales Revenue/ - - img - `); + await page.getByTestId('segmented-trigger-Styling').click(); + await expect(page.getByTestId('delete-button')).not.toBeVisible(); }); test('Can add a trendline', async ({ page }) => { @@ -615,14 +616,6 @@ test.describe await page.getByRole('button', { name: 'Save' }).click(); await page.waitForTimeout(100); await page.waitForLoadState('networkidle'); - await expect(page.locator('body')).toMatchAriaSnapshot(` - - textbox "New chart": Yearly Sales Revenue - Signature Cycles Products (Last 3 Years + YTD) - - text: /Jan 1, \\d+ - May 2, \\d+ • What is the total yearly sales revenue for products supplied by Signature Cycles from \\d+ to present\\? Total Sales Revenue/ - - img - `); - - await page.waitForTimeout(50); - await page.waitForLoadState('networkidle'); await page .locator('div') @@ -718,7 +711,12 @@ test.describe await page.getByRole('textbox', { name: 'Total Sales Revenue' }).click(); await page.getByRole('textbox', { name: 'Total Sales Revenue' }).press('ControlOrMeta+a'); await page.getByRole('textbox', { name: 'Total Sales Revenue' }).fill('THIS IS A TEST!'); - await expect(page.getByRole('button', { name: 'THIS IS A TEST!' })).toBeVisible(); + await expect( + page + .getByTestId('select-axis-drop-zone-yAxis') + .locator('button') + .filter({ hasText: 'THIS IS A TEST!' }) + ).toBeVisible(); await page.getByRole('button', { name: 'Save' }).click(); await page.waitForTimeout(100); await page.waitForLoadState('networkidle'); @@ -851,6 +849,7 @@ test.describe await page.goto( 'http://localhost:3000/app/metrics/45c17750-2b61-5683-ba8d-ff6c6fefacee/chart?secondary_view=chart-edit' ); + await page.getByTestId('select-axis-drop-zone-yAxis').getByRole('button').nth(3).click(); await page.getByRole('switch').click(); await page.getByRole('button', { name: 'Save' }).click(); diff --git a/web/playwright-tests/pie-styling-updates.spec.ts b/web/playwright-tests/pie-styling-updates.spec.ts index 1a066e3dd..a1df76ec0 100644 --- a/web/playwright-tests/pie-styling-updates.spec.ts +++ b/web/playwright-tests/pie-styling-updates.spec.ts @@ -106,11 +106,6 @@ test.describe .filter({ hasText: /^Edit chart$/ }) .getByRole('button') .click(); - await expect(page.locator('body')).toMatchAriaSnapshot(` - - textbox "New chart": /Top \\d+ Products by Revenue \\(Last 4 Quarters\\)/ - - text: /Q2 \\d+ - Q1 \\d+ • Which were the top \\d+ products by revenue in the last four completed quarters\\? Touring-\\d+ Yellow, \\d+ Road-\\d+-W Yellow, \\d+ Touring-\\d+ Blue, \\d+ Road-\\d+-W Yellow, \\d+ Next 6/ - - img - `); }); test('Pie chart - legend clicks work', async ({ page }) => { @@ -134,10 +129,6 @@ test.describe .filter({ hasText: /^Mountain-200 Silver, 42$/ }) .nth(2) ).toBeVisible(); - await expect(page.getByTestId('metric-view-chart-content')).toMatchAriaSnapshot(` - - text: /Touring-\\d+ Yellow, \\d+ Road-\\d+-W Yellow, \\d+ Touring-\\d+ Blue, \\d+ Road-\\d+-W Yellow, \\d+ Next 6/ - - img - `); }); test('Pie chart - can disable tooltip', async ({ page }) => { @@ -261,11 +252,6 @@ test.describe ); await page.getByTestId('segmented-trigger-Styling').click(); await expect(page.getByText('Touring-1000 Yellow,')).toBeVisible(); - await expect(page.locator('body')).toMatchAriaSnapshot(` - - textbox "New chart": /Top \\d+ Products by Revenue \\(Last 4 Quarters\\)/ - - text: /Q2 \\d+ - Q1 \\d+ • Which were the top \\d+ products by revenue in the last four completed quarters\\? Touring-\\d+ Yellow, \\d+ Road-\\d+-W Yellow, \\d+ Touring-\\d+ Blue, \\d+ Next 7/ - - img - `); await expect(page.locator('body')).toContainText('Sum'); await page.locator('html').click(); await page.getByRole('combobox').filter({ hasText: 'Sum' }).click(); @@ -378,7 +364,7 @@ test.describe 'http://localhost:3000/app/metrics/88f342bf-19f9-53a9-87c6-804399e69644/chart?secondary_view=chart-edit' ); await expect(page.getByTestId('metric-view-chart-content').getByRole('img')).toBeVisible(); - await page.getByTestId('select-axis-drop-zone-xAxis').getByRole('button').nth(1).click(); + await page.getByTestId('select-axis-drop-zone-xAxis').getByTestId('delete-button').click(); await expect(page.getByText('No valid axis selected')).toBeVisible(); await page.getByTestId('select-chart-type-column').click();