From fb4b80862edca05432fc0051dfe71fefc3b365e0 Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Mon, 27 Feb 2023 22:37:42 +0100 Subject: [PATCH] Supress LAD Table View from ConditionSet (#6372) * add test and fix * remove premature test * PR comments --- .../conditionSet/conditionSet.e2e.spec.js | 53 +++++++++++++++++-- src/plugins/LADTable/LADTableViewProvider.js | 7 ++- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js b/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js index af84850237..68fbb1be46 100644 --- a/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js +++ b/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js @@ -181,10 +181,11 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => { }); test.describe('Basic Condition Set Use', () => { - test('Can add a condition', async ({ page }) => { - //Navigate to baseURL + test.beforeEach(async ({ page }) => { + // Open a browser, navigate to the main page, and wait until all network events to resolve await page.goto('./', { waitUntil: 'networkidle' }); - + }); + test('Can add a condition', async ({ page }) => { // Create a new condition set await createDomainObjectWithDefaults(page, { type: 'Condition Set', @@ -199,4 +200,50 @@ test.describe('Basic Condition Set Use', () => { const numOfUnnamedConditions = await page.locator('text=Unnamed Condition').count(); expect(numOfUnnamedConditions).toEqual(1); }); + test('ConditionSet should display appropriate view options', async ({ page }) => { + test.info().annotations.push({ + type: 'issue', + description: 'https://github.com/nasa/openmct/issues/5924' + }); + + await createDomainObjectWithDefaults(page, { + type: 'Sine Wave Generator', + name: "Alpha Sine Wave Generator" + }); + await createDomainObjectWithDefaults(page, { + type: 'Sine Wave Generator', + name: "Beta Sine Wave Generator" + }); + const conditionSet1 = await createDomainObjectWithDefaults(page, { + type: 'Condition Set', + name: "Test Condition Set" + }); + + // Change the object to edit mode + await page.locator('[title="Edit"]').click(); + + // Expand the 'My Items' folder in the left tree + await page.goto(conditionSet1.url); + page.click('button[title="Show selected item in tree"]'); + // Add the Alpha & Beta Sine Wave Generator to the Condition Set and save changes + const treePane = page.getByRole('tree', { + name: 'Main Tree' + }); + const alphaGeneratorTreeItem = treePane.getByRole('treeitem', { name: "Alpha Sine Wave Generator"}); + const betaGeneratorTreeItem = treePane.getByRole('treeitem', { name: "Beta Sine Wave Generator"}); + const conditionCollection = page.locator('#conditionCollection'); + + await alphaGeneratorTreeItem.dragTo(conditionCollection); + await betaGeneratorTreeItem.dragTo(conditionCollection); + + const saveButtonLocator = page.locator('button[title="Save"]'); + await saveButtonLocator.click(); + await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); + await page.click('button[title="Change the current view"]'); + + await expect(page.getByRole('menuitem', { name: /Lad Table/ })).toBeHidden(); + await expect(page.getByRole('menuitem', { name: /Conditions View/ })).toBeVisible(); + await expect(page.getByRole('menuitem', { name: /Plot/ })).toBeVisible(); + await expect(page.getByRole('menuitem', { name: /Telemetry Table/ })).toBeVisible(); + }); }); diff --git a/src/plugins/LADTable/LADTableViewProvider.js b/src/plugins/LADTable/LADTableViewProvider.js index fdfb65186b..860ea0d073 100644 --- a/src/plugins/LADTable/LADTableViewProvider.js +++ b/src/plugins/LADTable/LADTableViewProvider.js @@ -33,9 +33,12 @@ export default class LADTableViewProvider { canView(domainObject) { const supportsComposition = this.openmct.composition.supportsComposition(domainObject); const providesTelemetry = this.openmct.telemetry.isTelemetryObject(domainObject); + const isLadTable = domainObject.type === 'LadTable'; + const isConditionSet = domainObject.type === 'conditionSet'; - return domainObject.type === 'LadTable' - || (providesTelemetry && supportsComposition); + return !isConditionSet + && (isLadTable + || (providesTelemetry && supportsComposition)); } canEdit(domainObject) {