From ad31aa0ddadc0d26ab6fb0d7b78c89f31db44195 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Fri, 9 May 2025 12:25:55 -0600 Subject: [PATCH] update tests with new syntax --- web/playwright-tests/pie-styling-updates.spec.ts | 9 +++------ web/playwright-tests/scatter-chart-updates.test.ts | 4 ++-- web/playwright-tests/sharing-metric.test.ts | 14 +++++++++----- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/web/playwright-tests/pie-styling-updates.spec.ts b/web/playwright-tests/pie-styling-updates.spec.ts index 7c72f3730..8a7c57905 100644 --- a/web/playwright-tests/pie-styling-updates.spec.ts +++ b/web/playwright-tests/pie-styling-updates.spec.ts @@ -69,12 +69,9 @@ test.describe.serial('Pie chart styling updates', async () => { await page.waitForTimeout(55); await page.getByTestId('edit-chart-button').getByRole('button').click(); await expect(page.getByTestId('metric-view-chart-content').getByRole('img')).toBeVisible(); - await page.getByTestId('edit-sql-button').getByRole('button').click(); - await page.waitForTimeout(55); - await expect(page.getByText('Copy SQLSaveRun')).toBeVisible(); - await page.getByTestId('segmented-trigger-file').click(); - await page.waitForTimeout(55); - await expect(page.getByText('Top 10 Products by Revenue (').first()).toBeVisible(); + await expect(page.getByRole('textbox', { name: 'New chart' })).toHaveValue( + 'Top 10 Products by Revenue (Last 4 Quarters)' + ); await page.getByTestId('edit-chart-button').getByRole('button').click(); await expect(page.getByText('Edit chart')).toBeVisible(); await page diff --git a/web/playwright-tests/scatter-chart-updates.test.ts b/web/playwright-tests/scatter-chart-updates.test.ts index d9880a5bc..5780d610f 100644 --- a/web/playwright-tests/scatter-chart-updates.test.ts +++ b/web/playwright-tests/scatter-chart-updates.test.ts @@ -12,12 +12,12 @@ test.describe.serial('Create a scatter plot with a question', () => { await page.waitForLoadState('networkidle'); await page.waitForLoadState('domcontentloaded'); await expect(page.getByRole('link', { name: 'Reasoning link' })).toBeVisible(); + await expect(page.getByTestId('metric-view-chart-content').getByRole('img')).toBeVisible({ - timeout: 240000 + timeout: 240000 // 4 minutes }); await expect(page.getByTestId('share-button')).toBeVisible(); await expect(page.getByTestId('save-to-dashboard-button')).toBeVisible(); - await expect(page.getByTestId('edit-sql-button').getByRole('button')).toBeVisible(); await expect(page.getByTestId('edit-chart-button').getByRole('button')).toBeVisible(); await page.getByTestId('edit-chart-button').getByRole('button').click(); diff --git a/web/playwright-tests/sharing-metric.test.ts b/web/playwright-tests/sharing-metric.test.ts index 1a89b03b1..d5fb5335a 100644 --- a/web/playwright-tests/sharing-metric.test.ts +++ b/web/playwright-tests/sharing-metric.test.ts @@ -1,9 +1,9 @@ import { test, expect } from '@playwright/test'; test('Can share a metric', async ({ page }) => { - await page.goto('http://localhost:3000/app/chats'); - await page.getByRole('link', { name: 'Revenue Report: Previous Four' }).click(); - + await page.goto( + 'http://localhost:3000/app/chats/865352e8-c327-461d-ae67-9efeb530ff0e/metrics/1e91b291-8883-5451-8b98-89e99071e4f8/chart?metric_version_number=1' + ); await page.getByTestId('share-button').click(); await page.getByRole('textbox', { name: 'Invite others by email...' }).click(); await page.getByRole('textbox', { name: 'Invite others by email...' }).fill('blake@buster.so'); @@ -14,11 +14,14 @@ test('Can share a metric', async ({ page }) => { await page.getByText('Can view').click(); await page.getByRole('menuitemcheckbox', { name: 'Remove' }).click(); await expect(page.getByText('Can view')).toBeHidden(); + await page.waitForTimeout(100); + await page.waitForLoadState('networkidle'); }); test('Can publish a metric', async ({ page }) => { - await page.goto('http://localhost:3000/app/chats'); - await page.getByRole('link', { name: 'Revenue Report: Previous Four' }).click(); + await page.goto( + 'http://localhost:3000/app/chats/865352e8-c327-461d-ae67-9efeb530ff0e/metrics/1e91b291-8883-5451-8b98-89e99071e4f8/chart?metric_version_number=1' + ); await page.getByTestId('share-button').click(); await page.getByTestId('segmented-trigger-Publish').click(); await expect(page.getByRole('button', { name: 'Create public link' })).toBeVisible(); @@ -34,4 +37,5 @@ test('Can publish a metric', async ({ page }) => { await page.getByRole('button', { name: 'Unpublish' }).click(); await page.waitForTimeout(50); await page.waitForLoadState('networkidle'); + await expect(page.getByRole('button', { name: 'Create public link' })).toBeVisible(); });