@@ -27,7 +27,8 @@ demonstrate some playwright for test developers. This pattern should not be re-u
2727
2828import {
2929 createDomainObjectWithDefaults ,
30- createExampleTelemetryObject
30+ createExampleTelemetryObject ,
31+ setRealTimeMode
3132} from '../../../../appActions.js' ;
3233import { expect , test } from '../../../../pluginFixtures.js' ;
3334
@@ -116,7 +117,7 @@ test.describe('Basic Condition Set Use', () => {
116117 await page . getByLabel ( 'Conditions View' ) . click ( ) ;
117118 await expect ( page . getByText ( 'Current Output' ) ) . toBeVisible ( ) ;
118119 } ) ;
119- test ( 'ConditionSet has correct outputs when telemetry is and is not available ' , async ( {
120+ test ( 'ConditionSet produces an output when telemetry is available, and does not when it is not ' , async ( {
120121 page
121122 } ) => {
122123 const exampleTelemetry = await createExampleTelemetryObject ( page ) ;
@@ -281,6 +282,101 @@ test.describe('Basic Condition Set Use', () => {
281282 await page . goto ( exampleTelemetry . url ) ;
282283 } ) ;
283284
285+ test ( 'Short circuit evaluation does not cause incorrect evaluation https://github.com/nasa/openmct/issues/7992' , async ( {
286+ page
287+ } ) => {
288+ await setRealTimeMode ( page ) ;
289+ await page . getByLabel ( 'Create' , { exact : true } ) . click ( ) ;
290+ await page . getByLabel ( 'State Generator' ) . click ( ) ;
291+ await page . getByLabel ( 'Title' , { exact : true } ) . fill ( 'P1' ) ;
292+ await page . getByLabel ( 'State Duration (seconds)' ) . fill ( '1' ) ;
293+ await page . getByLabel ( 'Save' ) . click ( ) ;
294+ await page . getByLabel ( 'Create' , { exact : true } ) . click ( ) ;
295+ await page . getByLabel ( 'State Generator' ) . click ( ) ;
296+ await page . getByLabel ( 'Title' , { exact : true } ) . fill ( 'P2' ) ;
297+ await page . getByLabel ( 'State Duration (seconds)' , { exact : true } ) . fill ( '1' ) ;
298+ await page . getByRole ( 'treeitem' , { name : 'Test Condition Set' } ) . click ( ) ;
299+ await page . getByLabel ( 'Save' ) . click ( ) ;
300+ await page . getByLabel ( 'Expand My Items folder' ) . click ( ) ;
301+ await page . getByRole ( 'treeitem' , { name : 'Test Condition Set' } ) . click ( ) ;
302+ await page . getByLabel ( 'Edit Object' ) . click ( ) ;
303+ await page . getByLabel ( 'Add Condition' ) . click ( ) ;
304+ await page . getByLabel ( 'Condition Name Input' ) . first ( ) . fill ( 'P1 IS ON AND P2 IS ON' ) ;
305+ await page . getByLabel ( 'Criterion Telemetry Selection' ) . selectOption ( { label : 'P1' } ) ;
306+ await page . getByLabel ( 'Criterion Metadata Selection' ) . selectOption ( 'value' ) ;
307+ await page . getByLabel ( 'Criterion Comparison Selection' ) . selectOption ( 'equalTo' ) ;
308+ await page . getByLabel ( 'Criterion Input' ) . fill ( '1' ) ;
309+ await page . getByLabel ( 'Add Criteria - Enabled' ) . click ( ) ;
310+ await page . getByLabel ( 'Criterion Telemetry Selection' ) . nth ( 1 ) . selectOption ( { label : 'P2' } ) ;
311+ await page . getByLabel ( 'Criterion Metadata Selection' ) . nth ( 1 ) . selectOption ( 'value' ) ;
312+ await page . getByLabel ( 'Criterion Comparison Selection' ) . nth ( 1 ) . selectOption ( 'equalTo' ) ;
313+ await page . getByLabel ( 'Criterion Input' ) . nth ( 1 ) . fill ( '1' ) ;
314+ await page . getByLabel ( 'Add Condition' ) . click ( ) ;
315+ await page . getByLabel ( 'Condition Name Input' ) . first ( ) . fill ( 'P1 IS OFF OR P2 IS OFF' ) ;
316+ await page . getByLabel ( 'Condition Trigger' ) . first ( ) . selectOption ( 'any' ) ;
317+ await page . getByLabel ( 'Criterion Telemetry Selection' ) . first ( ) . selectOption ( { label : 'P1' } ) ;
318+ await page . getByLabel ( 'Criterion Metadata Selection' ) . first ( ) . selectOption ( 'value' ) ;
319+ await page . getByLabel ( 'Criterion Comparison Selection' ) . first ( ) . selectOption ( 'equalTo' ) ;
320+ await page . getByLabel ( 'Criterion Input' ) . first ( ) . fill ( '0' ) ;
321+ await page . getByLabel ( 'Add Criteria - Enabled' ) . first ( ) . click ( ) ;
322+ await page . getByLabel ( 'Criterion Telemetry Selection' ) . nth ( 1 ) . selectOption ( { label : 'P2' } ) ;
323+ await page . getByLabel ( 'Criterion Metadata Selection' ) . nth ( 1 ) . selectOption ( 'value' ) ;
324+ await page . getByLabel ( 'Criterion Comparison Selection' ) . nth ( 1 ) . selectOption ( 'equalTo' ) ;
325+ await page . getByLabel ( 'Criterion Input' ) . nth ( 1 ) . fill ( '0' ) ;
326+ await page . getByLabel ( 'Condition Name Input' ) . first ( ) . dblclick ( ) ;
327+ await page . getByLabel ( 'Save' ) . click ( ) ;
328+ await page . getByRole ( 'listitem' , { name : 'Save and Finish Editing' } ) . click ( ) ;
329+ await page . getByLabel ( 'Edit Object' ) . click ( ) ;
330+
331+ /**
332+ * Create default conditions for test. Start with invalid values to put condition set into
333+ * "default" state
334+ */
335+ await page . getByLabel ( 'Test Data Telemetry Selection' ) . selectOption ( { label : 'P1' } ) ;
336+ await page . getByLabel ( 'Test Data Metadata Selection' ) . selectOption ( { label : 'Value' } ) ;
337+ await page . getByLabel ( 'Test Data Input' ) . fill ( '3' ) ;
338+ await page . getByLabel ( 'Add Test Datum' ) . click ( ) ;
339+ await page . getByLabel ( 'Test Data Telemetry Selection' ) . nth ( 1 ) . selectOption ( { label : 'P2' } ) ;
340+ await page . getByLabel ( 'Test Data Metadata Selection' ) . nth ( 1 ) . selectOption ( { label : 'Value' } ) ;
341+ await page . getByLabel ( 'Test Data Input' ) . nth ( 1 ) . fill ( '3' ) ;
342+ await page . getByLabel ( 'Apply Test Data' ) . nth ( 1 ) . click ( ) ;
343+
344+ let activeCondition = page . getByLabel ( 'Active Condition Set Condition' ) ;
345+ let activeConditionName = activeCondition . getByLabel ( 'Condition Name Label' ) ;
346+
347+ await expect ( activeConditionName ) . toHaveText ( 'Default' ) ;
348+
349+ /**
350+ * Set P1 to 0
351+ */
352+ await page . getByLabel ( 'Test Data Input' ) . nth ( 0 ) . fill ( '0' ) ;
353+
354+ activeCondition = page . getByLabel ( 'Active Condition Set Condition' ) ;
355+ activeConditionName = activeCondition . getByLabel ( 'Condition Name Label' ) ;
356+
357+ await expect ( activeConditionName ) . toHaveText ( 'P1 IS OFF OR P2 IS OFF' ) ;
358+
359+ /**
360+ * Set P2 to 1
361+ */
362+ await page . getByLabel ( 'Test Data Input' ) . nth ( 1 ) . fill ( '1' ) ;
363+
364+ activeCondition = page . getByLabel ( 'Active Condition Set Condition' ) ;
365+ activeConditionName = activeCondition . getByLabel ( 'Condition Name Label' ) ;
366+
367+ await expect ( activeConditionName ) . toHaveText ( 'P1 IS OFF OR P2 IS OFF' ) ;
368+
369+ /**
370+ * Set P1 to 1
371+ */
372+ await page . getByLabel ( 'Test Data Input' ) . nth ( 0 ) . fill ( '1' ) ;
373+
374+ activeCondition = page . getByLabel ( 'Active Condition Set Condition' ) ;
375+ activeConditionName = activeCondition . getByLabel ( 'Condition Name Label' ) ;
376+
377+ await expect ( activeConditionName ) . toHaveText ( 'P1 IS ON AND P2 IS ON' ) ;
378+ } ) ;
379+
284380 test . fixme ( 'Ensure condition sets work with telemetry like operator status' , ( { page } ) => {
285381 test . info ( ) . annotations . push ( {
286382 type : 'issue' ,
0 commit comments