@@ -97,14 +97,14 @@ test('parameterized fills keep literals out of recording state with deterministi
9797 flags : { recordAs : 'PASSWORD' } ,
9898 result : {
9999 text : password ,
100- message : `Filled ${ password } ` ,
100+ message : 'Filled 21 chars' ,
101+ selector : 'id="password"' ,
101102 selectorChain : [ 'id="password"' , `value="${ password } " editable=true` ] ,
102- settle : { diff : `value=${ password } ` } ,
103103 } ,
104104 targetEvidence : {
105105 role : 'textinput' ,
106- label : `Current value ${ password } ` ,
107- ancestry : [ { role : 'form' , label : `Credential ${ password } ` } ] ,
106+ label : password ,
107+ ancestry : [ { role : 'form' , label : 'Credentials' } ] ,
108108 sibling : 0 ,
109109 viewportOrder : 0 ,
110110 verification : 'verified' as const ,
@@ -117,7 +117,7 @@ test('parameterized fills keep literals out of recording state with deterministi
117117 command : 'fill' ,
118118 positionals : [ 'id="token"' , token ] ,
119119 flags : { recordAs : 'API_TOKEN' } ,
120- result : { text : token , message : ` Filled ${ token } ` } ,
120+ result : { text : token , message : ' Filled 18 chars' } ,
121121 } ) ;
122122
123123 expect ( session . actions . map ( ( action ) => action . positionals . at ( - 1 ) ) ) . toEqual ( [
@@ -128,8 +128,62 @@ test('parameterized fills keep literals out of recording state with deterministi
128128 const serialized = JSON . stringify ( session . actions ) ;
129129 expect ( serialized ) . not . toContain ( password ) ;
130130 expect ( serialized ) . not . toContain ( token ) ;
131- expect ( serialized ) . toContain ( 'value=${PASSWORD}' ) ;
132- expect ( session . actions [ 0 ] ?. targetEvidence ?. label ) . toBe ( 'Current value ${PASSWORD}' ) ;
133- expect ( session . actions [ 0 ] ?. targetEvidence ?. ancestry [ 0 ] ?. label ) . toBe ( 'Credential ${PASSWORD}' ) ;
131+ expect ( session . actions [ 0 ] ?. result ?. text ) . toBe ( '${PASSWORD}' ) ;
132+ expect ( session . actions [ 0 ] ?. result ?. selector ) . toBe ( 'id="password"' ) ;
133+ expect ( session . actions [ 0 ] ?. targetEvidence ?. label ) . toBe ( '${PASSWORD}' ) ;
134+ expect ( session . actions [ 0 ] ?. targetEvidence ?. ancestry [ 0 ] ?. label ) . toBe ( 'Credentials' ) ;
134135 expect ( session . actions [ 0 ] ?. result ?. selectorChain ) . toEqual ( [ 'id="password"' ] ) ;
135136} ) ;
137+
138+ test ( 'a one-character parameterized fill preserves unrelated response and selector text' , ( ) => {
139+ const session = makeIosSession ( 'default' ) ;
140+ recordActionEntry ( session , {
141+ command : 'fill' ,
142+ positionals : [ 'id="password"' , 'a' ] ,
143+ flags : { recordAs : 'LETTER' } ,
144+ result : {
145+ text : 'a' ,
146+ message : 'Already safe' ,
147+ selector : 'id="password"' ,
148+ selectorChain : [ 'id="password"' , 'label="Account"' , 'value="a" editable=true' ] ,
149+ } ,
150+ targetEvidence : {
151+ role : 'textinput' ,
152+ label : 'Password' ,
153+ ancestry : [ { role : 'form' , label : 'Credentials area' } ] ,
154+ sibling : 0 ,
155+ viewportOrder : 0 ,
156+ verification : 'verified' ,
157+ } ,
158+ } ) ;
159+
160+ expect ( session . actions [ 0 ] ) . toMatchObject ( {
161+ positionals : [ 'id="password"' , '${LETTER}' ] ,
162+ result : {
163+ text : '${LETTER}' ,
164+ message : 'Already safe' ,
165+ selector : 'id="password"' ,
166+ selectorChain : [ 'id="password"' , 'label="Account"' ] ,
167+ } ,
168+ targetEvidence : {
169+ label : 'Password' ,
170+ ancestry : [ { role : 'form' , label : 'Credentials area' } ] ,
171+ } ,
172+ } ) ;
173+ } ) ;
174+
175+ test . each ( [ '' , ' ' ] ) (
176+ 'parameterized fills preserve the placeholder when the resolved value is %j' ,
177+ ( value ) => {
178+ const session = makeIosSession ( 'default' ) ;
179+ recordActionEntry ( session , {
180+ command : 'fill' ,
181+ positionals : [ 'id="password"' , value ] ,
182+ flags : { recordAs : 'PASSWORD' } ,
183+ result : { text : value } ,
184+ } ) ;
185+
186+ expect ( session . actions [ 0 ] ?. positionals ) . toEqual ( [ 'id="password"' , '${PASSWORD}' ] ) ;
187+ expect ( session . actions [ 0 ] ?. result ?. text ) . toBe ( '${PASSWORD}' ) ;
188+ } ,
189+ ) ;
0 commit comments