diff --git a/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js b/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js index 7cdfae0708..bfa1e6e015 100644 --- a/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js +++ b/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js @@ -371,7 +371,7 @@ test.describe('Basic Condition Set Use', () => { // Validate that the condition set is evaluating and outputting // the correct value when the underlying telemetry subscription is active. - let outputValue = page.locator('[aria-label="Current Output Value"]'); + let outputValue = page.getByLabel('Current Output Value'); await expect(outputValue).toHaveText('false'); await page.goto(exampleTelemetry.url); @@ -462,7 +462,7 @@ test.describe('Basic Condition Set Use', () => { // Validate that the condition set is evaluating and outputting // the correct value when the underlying telemetry subscription is active. - let outputValue = page.locator('[aria-label="Current Output Value"]'); + let outputValue = page.getByLabel('Current Output Value'); await expect(outputValue).toHaveText('false'); await page.goto(exampleTelemetry.url); @@ -475,3 +475,81 @@ test.describe('Basic Condition Set Use', () => { }); }); }); + +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/src/plugins/condition/ConditionManager.js b/src/plugins/condition/ConditionManager.js index 7d10dee642..ec48a59417 100644 --- a/src/plugins/condition/ConditionManager.js +++ b/src/plugins/condition/ConditionManager.js @@ -46,14 +46,6 @@ export default class ConditionManager extends EventEmitter { applied: false }; this.initialize(); - - this.stopObservingForChanges = this.openmct.objects.observe( - this.conditionSetDomainObject, - '*', - (newDomainObject) => { - this.conditionSetDomainObject = newDomainObject; - } - ); } async requestLatestValue(endpoint) { @@ -518,10 +510,6 @@ export default class ConditionManager extends EventEmitter { Object.values(this.subscriptions).forEach((unsubscribe) => unsubscribe()); delete this.subscriptions; - if (this.stopObservingForChanges) { - this.stopObservingForChanges(); - } - this.conditions.forEach((condition) => { condition.destroy(); }); diff --git a/src/plugins/condition/components/ConditionCollection.vue b/src/plugins/condition/components/ConditionCollection.vue index d4bb58d88f..ba19d006bb 100644 --- a/src/plugins/condition/components/ConditionCollection.vue +++ b/src/plugins/condition/components/ConditionCollection.vue @@ -21,7 +21,11 @@ -->