@@ -1034,35 +1034,65 @@ describe('End-to-End Session Creation Workflow', () => {
10341034 ) ;
10351035 expect ( electrodeGroupIdInput ) . toHaveValue ( 0 ) ; // Auto-assigned ID
10361036
1037+ // Fill electrode group fields with blur() + delay to prevent stale references
10371038 // Use placeholder text to find location field (more specific than label)
1038- const locationInputs = screen . queryAllByPlaceholderText ( / t y p e t o f i n d a l o c a t i o n / i) ;
1039- // Get the last one added (most recent electrode group)
1039+ let locationInputs = screen . queryAllByPlaceholderText ( / t y p e t o f i n d a l o c a t i o n / i) ;
10401040 const electrodeGroupLocationInput = locationInputs [ locationInputs . length - 1 ] ;
10411041 await user . type ( electrodeGroupLocationInput , 'CA1' ) ;
1042+ electrodeGroupLocationInput . blur ( ) ;
1043+ await act ( async ( ) => {
1044+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1045+ } ) ;
10421046
10431047 // Device type select - get all and use the last one (most recent electrode group)
1044- const deviceTypeInputs = screen . queryAllByLabelText ( / d e v i c e t y p e / i) ;
1048+ let deviceTypeInputs = screen . queryAllByLabelText ( / d e v i c e t y p e / i) ;
10451049 await user . selectOptions ( deviceTypeInputs [ deviceTypeInputs . length - 1 ] , 'tetrode_12.5' ) ;
1050+ deviceTypeInputs [ deviceTypeInputs . length - 1 ] . blur ( ) ;
1051+ await act ( async ( ) => {
1052+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1053+ } ) ;
10461054
10471055 // Description field - get all and use the last one (most recent electrode group)
1048- const descriptionInputs = screen . queryAllByLabelText ( / ^ d e s c r i p t i o n $ / i) ;
1056+ let descriptionInputs = screen . queryAllByLabelText ( / ^ d e s c r i p t i o n $ / i) ;
10491057 const electrodeGroupDescInput = descriptionInputs [ descriptionInputs . length - 1 ] ;
10501058 await user . type ( electrodeGroupDescInput , 'Dorsal CA1 tetrode' ) ;
1059+ electrodeGroupDescInput . blur ( ) ;
1060+ await act ( async ( ) => {
1061+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1062+ } ) ;
10511063
10521064 // Fill remaining required fields for electrode group
1053- const targetedLocationInputs = screen . queryAllByLabelText ( / t a r g e t e d l o c a t i o n / i) ;
1065+ let targetedLocationInputs = screen . queryAllByLabelText ( / t a r g e t e d l o c a t i o n / i) ;
10541066 await user . type ( targetedLocationInputs [ targetedLocationInputs . length - 1 ] , 'CA1' ) ;
1067+ targetedLocationInputs [ targetedLocationInputs . length - 1 ] . blur ( ) ;
1068+ await act ( async ( ) => {
1069+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1070+ } ) ;
10551071
1056- const targetedXInputs = screen . queryAllByLabelText ( / t a r g e t e d x / i) ;
1072+ // Use correct label text from App.js
1073+ let targetedXInputs = screen . queryAllByLabelText ( / M L f r o m B r e g m a / i) ;
10571074 await user . type ( targetedXInputs [ targetedXInputs . length - 1 ] , '1.5' ) ;
1075+ targetedXInputs [ targetedXInputs . length - 1 ] . blur ( ) ;
1076+ await act ( async ( ) => {
1077+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1078+ } ) ;
10581079
1059- const targetedYInputs = screen . queryAllByLabelText ( / t a r g e t e d y / i) ;
1080+ let targetedYInputs = screen . queryAllByLabelText ( / A P t o B r e g m a / i) ;
10601081 await user . type ( targetedYInputs [ targetedYInputs . length - 1 ] , '2.0' ) ;
1082+ targetedYInputs [ targetedYInputs . length - 1 ] . blur ( ) ;
1083+ await act ( async ( ) => {
1084+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1085+ } ) ;
10611086
1062- const targetedZInputs = screen . queryAllByLabelText ( / t a r g e t e d z / i) ;
1087+ let targetedZInputs = screen . queryAllByLabelText ( / D V t o C o r t i c a l S u r f a c e / i) ;
10631088 await user . type ( targetedZInputs [ targetedZInputs . length - 1 ] , '3.0' ) ;
1089+ targetedZInputs [ targetedZInputs . length - 1 ] . blur ( ) ;
1090+ await act ( async ( ) => {
1091+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
1092+ } ) ;
10641093
1065- const unitsInputs = screen . queryAllByLabelText ( / ^ u n i t s $ / i) ;
1094+ // Units field is DataListElement with unique placeholder
1095+ 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) ;
10661096 await user . type ( unitsInputs [ unitsInputs . length - 1 ] , 'mm' ) ;
10671097
10681098 // Export using React fiber approach
0 commit comments