@@ -108,7 +108,7 @@ export class Plan {
108108 this . updatePage ( page ) ;
109109 }
110110
111- async addActivity ( name : string = 'GrowBanana' ) {
111+ async addActivityByDragAndDrop ( name : string = 'GrowBanana' ) {
112112 // Ensure Activity Directives Table panel is visible for verification later
113113 if ( ! ( await this . panelActivityDirectivesTable . isVisible ( ) ) ) {
114114 await this . showPanel ( PanelNames . ACTIVITY_DIRECTIVES_TABLE ) ;
@@ -132,6 +132,92 @@ export class Plan {
132132 await activityRow . scrollIntoViewIfNeeded ( ) ;
133133 // Use dragTo for the drag operation
134134 await activityListItem . dragTo ( activityRow , { timeout : 10000 } ) ;
135+ // Directive builder should have appeared
136+ const activityDirectiveBuilder = this . page . getByText ( 'Activity Directive Builder' ) ;
137+ await expect ( activityDirectiveBuilder ) . toBeVisible ( ) ;
138+ // Select the proper activity type
139+ await this . page . getByLabel ( 'manual-types' ) . getByText ( name ) . click ( ) ;
140+ // Create the activity
141+ await this . page . getByRole ( 'button' , { name : 'Create Activity Directive' } ) . click ( ) ;
142+ await this . waitForToast ( 'Activity Directive Created Successfully' ) ;
143+ // Verify at least one activity with this name exists in the table
144+ await expect ( this . panelActivityDirectivesTable . getByRole ( 'row' , { name } ) . first ( ) ) . toBeVisible ( { timeout : 10000 } ) ;
145+ }
146+
147+ async addActivityByGenericButton ( name : string = 'GrowBanana' ) {
148+ // Ensure Activity Directives Table panel is visible for verification later
149+ if ( ! ( await this . panelActivityDirectivesTable . isVisible ( ) ) ) {
150+ await this . showPanel ( PanelNames . ACTIVITY_DIRECTIVES_TABLE ) ;
151+ }
152+ await this . showPanel ( PanelNames . TIMELINE_ITEMS ) ;
153+ const activityListItem = this . page . locator ( `.list-item :text-is("${ name } ")` ) ;
154+ await expect ( activityListItem ) . toBeVisible ( ) ;
155+ const activityRow = this . page
156+ . locator ( '.timeline' )
157+ . getByRole ( 'listitem' )
158+ . filter ( { hasText : 'Activities by Type' } )
159+ . first ( )
160+ . locator ( '.overlay' ) ;
161+ await expect ( activityRow ) . toBeVisible ( ) ;
162+ // Wait for timeline to finish loading before attempting drag
163+ await this . waitForTimelineLoading ( ) ;
164+ // Click on activity item first to ensure Svelte drag listeners are initialized
165+ await activityListItem . click ( ) ;
166+ // Scroll elements into view
167+ await activityListItem . scrollIntoViewIfNeeded ( ) ;
168+ await activityRow . scrollIntoViewIfNeeded ( ) ;
169+ // Open builder
170+ const addActivityButton = await this . page . getByRole ( 'button' , { name : 'Add Activity' } ) ;
171+ await addActivityButton . scrollIntoViewIfNeeded ( ) ;
172+ await addActivityButton . click ( ) ;
173+ // Directive builder should have appeared
174+ const activityDirectiveBuilder = this . page . getByPlaceholder ( 'Enter an optional name for this directive' ) ;
175+ await expect ( activityDirectiveBuilder ) . toBeVisible ( ) ;
176+ // Select the proper activity type
177+ await this . page . getByLabel ( 'manual-types' ) . getByRole ( 'combobox' ) . click ( ) ;
178+ await this . page . getByRole ( 'menuitem' , { name } ) . click ( ) ;
179+ // Create the activity
180+ await this . page . getByRole ( 'button' , { name : 'Create Activity Directive' } ) . click ( ) ;
181+ await this . waitForToast ( 'Activity Directive Created Successfully' ) ;
182+ // Verify at least one activity with this name exists in the table
183+ await expect ( this . panelActivityDirectivesTable . getByRole ( 'row' , { name } ) . first ( ) ) . toBeVisible ( { timeout : 10000 } ) ;
184+ }
185+
186+ async addActivityByTypeButton ( name : string = 'GrowBanana' ) {
187+ // Ensure Activity Directives Table panel is visible for verification later
188+ if ( ! ( await this . panelActivityDirectivesTable . isVisible ( ) ) ) {
189+ await this . showPanel ( PanelNames . ACTIVITY_DIRECTIVES_TABLE ) ;
190+ }
191+ await this . showPanel ( PanelNames . TIMELINE_ITEMS ) ;
192+ const activityListItem = this . page . locator ( `.list-item :text-is("${ name } ")` ) ;
193+ await expect ( activityListItem ) . toBeVisible ( ) ;
194+ const activityRow = this . page
195+ . locator ( '.timeline' )
196+ . getByRole ( 'listitem' )
197+ . filter ( { hasText : 'Activities by Type' } )
198+ . first ( )
199+ . locator ( '.overlay' ) ;
200+ await expect ( activityRow ) . toBeVisible ( ) ;
201+ // Wait for timeline to finish loading before attempting drag
202+ await this . waitForTimelineLoading ( ) ;
203+ // Click on activity item first to ensure Svelte drag listeners are initialized
204+ await activityListItem . click ( ) ;
205+ // Scroll elements into view
206+ await activityListItem . scrollIntoViewIfNeeded ( ) ;
207+ await activityRow . scrollIntoViewIfNeeded ( ) ;
208+ // Open builder
209+ await this . page . getByText ( name ) . hover ( ) ;
210+ const addActivityButton = await this . page . getByRole ( 'button' , { name : `AddActivity-${ name } ` } ) ;
211+ await addActivityButton . scrollIntoViewIfNeeded ( ) ;
212+ await addActivityButton . click ( ) ;
213+ // Directive builder should have appeared
214+ const activityDirectiveBuilder = this . page . getByPlaceholder ( 'Enter an optional name for this directive' ) ;
215+ await expect ( activityDirectiveBuilder ) . toBeVisible ( ) ;
216+ // Select the proper activity type
217+ await this . page . getByLabel ( 'manual-types' ) . getByRole ( 'combobox' ) . click ( ) ;
218+ await this . page . getByRole ( 'menuitem' , { name } ) . click ( ) ;
219+ // Create the activity
220+ await this . page . getByRole ( 'button' , { name : 'Create Activity Directive' } ) . click ( ) ;
135221 await this . waitForToast ( 'Activity Directive Created Successfully' ) ;
136222 // Verify at least one activity with this name exists in the table
137223 await expect ( this . panelActivityDirectivesTable . getByRole ( 'row' , { name } ) . first ( ) ) . toBeVisible ( { timeout : 10000 } ) ;
0 commit comments