@@ -1134,45 +1134,83 @@ describe('End-to-End Session Creation Workflow', () => {
11341134
11351135 // Add electrode group and select device type
11361136 const addElectrodeGroupButton = screen . getByTitle ( / A d d e l e c t r o d e _ g r o u p s / i) ;
1137- let electrodeGroupIdInputs = screen . queryAllByLabelText ( / e l e c t r o d e g r o u p i d / i) ;
1137+
1138+ // Count using placeholder (same pattern as test 9)
1139+ let electrodeGroupIdInputs = screen . queryAllByPlaceholderText ( / t y p i c a l l y a n u m b e r / i) ;
1140+ electrodeGroupIdInputs = electrodeGroupIdInputs . filter ( input =>
1141+ input . id && input . id . startsWith ( 'electrode_groups-id-' )
1142+ ) ;
11381143 const initialElectrodeGroupCount = electrodeGroupIdInputs . length ;
11391144
11401145 await user . click ( addElectrodeGroupButton ) ;
11411146
11421147 await waitFor ( ( ) => {
1143- electrodeGroupIdInputs = screen . queryAllByLabelText ( / e l e c t r o d e g r o u p i d / i) ;
1144- expect ( electrodeGroupIdInputs . length ) . toBe ( initialElectrodeGroupCount + 1 ) ;
1148+ let updatedInputs = screen . queryAllByPlaceholderText ( / t y p i c a l l y a n u m b e r / i) ;
1149+ updatedInputs = updatedInputs . filter ( input =>
1150+ input . id && input . id . startsWith ( 'electrode_groups-id-' )
1151+ ) ;
1152+ expect ( updatedInputs . length ) . toBe ( initialElectrodeGroupCount + 1 ) ;
11451153 } ) ;
11461154
1147- // Use placeholder text to find location field (more specific than label)
1148- const locationInputs = screen . queryAllByPlaceholderText ( / t y p e t o f i n d a l o c a t i o n / i) ;
1149- // Get the last one added (most recent electrode group)
1155+ // Fill electrode group fields with blur() + delay pattern (same as test 9)
1156+ let locationInputs = screen . queryAllByPlaceholderText ( / t y p e t o f i n d a l o c a t i o n / i) ;
11501157 const electrodeGroupLocationInput = locationInputs [ locationInputs . length - 1 ] ;
11511158 await user . type ( electrodeGroupLocationInput , 'CA1' ) ;
1159+ electrodeGroupLocationInput . blur ( ) ;
1160+ await act ( async ( ) => {
1161+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1162+ } ) ;
11521163
1153- // Fill remaining required electrode group fields
1154- const descriptionInputs = screen . queryAllByLabelText ( / ^ d e s c r i p t i o n $ / i) ;
1164+ let descriptionInputs = screen . queryAllByLabelText ( / ^ d e s c r i p t i o n $ / i) ;
11551165 await user . type ( descriptionInputs [ descriptionInputs . length - 1 ] , 'Test tetrode' ) ;
1166+ descriptionInputs [ descriptionInputs . length - 1 ] . blur ( ) ;
1167+ await act ( async ( ) => {
1168+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1169+ } ) ;
11561170
1157- const targetedLocationInputs = screen . queryAllByLabelText ( / t a r g e t e d l o c a t i o n / i) ;
1171+ let targetedLocationInputs = screen . queryAllByLabelText ( / t a r g e t e d l o c a t i o n / i) ;
11581172 await user . type ( targetedLocationInputs [ targetedLocationInputs . length - 1 ] , 'CA1' ) ;
1173+ targetedLocationInputs [ targetedLocationInputs . length - 1 ] . blur ( ) ;
1174+ await act ( async ( ) => {
1175+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1176+ } ) ;
11591177
1160- const targetedXInputs = screen . queryAllByLabelText ( / t a r g e t e d x / i) ;
1178+ // Use correct label text (same as test 9)
1179+ let targetedXInputs = screen . queryAllByLabelText ( / M L f r o m B r e g m a / i) ;
11611180 await user . type ( targetedXInputs [ targetedXInputs . length - 1 ] , '1.0' ) ;
1181+ targetedXInputs [ targetedXInputs . length - 1 ] . blur ( ) ;
1182+ await act ( async ( ) => {
1183+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1184+ } ) ;
11621185
1163- const targetedYInputs = screen . queryAllByLabelText ( / t a r g e t e d y / i) ;
1186+ let targetedYInputs = screen . queryAllByLabelText ( / A P t o B r e g m a / i) ;
11641187 await user . type ( targetedYInputs [ targetedYInputs . length - 1 ] , '2.0' ) ;
1188+ targetedYInputs [ targetedYInputs . length - 1 ] . blur ( ) ;
1189+ await act ( async ( ) => {
1190+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1191+ } ) ;
11651192
1166- const targetedZInputs = screen . queryAllByLabelText ( / t a r g e t e d z / i) ;
1193+ let targetedZInputs = screen . queryAllByLabelText ( / D V t o C o r t i c a l S u r f a c e / i) ;
11671194 await user . type ( targetedZInputs [ targetedZInputs . length - 1 ] , '3.0' ) ;
1195+ targetedZInputs [ targetedZInputs . length - 1 ] . blur ( ) ;
1196+ await act ( async ( ) => {
1197+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1198+ } ) ;
11681199
1169- const unitsInputs = screen . queryAllByLabelText ( / ^ u n i t s $ / i) ;
1200+ let unitsInputs = screen . queryAllByPlaceholderText ( / D i s t a n c e u n i t s d e f i n i n g p o s i t i o n i n g / i) ;
11701201 await user . type ( unitsInputs [ unitsInputs . length - 1 ] , 'mm' ) ;
1202+ unitsInputs [ unitsInputs . length - 1 ] . blur ( ) ;
1203+ await act ( async ( ) => {
1204+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1205+ } ) ;
11711206
11721207 // Select device type to trigger ntrode generation
1173- // Device type select - get all and use the last one (most recent electrode group)
1174- const deviceTypeInputs = screen . queryAllByLabelText ( / d e v i c e t y p e / i) ;
1208+ let deviceTypeInputs = screen . queryAllByLabelText ( / d e v i c e t y p e / i) ;
11751209 await user . selectOptions ( deviceTypeInputs [ deviceTypeInputs . length - 1 ] , 'tetrode_12.5' ) ;
1210+ deviceTypeInputs [ deviceTypeInputs . length - 1 ] . blur ( ) ;
1211+ await act ( async ( ) => {
1212+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1213+ } ) ;
11761214
11771215 // Wait for ntrode generation (async operation)
11781216 await waitFor ( ( ) => {
@@ -1291,18 +1329,32 @@ describe('End-to-End Session Creation Workflow', () => {
12911329 expect ( taskNameInputs . length ) . toBe ( initialTaskCount + 1 ) ;
12921330 } ) ;
12931331
1294- // Fill ALL required task fields
1332+ // Fill ALL required task fields with blur() + delay pattern
12951333 taskNameInputs = screen . getAllByLabelText ( / t a s k n a m e / i) ;
12961334 await user . type ( taskNameInputs [ 0 ] , 'w_track' ) ;
1335+ taskNameInputs [ 0 ] . blur ( ) ;
1336+ await act ( async ( ) => {
1337+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1338+ } ) ;
12971339
1298- const taskDescInputs = screen . getAllByLabelText ( / t a s k d e s c r i p t i o n / i) ;
1340+ let taskDescInputs = screen . getAllByLabelText ( / t a s k d e s c r i p t i o n / i) ;
12991341 await user . type ( taskDescInputs [ 0 ] , 'W-track task' ) ;
1342+ taskDescInputs [ 0 ] . blur ( ) ;
1343+ await act ( async ( ) => {
1344+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1345+ } ) ;
13001346
13011347 const taskEnvInputs = screen . getAllByLabelText ( / t a s k e n v i r o n m e n t / i) ;
13021348 await user . type ( taskEnvInputs [ 0 ] , 'W-track maze' ) ;
1349+ taskEnvInputs [ 0 ] . blur ( ) ;
1350+ await act ( async ( ) => {
1351+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1352+ } ) ;
13031353
1304- const taskEpochInputs = screen . getAllByLabelText ( / t a s k e p o c h s / i) ;
1305- await user . type ( taskEpochInputs [ 0 ] , '1' ) ;
1354+ // task_epochs is a ListElement - use placeholder instead of label
1355+ const taskEpochInput = screen . getByPlaceholderText ( / T y p e T a s k E p o c h s / i) ;
1356+ await user . type ( taskEpochInput , '1' ) ;
1357+ await user . keyboard ( '{Enter}' ) ;
13061358
13071359 // Add electrode group
13081360 const addElectrodeGroupButton = screen . getByTitle ( / A d d e l e c t r o d e _ g r o u p s / i) ;
@@ -1326,31 +1378,64 @@ describe('End-to-End Session Creation Workflow', () => {
13261378 expect ( updatedInputs . length ) . toBe ( initialElectrodeGroupCount + 1 ) ;
13271379 } ) ;
13281380
1329- // Fill ALL required electrode group fields
1330- const locationInputs = screen . queryAllByPlaceholderText ( / t y p e t o f i n d a l o c a t i o n / i) ;
1381+ // Fill ALL required electrode group fields with blur() + delay pattern
1382+ let locationInputs = screen . queryAllByPlaceholderText ( / t y p e t o f i n d a l o c a t i o n / i) ;
13311383 await user . type ( locationInputs [ locationInputs . length - 1 ] , 'CA1' ) ;
1384+ locationInputs [ locationInputs . length - 1 ] . blur ( ) ;
1385+ await act ( async ( ) => {
1386+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1387+ } ) ;
13321388
1333- const descriptionInputs = screen . queryAllByLabelText ( / ^ d e s c r i p t i o n $ / i) ;
1389+ let descriptionInputs = screen . queryAllByLabelText ( / ^ d e s c r i p t i o n $ / i) ;
13341390 await user . type ( descriptionInputs [ descriptionInputs . length - 1 ] , 'CA1 tetrode' ) ;
1391+ descriptionInputs [ descriptionInputs . length - 1 ] . blur ( ) ;
1392+ await act ( async ( ) => {
1393+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1394+ } ) ;
13351395
1336- const targetedLocationInputs = screen . queryAllByLabelText ( / t a r g e t e d l o c a t i o n / i) ;
1396+ let targetedLocationInputs = screen . queryAllByLabelText ( / t a r g e t e d l o c a t i o n / i) ;
13371397 await user . type ( targetedLocationInputs [ targetedLocationInputs . length - 1 ] , 'CA1' ) ;
1398+ targetedLocationInputs [ targetedLocationInputs . length - 1 ] . blur ( ) ;
1399+ await act ( async ( ) => {
1400+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1401+ } ) ;
13381402
1339- const targetedXInputs = screen . queryAllByLabelText ( / t a r g e t e d x / i) ;
1403+ // Use correct label text
1404+ let targetedXInputs = screen . queryAllByLabelText ( / M L f r o m B r e g m a / i) ;
13401405 await user . type ( targetedXInputs [ targetedXInputs . length - 1 ] , '1.0' ) ;
1406+ targetedXInputs [ targetedXInputs . length - 1 ] . blur ( ) ;
1407+ await act ( async ( ) => {
1408+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1409+ } ) ;
13411410
1342- const targetedYInputs = screen . queryAllByLabelText ( / t a r g e t e d y / i) ;
1411+ let targetedYInputs = screen . queryAllByLabelText ( / A P t o B r e g m a / i) ;
13431412 await user . type ( targetedYInputs [ targetedYInputs . length - 1 ] , '2.0' ) ;
1413+ targetedYInputs [ targetedYInputs . length - 1 ] . blur ( ) ;
1414+ await act ( async ( ) => {
1415+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1416+ } ) ;
13441417
1345- const targetedZInputs = screen . queryAllByLabelText ( / t a r g e t e d z / i) ;
1418+ let targetedZInputs = screen . queryAllByLabelText ( / D V t o C o r t i c a l S u r f a c e / i) ;
13461419 await user . type ( targetedZInputs [ targetedZInputs . length - 1 ] , '3.0' ) ;
1420+ targetedZInputs [ targetedZInputs . length - 1 ] . blur ( ) ;
1421+ await act ( async ( ) => {
1422+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1423+ } ) ;
13471424
1348- const unitsInputs = screen . queryAllByLabelText ( / ^ u n i t s $ / i) ;
1425+ let unitsInputs = screen . queryAllByPlaceholderText ( / D i s t a n c e u n i t s d e f i n i n g p o s i t i o n i n g / i) ;
13491426 await user . type ( unitsInputs [ unitsInputs . length - 1 ] , 'mm' ) ;
1427+ unitsInputs [ unitsInputs . length - 1 ] . blur ( ) ;
1428+ await act ( async ( ) => {
1429+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1430+ } ) ;
13501431
13511432 // Device type select - get all and use the last one (most recent electrode group)
1352- const deviceTypeInputs = screen . queryAllByLabelText ( / d e v i c e t y p e / i) ;
1433+ let deviceTypeInputs = screen . queryAllByLabelText ( / d e v i c e t y p e / i) ;
13531434 await user . selectOptions ( deviceTypeInputs [ deviceTypeInputs . length - 1 ] , 'tetrode_12.5' ) ;
1435+ deviceTypeInputs [ deviceTypeInputs . length - 1 ] . blur ( ) ;
1436+ await act ( async ( ) => {
1437+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1438+ } ) ;
13541439
13551440 // Wait for ntrode generation
13561441 await waitFor ( ( ) => {
0 commit comments