@@ -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,48 @@ 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 . once ( '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+ const anotherIssuePromise = new Promise < void > ( resolve => {
89+ page . once ( 'issue' , ( ) => {
90+ resolve ( ) ;
91+ } ) ;
92+ } ) ;
93+ await page . reload ( ) ;
94+ await page . setContent ( '<input type="text" name="username" />' ) ;
95+ await anotherIssuePromise ;
96+ {
97+ const formattedResponse = await response . handle ( 'test' , context ) ;
98+ const textContent = formattedResponse [ 0 ] as { text : string } ;
99+ assert . ok (
100+ textContent . text . includes (
101+ `msgid=2 [issue] An element doesn't have an autocomplete attribute (count: 1)` ,
102+ ) ,
103+ ) ;
104+ }
105+ } ) ;
106+ } ) ;
107+
66108 it ( 'work with primitive unhandled errors' , async ( ) => {
67109 await withBrowser ( async ( response , context ) => {
68110 const page = await context . newPage ( ) ;
0 commit comments