From 2d9c0414f72c583e2894d81cc80ab1bad09e06c6 Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Tue, 5 Dec 2023 04:12:24 +0100 Subject: [PATCH] Inconsistent behavior with multiple annotations in imagery (#7261) * fix opacity issue * wip, though selection still weird * remove debugging * plots still have issue with last tag * add some better tests * Apply suggestions from code review Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com> * remove hardlined classnames * case sensitivity * good job tests finding issue --------- Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com> Co-authored-by: John Hill --- .../imagery/exampleImagery.e2e.spec.js | 8 ++ .../plugins/notebook/tags.e2e.spec.js | 18 ++++ .../plugins/plot/tagging.e2e.spec.js | 23 +++++ .../imagery/components/AnnotationsCanvas.vue | 86 ++++++++++++++----- .../annotations/AnnotationsInspectorView.vue | 4 +- .../annotations/tags/TagEditor.vue | 9 +- .../annotations/tags/TagEditorClassNames.js | 9 ++ .../annotations/tags/TagSelection.vue | 7 +- .../notebook/components/NotebookComponent.vue | 7 ++ .../notebook/components/NotebookEntry.vue | 8 +- src/plugins/plot/MctPlot.vue | 14 ++- 11 files changed, 159 insertions(+), 34 deletions(-) create mode 100644 src/plugins/inspectorViews/annotations/tags/TagEditorClassNames.js diff --git a/e2e/tests/functional/plugins/imagery/exampleImagery.e2e.spec.js b/e2e/tests/functional/plugins/imagery/exampleImagery.e2e.spec.js index c7ae0f4235..a5204cdb94 100644 --- a/e2e/tests/functional/plugins/imagery/exampleImagery.e2e.spec.js +++ b/e2e/tests/functional/plugins/imagery/exampleImagery.e2e.spec.js @@ -247,6 +247,14 @@ test.describe('Example Imagery Object', () => { await page.mouse.click(canvasCenterX - 50, canvasCenterY - 50); await expect(page.getByText('Driving')).toBeVisible(); await expect(page.getByText('Science')).toBeVisible(); + + // add another tag and expect it to appear without changing selection + await page.getByRole('button', { name: /Add Tag/ }).click(); + await page.getByPlaceholder('Type to select tag').click(); + await page.getByText('Drilling').click(); + await expect(page.getByText('Driving')).toBeVisible(); + await expect(page.getByText('Science')).toBeVisible(); + await expect(page.getByText('Drilling')).toBeVisible(); }); test('Can use + - buttons to zoom on the image @unstable', async ({ page }) => { diff --git a/e2e/tests/functional/plugins/notebook/tags.e2e.spec.js b/e2e/tests/functional/plugins/notebook/tags.e2e.spec.js index b4c9270b00..b520bf1fb5 100644 --- a/e2e/tests/functional/plugins/notebook/tags.e2e.spec.js +++ b/e2e/tests/functional/plugins/notebook/tags.e2e.spec.js @@ -224,4 +224,22 @@ test.describe('Tagging in Notebooks @addInit', () => { // Verify the AutoComplete field is hidden await expect(page.locator('[placeholder="Type to select tag"]')).toBeHidden(); }); + test('Can start to add a tag, click away, and add a tag', async ({ page }) => { + await createNotebookEntryAndTags(page); + + await page.getByRole('tab', { name: 'Annotations' }).click(); + + // Click on the body simulating a click outside the autocomplete) + await page.locator('body').click(); + await page.locator(`[aria-label="Notebook Entry"]`).click(); + + await page.hover(`button:has-text("Add Tag")`); + await page.locator(`button:has-text("Add Tag")`).click(); + + // Click inside the tag search input + await page.locator('[placeholder="Type to select tag"]').click(); + // Select the "Driving" tag + await page.locator('[aria-label="Autocomplete Options"] >> text=Drilling').click(); + await expect(page.getByLabel('Notebook Entries').getByText('Drilling')).toBeVisible(); + }); }); diff --git a/e2e/tests/functional/plugins/plot/tagging.e2e.spec.js b/e2e/tests/functional/plugins/plot/tagging.e2e.spec.js index 6b0fdd1176..84f65def9e 100644 --- a/e2e/tests/functional/plugins/plot/tagging.e2e.spec.js +++ b/e2e/tests/functional/plugins/plot/tagging.e2e.spec.js @@ -165,6 +165,29 @@ test.describe('Plot Tagging', () => { await expect(page.getByText('Science')).toBeVisible(); await expect(page.getByText('Driving')).toBeHidden(); + + // click elsewhere + await page.locator('body').click(); + //click on tagged plot point again + await canvas.click({ + position: { + x: 100, + y: 100 + } + }); + // Add driving tag again + await page.getByText('Annotations').click(); + await page.getByRole('button', { name: /Add Tag/ }).click(); + await page.getByPlaceholder('Type to select tag').click(); + await page.getByText('Driving').click(); + await expect(page.getByText('Science')).toBeVisible(); + await expect(page.getByText('Driving')).toBeVisible(); + + // Delete Driving again + await page.hover('[aria-label="Tag"]:has-text("Driving")'); + await page.locator('[aria-label="Remove tag Driving"]').click(); + await expect(page.getByText('Science')).toBeVisible(); + await expect(page.getByText('Driving')).toBeHidden(); } test.beforeEach(async ({ page }) => { diff --git a/src/plugins/imagery/components/AnnotationsCanvas.vue b/src/plugins/imagery/components/AnnotationsCanvas.vue index 66d99d6196..f5d03313dc 100644 --- a/src/plugins/imagery/components/AnnotationsCanvas.vue +++ b/src/plugins/imagery/components/AnnotationsCanvas.vue @@ -33,8 +33,11 @@