@@ -24,6 +24,8 @@ import {
2424 createDomainObjectWithDefaults ,
2525 createPlanFromJSON ,
2626 navigateToObjectWithFixedTimeBounds ,
27+ navigateToObjectWithRealTime ,
28+ setEndOffset ,
2729 setFixedIndependentTimeConductorBounds ,
2830 setFixedTimeMode ,
2931 setTimeConductorBounds
@@ -76,39 +78,19 @@ const testPlan = {
7678} ;
7779
7880test . describe ( 'Time Strip' , ( ) => {
79- let timestrip ;
80- let plan ;
81+ let timeStrip ;
8182
8283 test . beforeEach ( async ( { page } ) => {
8384 // Goto baseURL
8485 await page . goto ( './' , { waitUntil : 'domcontentloaded' } ) ;
8586
86- timestrip = await test . step ( 'Create a Time Strip' , async ( ) => {
87- const createdTimeStrip = await createDomainObjectWithDefaults ( page , { type : 'Time Strip' } ) ;
88- const objectName = await page . locator ( '.l-browse-bar__object-name' ) . innerText ( ) ;
89- expect ( objectName ) . toBe ( createdTimeStrip . name ) ;
90-
91- return createdTimeStrip ;
92- } ) ;
93-
94- plan = await test . step ( 'Create a Plan and add it to the timestrip' , async ( ) => {
95- const createdPlan = await createPlanFromJSON ( page , {
96- name : 'Test Plan' ,
97- json : testPlan
98- } ) ;
99-
100- await page . goto ( timestrip . url ) ;
101- // Expand the tree to show the plan
102- await page . getByLabel ( 'Show selected item in tree' ) . click ( ) ;
103- await page
104- . getByLabel ( `Navigate to ${ createdPlan . name } ` )
105- . dragTo ( page . getByLabel ( 'Object View' ) ) ;
106- await page . getByLabel ( 'Save' ) . click ( ) ;
107- await page . getByRole ( 'listitem' , { name : 'Save and Finish Editing' } ) . click ( ) ;
108-
109- return createdPlan ;
87+ timeStrip = await createDomainObjectWithDefaults ( page , { type : 'Time Strip' } ) ;
88+ await createPlanFromJSON ( page , {
89+ json : testPlan ,
90+ parent : timeStrip . uuid
11091 } ) ;
11192 } ) ;
93+
11294 test ( 'Create two Time Strips, add a single Plan to both, and verify they can have separate Independent Time Contexts' , async ( {
11395 page
11496 } ) => {
@@ -125,7 +107,7 @@ test.describe('Time Strip', () => {
125107 const endBound = testPlan . TEST_GROUP [ testPlan . TEST_GROUP . length - 1 ] . end ;
126108
127109 // Switch to fixed time mode with all plan events within the bounds
128- await navigateToObjectWithFixedTimeBounds ( page , timestrip . url , startBound , endBound ) ;
110+ await navigateToObjectWithFixedTimeBounds ( page , timeStrip . url , startBound , endBound ) ;
129111
130112 // Verify all events are displayed
131113 const eventCount = await page . locator ( '.activity-bounds' ) . count ( ) ;
@@ -150,19 +132,17 @@ test.describe('Time Strip', () => {
150132
151133 await test . step ( 'Can have multiple TimeStrips with the same plan linked and different Independent Time Contexts' , async ( ) => {
152134 // Create another Time Strip and verify that it has been created
153- const createdTimeStrip = await createDomainObjectWithDefaults ( page , {
135+ const secondTimeStrip = await createDomainObjectWithDefaults ( page , {
154136 type : 'Time Strip' ,
155137 name : 'Another Time Strip'
156138 } ) ;
157139
158- const objectName = await page . locator ( '.l-browse-bar__object-name' ) . innerText ( ) ;
159- expect ( objectName ) . toBe ( createdTimeStrip . name ) ;
160-
161- // Drag the existing Plan onto the newly created Time Strip, and save.
162- await page . getByLabel ( `Navigate to ${ plan . name } ` ) . dragTo ( page . getByLabel ( 'Object View' ) ) ;
163- await page . getByLabel ( 'Save' ) . click ( ) ;
164- await page . getByRole ( 'listitem' , { name : 'Save and Finish Editing' } ) . click ( ) ;
140+ await createPlanFromJSON ( page , {
141+ json : testPlan ,
142+ parent : secondTimeStrip . uuid
143+ } ) ;
165144
145+ await navigateToObjectWithFixedTimeBounds ( page , secondTimeStrip . url ) ;
166146 // All events should be displayed at this point because the
167147 // initial independent context bounds will match the global bounds
168148 expect ( await activityBounds . count ( ) ) . toEqual ( 5 ) ;
@@ -182,7 +162,7 @@ test.describe('Time Strip', () => {
182162 expect ( await activityBounds . count ( ) ) . toEqual ( 2 ) ;
183163
184164 // Switch to the previous Time Strip and verify that only one event is displayed
185- await page . goto ( timestrip . url ) ;
165+ await page . goto ( timeStrip . url ) ;
186166 expect ( await activityBounds . count ( ) ) . toEqual ( 1 ) ;
187167 } ) ;
188168 } ) ;
@@ -230,4 +210,47 @@ test.describe('Time Strip', () => {
230210 await expect ( page . getByLabel ( 'Now Marker' ) ) . toBeHidden ( ) ;
231211 } ) ;
232212 } ) ;
213+
214+ test ( 'Time strip ahead/behind line' , async ( { page } ) => {
215+ const aheadBehindMarker = page . getByLabel ( 'Ahead Behind Marker' ) ;
216+ await navigateToObjectWithRealTime ( page , timeStrip . url ) ;
217+ await setEndOffset ( page , {
218+ endMins : '15' ,
219+ endSecs : '00'
220+ } ) ;
221+
222+ await test . step ( 'set the ahead line' , async ( ) => {
223+ // select the first plan in the timeStrip
224+ await page . locator ( '.c-swimlane__lane-label.c-object-label' ) . nth ( 1 ) . click ( ) ;
225+ await page . getByRole ( 'button' , { name : 'Edit Object' } ) . click ( ) ;
226+ await page
227+ . locator ( 'select[aria-label="Plan Execution Monitoring Status"]' )
228+ . selectOption ( { label : 'Ahead by' } ) ;
229+ page . getByLabel ( 'Plan Execution Monitoring Duration' ) . fill ( '5' ) ;
230+
231+ await page . getByLabel ( 'Save' ) . click ( ) ;
232+ await page . getByRole ( 'listitem' , { name : 'Save and Finish Editing' } ) . click ( ) ;
233+
234+ await expect ( aheadBehindMarker ) . toBeVisible ( ) ;
235+ await expect ( aheadBehindMarker ) . toContainClass ( '--ahead' ) ;
236+ await expect ( aheadBehindMarker ) . not . toContainClass ( '--behind' ) ;
237+ } ) ;
238+
239+ await test . step ( 'set the behind line' , async ( ) => {
240+ // select the first plan in the timeStrip
241+ await page . locator ( '.c-swimlane__lane-label.c-object-label' ) . nth ( 1 ) . click ( ) ;
242+ await page . getByRole ( 'button' , { name : 'Edit Object' } ) . click ( ) ;
243+ await page
244+ . locator ( 'select[aria-label="Plan Execution Monitoring Status"]' )
245+ . selectOption ( { label : 'Behind by' } ) ;
246+ page . getByLabel ( 'Plan Execution Monitoring Duration' ) . fill ( '5' ) ;
247+
248+ await page . getByLabel ( 'Save' ) . click ( ) ;
249+ await page . getByRole ( 'listitem' , { name : 'Save and Finish Editing' } ) . click ( ) ;
250+
251+ await expect ( aheadBehindMarker ) . toBeVisible ( ) ;
252+ await expect ( aheadBehindMarker ) . not . toContainClass ( '--ahead' ) ;
253+ await expect ( aheadBehindMarker ) . toContainClass ( '--behind' ) ;
254+ } ) ;
255+ } ) ;
233256} ) ;
0 commit comments