From f055a8a0c7fce04dbbd936542220bda3147099ec Mon Sep 17 00:00:00 2001 From: Jesse Mazzella Date: Tue, 18 Apr 2023 13:25:43 -0700 Subject: [PATCH] fix(e2e): remove unnecessary wait for `networkidle` and fix selectors (#6370) --- e2e/appActions.js | 1 - .../functional/plugins/notebook/notebook.e2e.spec.js | 12 ++++++------ .../functional/plugins/plot/stackedPlot.e2e.spec.js | 12 ++++++------ 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/e2e/appActions.js b/e2e/appActions.js index b0bb186c21..371eeb93ee 100644 --- a/e2e/appActions.js +++ b/e2e/appActions.js @@ -74,7 +74,6 @@ async function createDomainObjectWithDefaults(page, { type, name, parent = 'mine // Navigate to the parent object. This is necessary to create the object // in the correct location, such as a folder, layout, or plot. await page.goto(`${parentUrl}?hideTree=true`); - await page.waitForLoadState('networkidle'); //Click the Create button await page.click('button:has-text("Create")'); diff --git a/e2e/tests/functional/plugins/notebook/notebook.e2e.spec.js b/e2e/tests/functional/plugins/notebook/notebook.e2e.spec.js index 24d323a96e..5b92ba4b99 100644 --- a/e2e/tests/functional/plugins/notebook/notebook.e2e.spec.js +++ b/e2e/tests/functional/plugins/notebook/notebook.e2e.spec.js @@ -260,7 +260,7 @@ test.describe('Notebook entry tests', () => { }); test('When an object is dropped into a notebook, a new entry is created and it should be focused @unstable', async ({ page }) => { // Create Overlay Plot - await createDomainObjectWithDefaults(page, { + const overlayPlot = await createDomainObjectWithDefaults(page, { type: 'Overlay Plot' }); @@ -270,17 +270,17 @@ test.describe('Notebook entry tests', () => { // Reveal the notebook in the tree await page.getByTitle('Show selected item in tree').click(); - await page.dragAndDrop('role=treeitem[name=/Dropped Overlay Plot/]', '.c-notebook__drag-area'); + await page.dragAndDrop(`role=treeitem[name=/${overlayPlot.name}/]`, '.c-notebook__drag-area'); const embed = page.locator('.c-ne__embed__link'); const embedName = await embed.textContent(); await expect(embed).toHaveClass(/icon-plot-overlay/); - expect(embedName).toBe('Dropped Overlay Plot'); + expect(embedName).toBe(overlayPlot.name); }); test('When an object is dropped into a notebooks existing entry, it should be focused @unstable', async ({ page }) => { // Create Overlay Plot - await createDomainObjectWithDefaults(page, { + const overlayPlot = await createDomainObjectWithDefaults(page, { type: 'Overlay Plot' }); @@ -291,14 +291,14 @@ test.describe('Notebook entry tests', () => { await page.getByTitle('Show selected item in tree').click(); await nbUtils.enterTextEntry(page, 'Entry to drop into'); - await page.dragAndDrop('role=treeitem[name=/Dropped Overlay Plot/]', 'text=Entry to drop into'); + await page.dragAndDrop(`role=treeitem[name=/${overlayPlot.name}/]`, 'text=Entry to drop into'); const existingEntry = page.locator('.c-ne__content', { has: page.locator('text="Entry to drop into"') }); const embed = existingEntry.locator('.c-ne__embed__link'); const embedName = await embed.textContent(); await expect(embed).toHaveClass(/icon-plot-overlay/); - expect(embedName).toBe('Dropped Overlay Plot'); + expect(embedName).toBe(overlayPlot.name); }); test.fixme('new entries persist through navigation events without save', async ({ page }) => {}); test('previous and new entries can be deleted', async ({ page }) => { diff --git a/e2e/tests/functional/plugins/plot/stackedPlot.e2e.spec.js b/e2e/tests/functional/plugins/plot/stackedPlot.e2e.spec.js index 4d16f74c82..2fec96130b 100644 --- a/e2e/tests/functional/plugins/plot/stackedPlot.e2e.spec.js +++ b/e2e/tests/functional/plugins/plot/stackedPlot.e2e.spec.js @@ -138,7 +138,7 @@ test.describe('Stacked Plot', () => { // Assert that the inspector shows the Y Axis properties for swgA await expect(page.locator('[aria-label="Plot Series Properties"] >> h2')).toContainText("Plot Series"); - await expect(page.getByRole('list', { name: "Y Axis Properties" }).locator("h2")).toContainText("Y Axis"); + await expect(page.getByRole('heading', { name: "Y Axis" })).toBeVisible(); await expect(page.locator('[aria-label="Plot Series Properties"] .c-object-label')).toContainText(swgA.name); // Click on the 2nd plot @@ -146,7 +146,7 @@ test.describe('Stacked Plot', () => { // Assert that the inspector shows the Y Axis properties for swgB await expect(page.locator('[aria-label="Plot Series Properties"] >> h2')).toContainText("Plot Series"); - await expect(page.getByRole('list', { name: "Y Axis Properties" }).locator("h2")).toContainText("Y Axis"); + await expect(page.getByRole('heading', { name: "Y Axis" })).toBeVisible(); await expect(page.locator('[aria-label="Plot Series Properties"] .c-object-label')).toContainText(swgB.name); // Click on the 3rd plot @@ -154,7 +154,7 @@ test.describe('Stacked Plot', () => { // Assert that the inspector shows the Y Axis properties for swgC await expect(page.locator('[aria-label="Plot Series Properties"] >> h2')).toContainText("Plot Series"); - await expect(page.getByRole('list', { name: "Y Axis Properties" }).locator("h2")).toContainText("Y Axis"); + await expect(page.getByRole('heading', { name: "Y Axis" })).toBeVisible(); await expect(page.locator('[aria-label="Plot Series Properties"] .c-object-label')).toContainText(swgC.name); // Go into edit mode @@ -167,7 +167,7 @@ test.describe('Stacked Plot', () => { // Assert that the inspector shows the Y Axis properties for swgA await expect(page.locator('[aria-label="Plot Series Properties"] >> h2')).toContainText("Plot Series"); - await expect(page.getByRole('list', { name: "Y Axis Properties" }).locator("h2")).toContainText("Y Axis"); + await expect(page.getByRole('heading', { name: "Y Axis" })).toBeVisible(); await expect(page.locator('[aria-label="Plot Series Properties"] .c-object-label')).toContainText(swgA.name); //Click on canvas for the 2nd plot @@ -175,7 +175,7 @@ test.describe('Stacked Plot', () => { // Assert that the inspector shows the Y Axis properties for swgB await expect(page.locator('[aria-label="Plot Series Properties"] >> h2')).toContainText("Plot Series"); - await expect(page.getByRole('list', { name: "Y Axis Properties" }).locator("h2")).toContainText("Y Axis"); + await expect(page.getByRole('heading', { name: "Y Axis" })).toBeVisible(); await expect(page.locator('[aria-label="Plot Series Properties"] .c-object-label')).toContainText(swgB.name); //Click on canvas for the 3rd plot @@ -183,7 +183,7 @@ test.describe('Stacked Plot', () => { // Assert that the inspector shows the Y Axis properties for swgC await expect(page.locator('[aria-label="Plot Series Properties"] >> h2')).toContainText("Plot Series"); - await expect(page.getByRole('list', { name: "Y Axis Properties" }).locator("h2")).toContainText("Y Axis"); + await expect(page.getByRole('heading', { name: "Y Axis" })).toBeVisible(); await expect(page.locator('[aria-label="Plot Series Properties"] .c-object-label')).toContainText(swgC.name); }); });