@@ -30,30 +30,33 @@ test("wizard accepts custom free text answers and shows them in the summary", as
3030 await expect ( customInput ) . toBeVisible ( )
3131 await customInput . fill ( customAnswer )
3232
33- const confirmationMessage = page . locator ( 'p' , { hasText : "We'll use" } ) . first ( )
33+ await expect ( questionHeading ) . toHaveText ( "What build tooling do you use?" )
34+
35+ const confirmationMessage = page . getByTestId ( "custom-answer-confirmation" )
3436 await expect ( confirmationMessage ) . toBeVisible ( )
3537 await expect ( confirmationMessage ) . toContainText ( customAnswer )
3638 await expect ( confirmationMessage ) . toContainText (
3739 "for this question when we generate your context file."
3840 )
3941
40- await page . waitForFunction (
41- ( { questionId, expected } ) => {
42- const raw = window . localStorage . getItem ( "devcontext:wizard:react" )
43- if ( ! raw ) {
44- return false
45- }
42+ await expect . poll (
43+ ( ) =>
44+ page . evaluate ( ( { questionId } ) => {
45+ const raw = window . localStorage . getItem ( "devcontext:wizard:react" )
46+ if ( ! raw ) {
47+ return null
48+ }
4649
47- try {
48- const state = JSON . parse ( raw )
49- return state . freeTextResponses ?. [ questionId ] === expected
50- } catch ( error ) {
51- console . warn ( "Unable to parse wizard state" , error )
52- return false
53- }
54- } ,
55- { questionId : "react-fileStructure" , expected : customAnswer }
56- )
50+ try {
51+ const state = JSON . parse ( raw )
52+ return state . freeTextResponses ?. [ questionId ] ?? null
53+ } catch ( error ) {
54+ console . warn ( "Unable to parse wizard state" , error )
55+ return "PARSE_ERROR"
56+ }
57+ } , { questionId : "react-fileStructure" } ) ,
58+ { timeout : 15000 }
59+ ) . toBe ( customAnswer )
5760
5861 const storedState = await page . evaluate ( ( ) => {
5962 const raw = window . localStorage . getItem ( "devcontext:wizard:react" )
0 commit comments