From 4061b79b2cb996e465f093361b88d6c3617c5b77 Mon Sep 17 00:00:00 2001 From: Jake Wagoner Date: Mon, 1 Apr 2024 15:58:23 -0600 Subject: [PATCH] Change row click to dispatchClick --- e2e-tests/elementView.spec.ts | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/e2e-tests/elementView.spec.ts b/e2e-tests/elementView.spec.ts index 3f2b32bd..f7f8f2c3 100644 --- a/e2e-tests/elementView.spec.ts +++ b/e2e-tests/elementView.spec.ts @@ -32,15 +32,19 @@ test.beforeEach(async ({ page }) => { test('Element View', async ({ page }) => { await page.goto('http://localhost:3000/?workspace=Upset+Examples&table=simpsons&sessionId=193'); + + // Make selection + const row = await page.locator('g > circle').first(); // row + await row.dispatchEvent('click'); + + // Open element view await page.getByLabel('Open element view sidebar').click(); + // test expansion buttons await page.getByLabel('Expand the sidebar in full').click(); await page.getByLabel('Reduce the sidebar to normal').click(); - const row = await page.locator('circle').first(); // row - await expect(row).toBeVisible(); - await row.click(); - + // Ensure all headings are visible const elementViewHeading = await page.getByRole('heading', { name: 'Element View' }); await expect(elementViewHeading).toBeVisible(); const elementQueriesHeading = await page.getByRole('heading', { name: 'Element Queries' }); @@ -50,25 +54,26 @@ test('Element View', async ({ page }) => { const queryResultHeading = await page.getByRole('heading', { name: 'Query Result' }); await expect(queryResultHeading).toBeVisible(); + // Check to see that the selection chip is visible const selectionChip = await page.getByLabel('Selected intersection School'); await expect(selectionChip).toBeVisible(); + // Check that the datatable is visible and populated const dataTable = await page.locator('div').filter({ hasText: /^simpsons\/40726826Bart10simpsons\/40726838Ralph8simpsons\/40726848Martin Prince10$/ }).nth(2); await expect(dataTable).toBeVisible(); - const cell1 = await page.getByRole('cell', { name: 'simpsons/40726826' }); await expect(cell1).toBeVisible(); - const cell2 = await page.getByRole('cell', { name: 'Bart' }); await expect(cell2).toBeVisible(); - const cell3 = await page.getByRole('cell', { name: '10' }).first(); await expect(cell3).toBeVisible(); + // Check that the add plot button is visible const addPlot = await page.getByRole('button', { name: 'Add Plot' }); await expect(addPlot).toBeVisible(); await addPlot.click(); + // Check that plot options and plot preview are visible const histogramHeader = await page.getByRole('tab', { name: 'Histogram' }); await expect(histogramHeader).toBeVisible(); await histogramHeader.click(); @@ -85,16 +90,19 @@ test('Element View', async ({ page }) => { const option3 = await page.locator('label').filter({ hasText: 'Frequency' }); await expect(option3).toBeVisible(); + // close the plot preview const closeButton = await page.getByRole('heading', { name: 'Add Plot' }).getByRole('button'); await expect(closeButton).toBeVisible(); await closeButton.click(); + // Check that the download button is visible and works const downloadPromise = page.waitForEvent('download'); const downloadButton = await page.getByLabel('Download 3 elements'); await expect(downloadButton).toBeVisible(); await downloadButton.click(); const download = await downloadPromise; + // Check that the close button is visible and works const elementViewClose = await page.getByLabel('Close the sidebar'); await expect(elementViewClose).toBeVisible(); await elementViewClose.click();