@@ -9,6 +9,7 @@ import {afterEach, before, beforeEach, describe, it} from 'node:test';
99
1010import { setIssuesEnabled } from '../../src/features.js' ;
1111import { loadIssueDescriptions } from '../../src/issue-descriptions.js' ;
12+ import { McpResponse } from '../../src/McpResponse.js' ;
1213import {
1314 getConsoleMessage ,
1415 listConsoleMessages ,
@@ -129,12 +130,6 @@ describe('console', () => {
129130 } ) ;
130131
131132 describe ( 'get_console_message' , ( ) => {
132- beforeEach ( ( ) => {
133- setIssuesEnabled ( true ) ;
134- } ) ;
135- afterEach ( ( ) => {
136- setIssuesEnabled ( false ) ;
137- } ) ;
138133 it ( 'gets a specific console message' , async ( ) => {
139134 await withBrowser ( async ( response , context ) => {
140135 const page = await context . newPage ( ) ;
@@ -165,7 +160,7 @@ describe('console', () => {
165160 setIssuesEnabled ( false ) ;
166161 } ) ;
167162
168- it ( 'lists issues ' , async ( ) => {
163+ it ( 'gets issue details ' , async ( ) => {
169164 await withBrowser ( async ( response , context ) => {
170165 const page = await context . newPage ( ) ;
171166 const issuePromise = new Promise < void > ( resolve => {
@@ -176,18 +171,23 @@ describe('console', () => {
176171 await page . setContent ( '<input type="text" name="username" />' ) ;
177172 await issuePromise ;
178173 await listConsoleMessages . handler ( { params : { } } , response , context ) ;
174+ const response2 = new McpResponse ( ) ;
179175 await getConsoleMessage . handler (
180176 { params : { msgid : 1 } } ,
181- response ,
177+ response2 ,
182178 context ,
183179 ) ;
184- const formattedResponse = await response . handle ( 'test' , context ) ;
180+ const formattedResponse = await response2 . handle ( 'test' , context ) ;
185181 const textContent = formattedResponse [ 0 ] as { text : string } ;
186- assert . ok (
187- textContent . text . includes (
188- "Message: issue> An element doesn't have an autocomplete attribute" ,
189- ) ,
190- ) ;
182+ const learnMoreLinks =
183+ '[HTML attribute: autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values)' ;
184+ const detailsDescription =
185+ "A form field has an `id` or `name` attribute that the browser's autofill recognizes. However, it doesn't have an `autocomplete` attribute assigned. This might prevent the browser from correctly autofilling the form.\n\nTo fix this issue, provide an `autocomplete` attribute." ;
186+ const title =
187+ "Message: issue> An element doesn't have an autocomplete attribute" ;
188+ assert . ok ( textContent . text . includes ( title ) ) ;
189+ assert . ok ( textContent . text . includes ( detailsDescription ) ) ;
190+ assert . ok ( textContent . text . includes ( learnMoreLinks ) ) ;
191191 } ) ;
192192 } ) ;
193193 } ) ;
0 commit comments