From 379a466d4d1fee933dbb57ed08ff27605da5784b Mon Sep 17 00:00:00 2001 From: "Hill, John (ARC-TI)[KBR Wyle Services, LLC]" <john.c.hill@nasa.gov> Date: Wed, 24 Jul 2024 13:44:38 -0700 Subject: [PATCH] remove choochoo steps --- .../conditionSet/conditionSet.e2e.spec.js | 383 +----------------- .../conditionSetOperations.e2e.spec.js | 368 +++++++++++++++++ .../plugins/gauge/gauge.e2e.spec.js | 21 +- .../plugins/plot/overlayPlot.e2e.spec.js | 40 +- .../plugins/plot/plotRendering.e2e.spec.js | 6 +- e2e/tests/functional/tooltips.e2e.spec.js | 32 +- 6 files changed, 432 insertions(+), 418 deletions(-) create mode 100644 e2e/tests/functional/plugins/conditionSet/conditionSetOperations.e2e.spec.js diff --git a/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js b/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js index 8bf3523bc0..ce7a784107 100644 --- a/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js +++ b/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js @@ -68,35 +68,32 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage @2p', () => }); //Begin suite of tests again localStorage - test.fixme( - 'Condition set object properties persist in main view and inspector @localStorage', - async ({ page }) => { - test.info().annotations.push({ - type: 'issue', - description: 'https://github.com/nasa/openmct/issues/7421' - }); - //Navigate to baseURL with injected localStorage - await page.goto(conditionSetUrl, { waitUntil: 'domcontentloaded' }); + test('Condition set object properties persist in main view and inspector after reload @localStorage', async ({ + page + }) => { + //Navigate to baseURL with injected localStorage + await page.goto(conditionSetUrl, { waitUntil: 'domcontentloaded' }); - //Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto() - await expect - .soft(page.locator('.l-browse-bar__object-name')) - .toContainText('Unnamed Condition Set'); + //Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto() + await expect.soft(page.getByRole('main')).toContainText('Unnamed Condition Set'); - //Assertions on loaded Condition Set in Inspector - expect.soft(page.locator('_vue=item.name=Unnamed Condition Set')).toBeTruthy(); + //Assertions on loaded Condition Set in Inspector + await expect( + page.getByLabel('Title inspector properties').getByLabel('inspector property value') + ).toContainText('Unnamed Condition Set'); - //Reload Page - await Promise.all([page.reload(), page.waitForLoadState('domcontentloaded')]); + //Reload Page + await page.reload({ waitUntil: 'domcontentloaded' }); + + //Re-verify after reload + await expect.soft(page.getByRole('main')).toContainText('Unnamed Condition Set'); + + //Assertions on loaded Condition Set in Inspector + await expect( + page.getByLabel('Title inspector properties').getByLabel('inspector property value') + ).toContainText('Unnamed Condition Set'); + }); - //Re-verify after reload - await expect - .soft(page.locator('.l-browse-bar__object-name')) - .toContainText('Unnamed Condition Set'); - //Assertions on loaded Condition Set in Inspector - expect.soft(page.locator('_vue=item.name=Unnamed Condition Set')).toBeTruthy(); - } - ); test('condition set object can be modified on @localStorage', async ({ page, openmctConfig }) => { const { myItemsFolderName } = openmctConfig; @@ -217,339 +214,3 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage @2p', () => await expect(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set'); }); }); - -test.describe('Basic Condition Set Use', () => { - let conditionSet; - - test.beforeEach(async ({ page }) => { - // Open a browser, navigate to the main page, and wait until all network events to resolve - await page.goto('./', { waitUntil: 'domcontentloaded' }); - // Create a new condition set - conditionSet = await createDomainObjectWithDefaults(page, { - type: 'Condition Set', - name: 'Test Condition Set' - }); - }); - test('Creating a condition defaults the condition name to "Unnamed Condition"', async ({ - page - }) => { - await page.goto(conditionSet.url); - - // Change the object to edit mode - await page.getByLabel('Edit Object').click(); - - // Click Add Condition button - await page.locator('#addCondition').click(); - // Check that the new Unnamed Condition section appears - const numOfUnnamedConditions = await page - .locator('.c-condition__name', { hasText: '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' - }); - - await page.goto(conditionSet.url); - - // Change the object to edit mode - await page.getByLabel('Edit Object').click(); - - // Expand the 'My Items' folder in the left tree - 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); - - await page.locator('button[title="Save"]').click(); - await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); - - await page.getByLabel('Open the View Switcher Menu').click(); - - 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(); - await page.getByLabel('Plot').click(); - await expect( - page.getByLabel('Plot Legend Collapsed').getByText('Test Condition Set') - ).toBeVisible(); - await page.getByLabel('Open the View Switcher Menu').click(); - await page.getByLabel('Telemetry Table').click(); - await expect(page.getByRole('searchbox', { name: 'output filter input' })).toBeVisible(); - await page.getByLabel('Open the View Switcher Menu').click(); - await page.getByLabel('Conditions View').click(); - await expect(page.getByText('Current Output')).toBeVisible(); - }); - test('ConditionSet has correct outputs when telemetry is and is not available', async ({ - page - }) => { - const exampleTelemetry = await createExampleTelemetryObject(page); - - await page.getByLabel('Show selected item in tree').click(); - await page.goto(conditionSet.url); - // Change the object to edit mode - await page.getByLabel('Edit Object').click(); - - // Create two conditions - await page.locator('#addCondition').click(); - await page.locator('#addCondition').click(); - await page.locator('#conditionCollection').getByRole('textbox').nth(0).fill('First Condition'); - await page.locator('#conditionCollection').getByRole('textbox').nth(1).fill('Second Condition'); - - // Add Telemetry to ConditionSet - const sineWaveGeneratorTreeItem = page - .getByRole('tree', { - name: 'Main Tree' - }) - .getByRole('treeitem', { - name: exampleTelemetry.name - }); - const conditionCollection = page.locator('#conditionCollection'); - await sineWaveGeneratorTreeItem.dragTo(conditionCollection); - - // Modify First Criterion - const firstCriterionTelemetry = page.locator( - '[aria-label="Criterion Telemetry Selection"] >> nth=0' - ); - firstCriterionTelemetry.selectOption({ label: exampleTelemetry.name }); - const firstCriterionMetadata = page.locator( - '[aria-label="Criterion Metadata Selection"] >> nth=0' - ); - firstCriterionMetadata.selectOption({ label: 'Sine' }); - const firstCriterionComparison = page.locator( - '[aria-label="Criterion Comparison Selection"] >> nth=0' - ); - firstCriterionComparison.selectOption({ label: 'is greater than or equal to' }); - const firstCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=0'); - await firstCriterionInput.fill('0'); - - // Modify First Criterion - const secondCriterionTelemetry = page.locator( - '[aria-label="Criterion Telemetry Selection"] >> nth=1' - ); - secondCriterionTelemetry.selectOption({ label: exampleTelemetry.name }); - - const secondCriterionMetadata = page.locator( - '[aria-label="Criterion Metadata Selection"] >> nth=1' - ); - secondCriterionMetadata.selectOption({ label: 'Sine' }); - - const secondCriterionComparison = page.locator( - '[aria-label="Criterion Comparison Selection"] >> nth=1' - ); - secondCriterionComparison.selectOption({ label: 'is less than' }); - - const secondCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=1'); - await secondCriterionInput.fill('0'); - - // Save ConditionSet - await page.locator('button[title="Save"]').click(); - await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); - - // Validate that the condition set is evaluating and outputting - // the correct value when the underlying telemetry subscription is active. - let outputValue = page.getByLabel('Current Output Value'); - await expect(outputValue).toHaveText('false'); - - await page.goto(exampleTelemetry.url); - - // Edit SWG to add 8 second loading delay to simulate the case - // where telemetry is not available. - await page.getByTitle('More actions').click(); - await page.getByRole('menuitem', { name: 'Edit Properties...' }).click(); - await page.getByRole('spinbutton', { name: 'Loading Delay (ms)' }).fill('8000'); - await page.getByLabel('Save').click(); - - // Expect that the output value is blank or '---' if the - // underlying telemetry subscription is not active. - await page.goto(conditionSet.url); - await expect(outputValue).toHaveText('---'); - }); - - test('ConditionSet has correct outputs when test data is enabled', async ({ page }) => { - const exampleTelemetry = await createExampleTelemetryObject(page); - - await page.getByLabel('Show selected item in tree').click(); - await page.goto(conditionSet.url); - // Change the object to edit mode - await page.getByLabel('Edit Object').click(); - - // Create two conditions - await page.locator('#addCondition').click(); - await page.locator('#addCondition').click(); - await page.locator('#conditionCollection').getByRole('textbox').nth(0).fill('First Condition'); - await page.locator('#conditionCollection').getByRole('textbox').nth(1).fill('Second Condition'); - - // Add Telemetry to ConditionSet - const sineWaveGeneratorTreeItem = page - .getByRole('tree', { - name: 'Main Tree' - }) - .getByRole('treeitem', { - name: exampleTelemetry.name - }); - const conditionCollection = page.locator('#conditionCollection'); - await sineWaveGeneratorTreeItem.dragTo(conditionCollection); - - // Modify First Criterion - const firstCriterionTelemetry = page.locator( - '[aria-label="Criterion Telemetry Selection"] >> nth=0' - ); - firstCriterionTelemetry.selectOption({ label: exampleTelemetry.name }); - const firstCriterionMetadata = page.locator( - '[aria-label="Criterion Metadata Selection"] >> nth=0' - ); - firstCriterionMetadata.selectOption({ label: 'Sine' }); - const firstCriterionComparison = page.locator( - '[aria-label="Criterion Comparison Selection"] >> nth=0' - ); - firstCriterionComparison.selectOption({ label: 'is greater than or equal to' }); - const firstCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=0'); - await firstCriterionInput.fill('0'); - - // Modify Second Criterion - const secondCriterionTelemetry = page.locator( - '[aria-label="Criterion Telemetry Selection"] >> nth=1' - ); - await secondCriterionTelemetry.selectOption({ label: exampleTelemetry.name }); - - const secondCriterionMetadata = page.locator( - '[aria-label="Criterion Metadata Selection"] >> nth=1' - ); - await secondCriterionMetadata.selectOption({ label: 'Sine' }); - - const secondCriterionComparison = page.locator( - '[aria-label="Criterion Comparison Selection"] >> nth=1' - ); - await secondCriterionComparison.selectOption({ label: 'is less than' }); - - const secondCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=1'); - await secondCriterionInput.fill('0'); - - // Enable test data - await page.getByLabel('Apply Test Data').nth(1).click(); - const testDataTelemetry = page.locator('[aria-label="Test Data Telemetry Selection"] >> nth=0'); - await testDataTelemetry.selectOption({ label: exampleTelemetry.name }); - - const testDataMetadata = page.locator('[aria-label="Test Data Metadata Selection"] >> nth=0'); - await testDataMetadata.selectOption({ label: 'Sine' }); - - const testInput = page.locator('[aria-label="Test Data Input"] >> nth=0'); - await testInput.fill('0'); - - // Validate that the condition set is evaluating and outputting - // the correct value when the underlying telemetry subscription is active. - let outputValue = page.getByLabel('Current Output Value'); - await expect(outputValue).toHaveText('false'); - - await page.goto(exampleTelemetry.url); - }); - - test.fixme('Ensure condition sets work with telemetry like operator status', ({ page }) => { - test.info().annotations.push({ - type: 'issue', - description: 'https://github.com/nasa/openmct/issues/7484' - }); - }); -}); - -test.describe('Condition Set Composition', () => { - let conditionSet; - let exampleTelemetry; - - test.beforeEach(async ({ page }) => { - await page.goto('./', { waitUntil: 'domcontentloaded' }); - - // Create Condition Set - conditionSet = await createDomainObjectWithDefaults(page, { - type: 'Condition Set' - }); - - // Create Telemetry Object as child to Condition Set - exampleTelemetry = await createExampleTelemetryObject(page, conditionSet.uuid); - - // Edit Condition Set - await page.goto(conditionSet.url); - await page.getByRole('button', { name: 'Edit Object' }).click(); - - // Add Condition to Condition Set - await page.getByRole('button', { name: 'Add Condition' }).click(); - - // Enter Condition Output - await page.getByLabel('Condition Name Input').first().fill('Negative'); - await page.getByLabel('Condition Output Type').first().selectOption({ value: 'string' }); - await page.getByLabel('Condition Output String').first().fill('Negative'); - - // Condition Trigger default is okay so no change needed to form - - // Enter Condition Criterion - await page.getByLabel('Criterion Telemetry Selection').first().selectOption({ value: 'all' }); - await page.getByLabel('Criterion Metadata Selection').first().selectOption({ value: 'sin' }); - await page - .locator('select[aria-label="Criterion Comparison Selection"]') - .first() - .selectOption({ value: 'lessThan' }); - await page.getByLabel('Criterion Input').first().fill('0'); - - // Save the Condition Set - await page.getByRole('button', { name: 'Save' }).click(); - await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); - }); - - test('You can remove telemetry from a condition set with existing conditions', async ({ - page - }) => { - test.info().annotations.push({ - type: 'issue', - description: 'https://github.com/nasa/openmct/issues/7710' - }); - - await page.getByLabel('Expand My Items folder').click(); - await page.getByLabel(`Expand ${conditionSet.name} conditionSet`).click(); - - await page - .getByLabel(`Navigate to ${exampleTelemetry.name}`, { exact: false }) - .click({ button: 'right' }); - - await page - .getByLabel(`${exampleTelemetry.name} Context Menu`) - .getByRole('menuitem', { name: 'Remove' }) - .click(); - await page.getByRole('button', { name: 'OK', exact: true }).click(); - - await page - .getByLabel(`Navigate to ${conditionSet.name} conditionSet Object`, { exact: true }) - .click(); - await page.getByRole('button', { name: 'Edit Object' }).click(); - await page.getByRole('tab', { name: 'Elements' }).click(); - expect( - await page - .getByRole('tabpanel', { name: 'Inspector Views' }) - .getByRole('listitem', { name: exampleTelemetry.name }) - .count() - ).toEqual(0); - }); -}); diff --git a/e2e/tests/functional/plugins/conditionSet/conditionSetOperations.e2e.spec.js b/e2e/tests/functional/plugins/conditionSet/conditionSetOperations.e2e.spec.js new file mode 100644 index 0000000000..2dd55181c4 --- /dev/null +++ b/e2e/tests/functional/plugins/conditionSet/conditionSetOperations.e2e.spec.js @@ -0,0 +1,368 @@ +/***************************************************************************** + * Open MCT, Copyright (c) 2014-2024, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT is licensed under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * Open MCT includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/* +This test suite is dedicated to tests which verify the basic operations surrounding conditionSets. Note: this +suite is sharing state between tests which is considered an anti-pattern. Implementing in this way to +demonstrate some playwright for test developers. This pattern should not be re-used in other CRUD suites. +*/ + +import { + createDomainObjectWithDefaults, + createExampleTelemetryObject +} from '../../../../appActions.js'; +import { expect, test } from '../../../../pluginFixtures.js'; + +test.describe('Basic Condition Set Use', () => { + let conditionSet; + + test.beforeEach(async ({ page }) => { + // Open a browser, navigate to the main page, and wait until all network events to resolve + await page.goto('./', { waitUntil: 'domcontentloaded' }); + // Create a new condition set + conditionSet = await createDomainObjectWithDefaults(page, { + type: 'Condition Set', + name: 'Test Condition Set' + }); + }); + test('Creating a condition defaults the condition name to "Unnamed Condition"', async ({ + page + }) => { + await page.goto(conditionSet.url); + + // Change the object to edit mode + await page.getByLabel('Edit Object').click(); + + // Click Add Condition button + await page.locator('#addCondition').click(); + // Check that the new Unnamed Condition section appears + const numOfUnnamedConditions = await page + .locator('.c-condition__name', { hasText: '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' + }); + + await page.goto(conditionSet.url); + + // Change the object to edit mode + await page.getByLabel('Edit Object').click(); + + // Expand the 'My Items' folder in the left tree + 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); + + await page.locator('button[title="Save"]').click(); + await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); + + await page.getByLabel('Open the View Switcher Menu').click(); + + 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(); + await page.getByLabel('Plot').click(); + await expect( + page.getByLabel('Plot Legend Collapsed').getByText('Test Condition Set') + ).toBeVisible(); + await page.getByLabel('Open the View Switcher Menu').click(); + await page.getByLabel('Telemetry Table').click(); + await expect(page.getByRole('searchbox', { name: 'output filter input' })).toBeVisible(); + await page.getByLabel('Open the View Switcher Menu').click(); + await page.getByLabel('Conditions View').click(); + await expect(page.getByText('Current Output')).toBeVisible(); + }); + test('ConditionSet has correct outputs when telemetry is and is not available', async ({ + page + }) => { + const exampleTelemetry = await createExampleTelemetryObject(page); + + await page.getByLabel('Show selected item in tree').click(); + await page.goto(conditionSet.url); + // Change the object to edit mode + await page.getByLabel('Edit Object').click(); + + // Create two conditions + await page.locator('#addCondition').click(); + await page.locator('#addCondition').click(); + await page.locator('#conditionCollection').getByRole('textbox').nth(0).fill('First Condition'); + await page.locator('#conditionCollection').getByRole('textbox').nth(1).fill('Second Condition'); + + // Add Telemetry to ConditionSet + const sineWaveGeneratorTreeItem = page + .getByRole('tree', { + name: 'Main Tree' + }) + .getByRole('treeitem', { + name: exampleTelemetry.name + }); + const conditionCollection = page.locator('#conditionCollection'); + await sineWaveGeneratorTreeItem.dragTo(conditionCollection); + + // Modify First Criterion + const firstCriterionTelemetry = page.locator( + '[aria-label="Criterion Telemetry Selection"] >> nth=0' + ); + firstCriterionTelemetry.selectOption({ label: exampleTelemetry.name }); + const firstCriterionMetadata = page.locator( + '[aria-label="Criterion Metadata Selection"] >> nth=0' + ); + firstCriterionMetadata.selectOption({ label: 'Sine' }); + const firstCriterionComparison = page.locator( + '[aria-label="Criterion Comparison Selection"] >> nth=0' + ); + firstCriterionComparison.selectOption({ label: 'is greater than or equal to' }); + const firstCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=0'); + await firstCriterionInput.fill('0'); + + // Modify First Criterion + const secondCriterionTelemetry = page.locator( + '[aria-label="Criterion Telemetry Selection"] >> nth=1' + ); + secondCriterionTelemetry.selectOption({ label: exampleTelemetry.name }); + + const secondCriterionMetadata = page.locator( + '[aria-label="Criterion Metadata Selection"] >> nth=1' + ); + secondCriterionMetadata.selectOption({ label: 'Sine' }); + + const secondCriterionComparison = page.locator( + '[aria-label="Criterion Comparison Selection"] >> nth=1' + ); + secondCriterionComparison.selectOption({ label: 'is less than' }); + + const secondCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=1'); + await secondCriterionInput.fill('0'); + + // Save ConditionSet + await page.locator('button[title="Save"]').click(); + await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); + + // Validate that the condition set is evaluating and outputting + // the correct value when the underlying telemetry subscription is active. + let outputValue = page.getByLabel('Current Output Value'); + await expect(outputValue).toHaveText('false'); + + await page.goto(exampleTelemetry.url); + + // Edit SWG to add 8 second loading delay to simulate the case + // where telemetry is not available. + await page.getByTitle('More actions').click(); + await page.getByRole('menuitem', { name: 'Edit Properties...' }).click(); + await page.getByRole('spinbutton', { name: 'Loading Delay (ms)' }).fill('8000'); + await page.getByLabel('Save').click(); + + // Expect that the output value is blank or '---' if the + // underlying telemetry subscription is not active. + await page.goto(conditionSet.url); + await expect(outputValue).toHaveText('---'); + }); + + test('ConditionSet has correct outputs when test data is enabled', async ({ page }) => { + const exampleTelemetry = await createExampleTelemetryObject(page); + + await page.getByLabel('Show selected item in tree').click(); + await page.goto(conditionSet.url); + // Change the object to edit mode + await page.getByLabel('Edit Object').click(); + + // Create two conditions + await page.locator('#addCondition').click(); + await page.locator('#addCondition').click(); + await page.locator('#conditionCollection').getByRole('textbox').nth(0).fill('First Condition'); + await page.locator('#conditionCollection').getByRole('textbox').nth(1).fill('Second Condition'); + + // Add Telemetry to ConditionSet + const sineWaveGeneratorTreeItem = page + .getByRole('tree', { + name: 'Main Tree' + }) + .getByRole('treeitem', { + name: exampleTelemetry.name + }); + const conditionCollection = page.locator('#conditionCollection'); + await sineWaveGeneratorTreeItem.dragTo(conditionCollection); + + // Modify First Criterion + const firstCriterionTelemetry = page.locator( + '[aria-label="Criterion Telemetry Selection"] >> nth=0' + ); + firstCriterionTelemetry.selectOption({ label: exampleTelemetry.name }); + const firstCriterionMetadata = page.locator( + '[aria-label="Criterion Metadata Selection"] >> nth=0' + ); + firstCriterionMetadata.selectOption({ label: 'Sine' }); + const firstCriterionComparison = page.locator( + '[aria-label="Criterion Comparison Selection"] >> nth=0' + ); + firstCriterionComparison.selectOption({ label: 'is greater than or equal to' }); + const firstCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=0'); + await firstCriterionInput.fill('0'); + + // Modify Second Criterion + const secondCriterionTelemetry = page.locator( + '[aria-label="Criterion Telemetry Selection"] >> nth=1' + ); + await secondCriterionTelemetry.selectOption({ label: exampleTelemetry.name }); + + const secondCriterionMetadata = page.locator( + '[aria-label="Criterion Metadata Selection"] >> nth=1' + ); + await secondCriterionMetadata.selectOption({ label: 'Sine' }); + + const secondCriterionComparison = page.locator( + '[aria-label="Criterion Comparison Selection"] >> nth=1' + ); + await secondCriterionComparison.selectOption({ label: 'is less than' }); + + const secondCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=1'); + await secondCriterionInput.fill('0'); + + // Enable test data + await page.getByLabel('Apply Test Data').nth(1).click(); + const testDataTelemetry = page.locator('[aria-label="Test Data Telemetry Selection"] >> nth=0'); + await testDataTelemetry.selectOption({ label: exampleTelemetry.name }); + + const testDataMetadata = page.locator('[aria-label="Test Data Metadata Selection"] >> nth=0'); + await testDataMetadata.selectOption({ label: 'Sine' }); + + const testInput = page.locator('[aria-label="Test Data Input"] >> nth=0'); + await testInput.fill('0'); + + // Validate that the condition set is evaluating and outputting + // the correct value when the underlying telemetry subscription is active. + let outputValue = page.getByLabel('Current Output Value'); + await expect(outputValue).toHaveText('false'); + + await page.goto(exampleTelemetry.url); + }); + + test.fixme('Ensure condition sets work with telemetry like operator status', ({ page }) => { + test.info().annotations.push({ + type: 'issue', + description: 'https://github.com/nasa/openmct/issues/7484' + }); + }); +}); + +test.describe('Condition Set Composition', () => { + let conditionSet; + let exampleTelemetry; + + test.beforeEach(async ({ page }) => { + await page.goto('./', { waitUntil: 'domcontentloaded' }); + + // Create Condition Set + conditionSet = await createDomainObjectWithDefaults(page, { + type: 'Condition Set' + }); + + // Create Telemetry Object as child to Condition Set + exampleTelemetry = await createExampleTelemetryObject(page, conditionSet.uuid); + + // Edit Condition Set + await page.goto(conditionSet.url); + await page.getByRole('button', { name: 'Edit Object' }).click(); + + // Add Condition to Condition Set + await page.getByRole('button', { name: 'Add Condition' }).click(); + + // Enter Condition Output + await page.getByLabel('Condition Name Input').first().fill('Negative'); + await page.getByLabel('Condition Output Type').first().selectOption({ value: 'string' }); + await page.getByLabel('Condition Output String').first().fill('Negative'); + + // Condition Trigger default is okay so no change needed to form + + // Enter Condition Criterion + await page.getByLabel('Criterion Telemetry Selection').first().selectOption({ value: 'all' }); + await page.getByLabel('Criterion Metadata Selection').first().selectOption({ value: 'sin' }); + await page + .locator('select[aria-label="Criterion Comparison Selection"]') + .first() + .selectOption({ value: 'lessThan' }); + await page.getByLabel('Criterion Input').first().fill('0'); + + // Save the Condition Set + await page.getByRole('button', { name: 'Save' }).click(); + await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); + }); + + test('You can remove telemetry from a condition set with existing conditions', async ({ + page + }) => { + test.info().annotations.push({ + type: 'issue', + description: 'https://github.com/nasa/openmct/issues/7710' + }); + + await page.getByLabel('Expand My Items folder').click(); + await page.getByLabel(`Expand ${conditionSet.name} conditionSet`).click(); + + await page + .getByLabel(`Navigate to ${exampleTelemetry.name}`, { exact: false }) + .click({ button: 'right' }); + + await page + .getByLabel(`${exampleTelemetry.name} Context Menu`) + .getByRole('menuitem', { name: 'Remove' }) + .click(); + await page.getByRole('button', { name: 'OK', exact: true }).click(); + + await page + .getByLabel(`Navigate to ${conditionSet.name} conditionSet Object`, { exact: true }) + .click(); + await page.getByRole('button', { name: 'Edit Object' }).click(); + await page.getByRole('tab', { name: 'Elements' }).click(); + expect( + await page + .getByRole('tabpanel', { name: 'Inspector Views' }) + .getByRole('listitem', { name: exampleTelemetry.name }) + .count() + ).toEqual(0); + }); +}); diff --git a/e2e/tests/functional/plugins/gauge/gauge.e2e.spec.js b/e2e/tests/functional/plugins/gauge/gauge.e2e.spec.js index d2dd067f30..95ddf4f3e9 100644 --- a/e2e/tests/functional/plugins/gauge/gauge.e2e.spec.js +++ b/e2e/tests/functional/plugins/gauge/gauge.e2e.spec.js @@ -136,14 +136,11 @@ test.describe('Gauge', () => { // TODO: Verify changes in the UI }); - test.fixme('Gauge does not display NaN when data not available', async ({ page }) => { - test.info().annotations.push({ - type: 'issue', - description: 'https://github.com/nasa/openmct/issues/7421' - }); + test('Gauge does not display NaN when data not available', async ({ page }) => { // Create a Gauge const gauge = await createDomainObjectWithDefaults(page, { - type: 'Gauge' + type: 'Gauge', + name: 'Gauge with no data' }); // Create a Sine Wave Generator in the Gauge with a loading delay @@ -154,7 +151,7 @@ test.describe('Gauge', () => { await page.getByRole('menuitem', { name: /Edit Properties.../ }).click(); //Edit Example Telemetry Object to include 5s loading Delay - await page.locator('[aria-label="Loading Delay \\(ms\\)"]').fill('5000'); + await page.getByLabel('Loading Delay (ms)', { exact: true }).fill('5000'); await page.getByRole('button', { name: 'Save' }).click(); @@ -162,9 +159,13 @@ test.describe('Gauge', () => { await page.waitForURL(`**/${gauge.uuid}/*`); // Nav to the Gauge - await page.goto(gauge.url); - const gaugeNoDataText = await page.locator('.js-dial-current-value tspan').textContent(); - expect(gaugeNoDataText).toBe('--'); + await page.goto(gauge.url, { waitUntil: 'domcontentloaded' }); + // Check that the value is not displayed + //TODO https://github.com/nasa/openmct/issues/7790 update this locator + await expect(page.getByTitle('Value is currently out of')).toHaveAttribute( + 'aria-valuenow', + '--' + ); }); test('Gauge enforces composition policy', async ({ page }) => { diff --git a/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js b/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js index c5a9aa6874..0dd3baa03f 100644 --- a/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js +++ b/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js @@ -309,32 +309,26 @@ test.describe('Overlay Plot', () => { expect(yAxis3Group.getByRole('listitem').nth(0).getByText(swgB.name)).toBeTruthy(); }); - test.fixme( - 'Clicking on an item in the elements pool brings up the plot preview with data points', - async ({ page }) => { - test.info().annotations.push({ - type: 'issue', - description: 'https://github.com/nasa/openmct/issues/7421' - }); + test('Clicking on an item in the elements pool brings up the plot preview with data points', async ({ + page + }) => { + const swgA = await createDomainObjectWithDefaults(page, { + type: 'Sine Wave Generator', + parent: overlayPlot.uuid + }); - const swgA = await createDomainObjectWithDefaults(page, { - type: 'Sine Wave Generator', - parent: overlayPlot.uuid - }); + await page.goto(overlayPlot.url); + // Wait for plot series data to load and be drawn + await waitForPlotsToRender(page); + await page.getByLabel('Edit Object').click(); - await page.goto(overlayPlot.url); - // Wait for plot series data to load and be drawn - await waitForPlotsToRender(page); - await page.getByLabel('Edit Object').click(); + await page.getByRole('tab', { name: 'Elements' }).click(); - await page.getByRole('tab', { name: 'Elements' }).click(); - - await page.locator(`#inspector-elements-tree >> text=${swgA.name}`).click(); - const plotPixels = await getCanvasPixels(page, '.js-overlay canvas'); - const plotPixelSize = plotPixels.length; - expect(plotPixelSize).toBeGreaterThan(0); - } - ); + await page.locator(`#inspector-elements-tree >> text=${swgA.name}`).click(); + const plotPixels = await getCanvasPixels(page, '.js-overlay canvas'); + const plotPixelSize = plotPixels.length; + expect(plotPixelSize).toBeGreaterThan(0); + }); test('Can remove an item via the elements pool action menu', async ({ page }) => { const swgA = await createDomainObjectWithDefaults(page, { diff --git a/e2e/tests/functional/plugins/plot/plotRendering.e2e.spec.js b/e2e/tests/functional/plugins/plot/plotRendering.e2e.spec.js index d178b79b8b..472a00eaa8 100644 --- a/e2e/tests/functional/plugins/plot/plotRendering.e2e.spec.js +++ b/e2e/tests/functional/plugins/plot/plotRendering.e2e.spec.js @@ -84,11 +84,7 @@ test.describe('Plot Rendering', () => { await expect(page.getByLabel('Time Conductor Mode')).toHaveText('Fixed Timespan'); }); - test.fixme('Plot is rendered when infinity values exist', async ({ page }) => { - test.info().annotations.push({ - type: 'issue', - description: 'https://github.com/nasa/openmct/issues/7421' - }); + test('Plot is rendered when infinity values exist', async ({ page }) => { // Edit Plot await editSineWaveToUseInfinityOption(page, sineWaveGeneratorObject); diff --git a/e2e/tests/functional/tooltips.e2e.spec.js b/e2e/tests/functional/tooltips.e2e.spec.js index 21ef7cfef4..3b5eb55263 100644 --- a/e2e/tests/functional/tooltips.e2e.spec.js +++ b/e2e/tests/functional/tooltips.e2e.spec.js @@ -372,19 +372,15 @@ test.describe('Verify tooltips', () => { await expect(page.getByRole('tooltip')).toHaveText(sineWaveObject3.path); }); - test.fixme('display tooltip path for telemetry table names', async ({ page }) => { - test.info().annotations.push({ - type: 'issue', - description: 'https://github.com/nasa/openmct/issues/7421' - }); - // set endBound to 10 seconds after start bound - const url = page.url(); - const parsedUrl = new URL(url.replace('#', '!')); - const startBound = Number(parsedUrl.searchParams.get('tc.startBound')); - const tenSecondsInMilliseconds = 10 * 1000; - const endBound = startBound + tenSecondsInMilliseconds; - parsedUrl.searchParams.set('tc.endBound', endBound); - await page.goto(parsedUrl.href.replace('!', '#')); + test('display tooltip path for telemetry table names', async ({ page }) => { + // set endBound to 10 seconds after start bound to ensure that the telemetry doesn't change + // const url = page.url(); + // const parsedUrl = new URL(url.replace('#', '!')); + // const startBound = Number(parsedUrl.searchParams.get('tc.startBound')); + // const tenSecondsInMilliseconds = 10 * 1000; + // const endBound = startBound + tenSecondsInMilliseconds; + // parsedUrl.searchParams.set('tc.endBound', endBound); + // await page.goto(parsedUrl.href.replace('!', '#')); await createDomainObjectWithDefaults(page, { type: 'Telemetry Table', @@ -398,15 +394,13 @@ test.describe('Verify tooltips', () => { await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); await page.keyboard.down('Control'); + //Hover over SWG3 in Telemetry Table await page.locator('.noselect > [title="SWG 3"]').first().hover(); - let tooltipText = await page.locator('.c-tooltip').innerText(); - tooltipText = tooltipText.replace('\n', '').trim(); - expect(tooltipText).toBe(sineWaveObject3.path); + await expect(page.getByRole('tooltip')).toHaveText(sineWaveObject3.path); + //Hover over SWG1 in Telemetry Table await page.locator('.noselect > [title="SWG 1"]').first().hover(); - tooltipText = await page.locator('.c-tooltip').innerText(); - tooltipText = tooltipText.replace('\n', '').trim(); - expect(tooltipText).toBe(sineWaveObject1.path); + await expect(page.getByRole('tooltip')).toHaveText(sineWaveObject1.path); }); test('display tooltip path for recently viewed items', async ({ page }) => {