diff --git a/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js b/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js index 965ba7484b..53781fd2e0 100644 --- a/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js +++ b/e2e/tests/functional/plugins/conditionSet/conditionSet.e2e.spec.js @@ -52,10 +52,9 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => { //Set object identifier from url conditionSetUrl = page.url(); - console.log('conditionSetUrl ' + conditionSetUrl); getConditionSetIdentifierFromUrl = conditionSetUrl.split('/').pop().split('?')[0]; - console.debug('getConditionSetIdentifierFromUrl ' + getConditionSetIdentifierFromUrl); + console.debug(`getConditionSetIdentifierFromUrl: ${getConditionSetIdentifierFromUrl}`); await page.close(); }); @@ -246,4 +245,81 @@ test.describe('Basic Condition Set Use', () => { await expect(page.getByRole('menuitem', { name: /Plot/ })).toBeVisible(); await expect(page.getByRole('menuitem', { name: /Telemetry Table/ })).toBeVisible(); }); + test('ConditionSet should output blank instead of the default value', async ({ page }) => { + //Navigate to baseURL + await page.goto('./', { waitUntil: 'networkidle' }); + + //Click the Create button + await page.click('button:has-text("Create")'); + + // Click the object specified by 'type' + await page.click(`li[role='menuitem']:text("Sine Wave Generator")`); + await page.getByRole('spinbutton', { name: 'Loading Delay (ms)' }).fill('8000'); + const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]'); + await nameInput.fill("Delayed Sine Wave Generator"); + + // Click OK button and wait for Navigate event + await Promise.all([ + page.waitForLoadState(), + page.click('[aria-label="Save"]'), + // Wait for Save Banner to appear + page.waitForSelector('.c-message-banner__message') + ]); + + // Create a new condition set + await createDomainObjectWithDefaults(page, { + type: 'Condition Set', + name: "Test Blank Output of Condition Set" + }); + // Change the object to edit mode + await page.locator('[title="Edit"]').click(); + + // Click Add Condition button twice + 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'); + + // Expand the 'My Items' folder in the left tree + await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click(); + // Add the Sine Wave Generator to the Condition Set and save changes + const treePane = page.getByRole('tree', { + name: 'Main Tree' + }); + const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', { name: "Delayed Sine Wave Generator"}); + const conditionCollection = await page.locator('#conditionCollection'); + + await sineWaveGeneratorTreeItem.dragTo(conditionCollection); + + const firstCriterionTelemetry = await page.locator('[aria-label="Criterion Telemetry Selection"] >> nth=0'); + firstCriterionTelemetry.selectOption({ label: 'Delayed Sine Wave Generator' }); + + const secondCriterionTelemetry = await page.locator('[aria-label="Criterion Telemetry Selection"] >> nth=1'); + secondCriterionTelemetry.selectOption({ label: 'Delayed Sine Wave Generator' }); + + const firstCriterionMetadata = await page.locator('[aria-label="Criterion Metadata Selection"] >> nth=0'); + firstCriterionMetadata.selectOption({ label: 'Sine' }); + + const secondCriterionMetadata = await page.locator('[aria-label="Criterion Metadata Selection"] >> nth=1'); + secondCriterionMetadata.selectOption({ label: 'Sine' }); + + const firstCriterionComparison = await page.locator('[aria-label="Criterion Comparison Selection"] >> nth=0'); + firstCriterionComparison.selectOption({ label: 'is greater than or equal to' }); + + const secondCriterionComparison = await page.locator('[aria-label="Criterion Comparison Selection"] >> nth=1'); + secondCriterionComparison.selectOption({ label: 'is less than' }); + + const firstCriterionInput = await page.locator('[aria-label="Criterion Input"] >> nth=0'); + await firstCriterionInput.fill("0"); + + const secondCriterionInput = await page.locator('[aria-label="Criterion Input"] >> nth=1'); + await secondCriterionInput.fill("0"); + + const saveButtonLocator = page.locator('button[title="Save"]'); + await saveButtonLocator.click(); + await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); + + const outputValue = await page.locator('[aria-label="Current Output Value"]'); + await expect(outputValue).toHaveText('---'); + }); }); diff --git a/src/plugins/condition/ConditionManager.js b/src/plugins/condition/ConditionManager.js index 5049978585..0e4876d11c 100644 --- a/src/plugins/condition/ConditionManager.js +++ b/src/plugins/condition/ConditionManager.js @@ -93,6 +93,11 @@ export default class ConditionManager extends EventEmitter { ); this.updateConditionResults({id: id}); this.updateCurrentCondition(latestTimestamp); + + if (Object.keys(this.telemetryObjects).length === 0) { + // no telemetry objects + this.emit('noTelemetryObjects'); + } } initialize() { @@ -102,6 +107,11 @@ export default class ConditionManager extends EventEmitter { this.initCondition(conditionConfiguration, index); }); } + + if (Object.keys(this.telemetryObjects).length === 0) { + // no telemetry objects + this.emit('noTelemetryObjects'); + } } updateConditionTelemetryObjects() { diff --git a/src/plugins/condition/components/Condition.vue b/src/plugins/condition/components/Condition.vue index d12fc315a3..26613a3eee 100644 --- a/src/plugins/condition/components/Condition.vue +++ b/src/plugins/condition/components/Condition.vue @@ -132,6 +132,7 @@ @@ -50,6 +51,7 @@ @@ -89,6 +92,7 @@ @@ -103,6 +107,7 @@ >