test(e2e): fix overlay plot element preview test flake (#6609)

test: wait for plot to be drawn before assertions
This commit is contained in:
Jesse Mazzella 2023-04-19 13:40:44 -07:00 committed by GitHub
parent ddeeff4822
commit c200999659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -214,12 +214,17 @@ test.describe('Overlay Plot', () => {
}); });
await page.goto(overlayPlot.url); await page.goto(overlayPlot.url);
// Wait for plot series data to load and be drawn
await expect(page.locator('.js-series-data-loaded')).toBeVisible();
await page.click('button[title="Edit"]'); await page.click('button[title="Edit"]');
await selectInspectorTab(page, 'Elements'); await selectInspectorTab(page, 'Elements');
await page.locator(`#inspector-elements-tree >> text=${swgA.name}`).click(); await page.locator(`#inspector-elements-tree >> text=${swgA.name}`).click();
// Wait for "View Large" plot series data to load and be drawn
await expect(page.locator('.c-overlay .js-series-data-loaded')).toBeVisible();
const plotPixelSize = await getCanvasPixelsWithData(page); const plotPixelSize = await getCanvasPixelsWithData(page);
expect(plotPixelSize).toBeGreaterThan(0); expect(plotPixelSize).toBeGreaterThan(0);
}); });