@@ -41,7 +41,7 @@ describe('console', () => {
4141 } ) ;
4242 } ) ;
4343
44- it ( 'lists issues messages ' , async ( ) => {
44+ it ( 'lists issues' , async ( ) => {
4545 await withBrowser ( async ( response , context ) => {
4646 const page = await context . newPage ( ) ;
4747 const issuePromise = new Promise < void > ( resolve => {
@@ -63,6 +63,43 @@ describe('console', () => {
6363 } ) ;
6464 } ) ;
6565
66+ it ( 'lists issues after a page reload' , async ( ) => {
67+ await withBrowser ( async ( response , context ) => {
68+ const page = await context . newPage ( ) ;
69+ const issuePromise = new Promise < void > ( resolve => {
70+ page . on ( 'issue' , ( ) => {
71+ resolve ( ) ;
72+ } ) ;
73+ } ) ;
74+
75+ await page . setContent ( '<input type="text" name="username" />' ) ;
76+ await issuePromise ;
77+ await listConsoleMessages . handler ( { params : { } } , response , context ) ;
78+ {
79+ const formattedResponse = await response . handle ( 'test' , context ) ;
80+ const textContent = formattedResponse [ 0 ] as { text : string } ;
81+ assert . ok (
82+ textContent . text . includes (
83+ `msgid=1 [issue] An element doesn't have an autocomplete attribute (count: 1)` ,
84+ ) ,
85+ ) ;
86+ }
87+
88+ await page . reload ( ) ;
89+ await page . setContent ( '<input type="text" name="username" />' ) ;
90+
91+ {
92+ const formattedResponse = await response . handle ( 'test' , context ) ;
93+ const textContent = formattedResponse [ 0 ] as { text : string } ;
94+ assert . ok (
95+ textContent . text . includes (
96+ `msgid=2 [issue] An element doesn't have an autocomplete attribute (count: 1)` ,
97+ ) ,
98+ ) ;
99+ }
100+ } ) ;
101+ } ) ;
102+
66103 it ( 'work with primitive unhandled errors' , async ( ) => {
67104 await withBrowser ( async ( response , context ) => {
68105 const page = await context . newPage ( ) ;
0 commit comments