update test snapshots
This commit is contained in:
+99
-117
@@ -118,13 +118,9 @@ describe('MCP Server Tests', () => {
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"text": "Console output:
|
"text": "Console output:
|
||||||
[log] Page title: Example Domain
|
[log] 'Page title:' 'Example Domain'
|
||||||
|
|
||||||
Return value:
|
[return value] { url: 'https://example.com/', title: 'Example Domain' }",
|
||||||
{
|
|
||||||
"url": "https://example.com/",
|
|
||||||
"title": "Example Domain"
|
|
||||||
}",
|
|
||||||
"type": "text",
|
"type": "text",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -658,7 +654,7 @@ describe('MCP Server Tests', () => {
|
|||||||
console.log('After disconnect:', afterDisconnectOutput)
|
console.log('After disconnect:', afterDisconnectOutput)
|
||||||
// After disconnect, there are no pages - so we expect an error
|
// After disconnect, there are no pages - so we expect an error
|
||||||
expect((afterDisconnect as any).isError).toBe(true)
|
expect((afterDisconnect as any).isError).toBe(true)
|
||||||
expect(afterDisconnectOutput).toContain('No browser tabs have Playwriter enabled')
|
expect(afterDisconnectOutput).toContain('No Playwright pages are available')
|
||||||
|
|
||||||
// 4. Re-enable extension on the same page
|
// 4. Re-enable extension on the same page
|
||||||
console.log('Re-enabling extension...')
|
console.log('Re-enabling extension...')
|
||||||
@@ -1726,68 +1722,62 @@ describe('MCP Server Tests', () => {
|
|||||||
expect(stylesResult.isError).toBeFalsy()
|
expect(stylesResult.isError).toBeFalsy()
|
||||||
const stylesText = (stylesResult.content as any)[0]?.text || ''
|
const stylesText = (stylesResult.content as any)[0]?.text || ''
|
||||||
expect(stylesText).toMatchInlineSnapshot(`
|
expect(stylesText).toMatchInlineSnapshot(`
|
||||||
"Return value:
|
"[return value] {
|
||||||
{
|
element: 'button#main-btn.btn',
|
||||||
"element": "button#main-btn.btn",
|
inlineStyle: { 'font-weight': 'bold' },
|
||||||
"inlineStyle": {
|
rules: [
|
||||||
"font-weight": "bold"
|
|
||||||
},
|
|
||||||
"rules": [
|
|
||||||
{
|
{
|
||||||
"selector": ".btn",
|
selector: '.btn',
|
||||||
"source": null,
|
source: null,
|
||||||
"origin": "regular",
|
origin: 'regular',
|
||||||
"declarations": {
|
declarations: {
|
||||||
"padding": "8px 16px",
|
padding: '8px 16px',
|
||||||
"padding-top": "8px",
|
'padding-top': '8px',
|
||||||
"padding-right": "16px",
|
'padding-right': '16px',
|
||||||
"padding-bottom": "8px",
|
'padding-bottom': '8px',
|
||||||
"padding-left": "16px"
|
'padding-left': '16px'
|
||||||
},
|
},
|
||||||
"inheritedFrom": null
|
inheritedFrom: null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"selector": "#main-btn",
|
selector: '#main-btn',
|
||||||
"source": null,
|
source: null,
|
||||||
"origin": "regular",
|
origin: 'regular',
|
||||||
"declarations": {
|
declarations: {
|
||||||
"background-color": "blue",
|
'background-color': 'blue',
|
||||||
"color": "white",
|
color: 'white',
|
||||||
"border-radius": "4px",
|
'border-radius': '4px',
|
||||||
"border-top-left-radius": "4px",
|
'border-top-left-radius': '4px',
|
||||||
"border-top-right-radius": "4px",
|
'border-top-right-radius': '4px',
|
||||||
"border-bottom-right-radius": "4px",
|
'border-bottom-right-radius': '4px',
|
||||||
"border-bottom-left-radius": "4px"
|
'border-bottom-left-radius': '4px'
|
||||||
},
|
},
|
||||||
"inheritedFrom": null
|
inheritedFrom: null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"selector": ".container",
|
selector: '.container',
|
||||||
"source": null,
|
source: null,
|
||||||
"origin": "regular",
|
origin: 'regular',
|
||||||
"declarations": {
|
declarations: {
|
||||||
"padding": "20px",
|
padding: '20px',
|
||||||
"margin": "10px",
|
margin: '10px',
|
||||||
"padding-top": "20px",
|
'padding-top': '20px',
|
||||||
"padding-right": "20px",
|
'padding-right': '20px',
|
||||||
"padding-bottom": "20px",
|
'padding-bottom': '20px',
|
||||||
"padding-left": "20px",
|
'padding-left': '20px',
|
||||||
"margin-top": "10px",
|
'margin-top': '10px',
|
||||||
"margin-right": "10px",
|
'margin-right': '10px',
|
||||||
"margin-bottom": "10px",
|
'margin-bottom': '10px',
|
||||||
"margin-left": "10px"
|
'margin-left': '10px'
|
||||||
},
|
},
|
||||||
"inheritedFrom": "ancestor[1]"
|
inheritedFrom: 'ancestor[1]'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"selector": "body",
|
selector: 'body',
|
||||||
"source": null,
|
source: null,
|
||||||
"origin": "regular",
|
origin: 'regular',
|
||||||
"declarations": {
|
declarations: { 'font-family': 'Arial, sans-serif', color: 'rgb(51, 51, 51)' },
|
||||||
"font-family": "Arial, sans-serif",
|
inheritedFrom: 'ancestor[2]'
|
||||||
"color": "rgb(51, 51, 51)"
|
|
||||||
},
|
|
||||||
"inheritedFrom": "ancestor[2]"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}"
|
}"
|
||||||
@@ -1814,49 +1804,48 @@ describe('MCP Server Tests', () => {
|
|||||||
expect(formattedResult.isError).toBeFalsy()
|
expect(formattedResult.isError).toBeFalsy()
|
||||||
const formattedText = (formattedResult.content as any)[0]?.text || ''
|
const formattedText = (formattedResult.content as any)[0]?.text || ''
|
||||||
expect(formattedText).toMatchInlineSnapshot(`
|
expect(formattedText).toMatchInlineSnapshot(`
|
||||||
"Return value:
|
"[return value] 'Element: button#main-btn.btn\\n' +
|
||||||
Element: button#main-btn.btn
|
'\\n' +
|
||||||
|
'Inline styles:\\n' +
|
||||||
Inline styles:
|
' font-weight: bold\\n' +
|
||||||
font-weight: bold
|
'\\n' +
|
||||||
|
'Matched rules:\\n' +
|
||||||
Matched rules:
|
' .btn {\\n' +
|
||||||
.btn {
|
' padding: 8px 16px;\\n' +
|
||||||
padding: 8px 16px;
|
' padding-top: 8px;\\n' +
|
||||||
padding-top: 8px;
|
' padding-right: 16px;\\n' +
|
||||||
padding-right: 16px;
|
' padding-bottom: 8px;\\n' +
|
||||||
padding-bottom: 8px;
|
' padding-left: 16px;\\n' +
|
||||||
padding-left: 16px;
|
' }\\n' +
|
||||||
}
|
' #main-btn {\\n' +
|
||||||
#main-btn {
|
' background-color: blue;\\n' +
|
||||||
background-color: blue;
|
' color: white;\\n' +
|
||||||
color: white;
|
' border-radius: 4px;\\n' +
|
||||||
border-radius: 4px;
|
' border-top-left-radius: 4px;\\n' +
|
||||||
border-top-left-radius: 4px;
|
' border-top-right-radius: 4px;\\n' +
|
||||||
border-top-right-radius: 4px;
|
' border-bottom-right-radius: 4px;\\n' +
|
||||||
border-bottom-right-radius: 4px;
|
' border-bottom-left-radius: 4px;\\n' +
|
||||||
border-bottom-left-radius: 4px;
|
' }\\n' +
|
||||||
}
|
'\\n' +
|
||||||
|
'Inherited from ancestor[1]:\\n' +
|
||||||
Inherited from ancestor[1]:
|
' .container {\\n' +
|
||||||
.container {
|
' padding: 20px;\\n' +
|
||||||
padding: 20px;
|
' margin: 10px;\\n' +
|
||||||
margin: 10px;
|
' padding-top: 20px;\\n' +
|
||||||
padding-top: 20px;
|
' padding-right: 20px;\\n' +
|
||||||
padding-right: 20px;
|
' padding-bottom: 20px;\\n' +
|
||||||
padding-bottom: 20px;
|
' padding-left: 20px;\\n' +
|
||||||
padding-left: 20px;
|
' margin-top: 10px;\\n' +
|
||||||
margin-top: 10px;
|
' margin-right: 10px;\\n' +
|
||||||
margin-right: 10px;
|
' margin-bottom: 10px;\\n' +
|
||||||
margin-bottom: 10px;
|
' margin-left: 10px;\\n' +
|
||||||
margin-left: 10px;
|
' }\\n' +
|
||||||
}
|
'\\n' +
|
||||||
|
'Inherited from ancestor[2]:\\n' +
|
||||||
Inherited from ancestor[2]:
|
' body {\\n' +
|
||||||
body {
|
' font-family: Arial, sans-serif;\\n' +
|
||||||
font-family: Arial, sans-serif;
|
' color: rgb(51, 51, 51);\\n' +
|
||||||
color: rgb(51, 51, 51);
|
' }\\n'"
|
||||||
}"
|
|
||||||
`)
|
`)
|
||||||
|
|
||||||
await page.close()
|
await page.close()
|
||||||
@@ -2066,11 +2055,7 @@ describe('MCP Server Tests', () => {
|
|||||||
expect(result.content).toMatchInlineSnapshot(`
|
expect(result.content).toMatchInlineSnapshot(`
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"text": "Return value:
|
"text": "[return value] { matchesDark: false, matchesLight: true }",
|
||||||
{
|
|
||||||
\"matchesDark\": false,
|
|
||||||
\"matchesLight\": true
|
|
||||||
}",
|
|
||||||
"type": "text",
|
"type": "text",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -2450,13 +2435,12 @@ describe('MCP Server Tests', () => {
|
|||||||
|
|
||||||
// Inline snapshot of cleaned HTML
|
// Inline snapshot of cleaned HTML
|
||||||
expect(text).toMatchInlineSnapshot(`
|
expect(text).toMatchInlineSnapshot(`
|
||||||
"Return value:
|
"[return value] '<div data-testid="main">\\n' +
|
||||||
<div data-testid="main">
|
' <h1>Hello World</h1>\\n' +
|
||||||
<h1>Hello World</h1>
|
' <button aria-label="Click me">Submit</button>\\n' +
|
||||||
<button aria-label="Click me">Submit</button>
|
' <a href="/about" title="About page">About</a>\\n' +
|
||||||
<a href="/about" title="About page">About</a>
|
' <input type="text" placeholder="Enter name">\\n' +
|
||||||
<input type="text" placeholder="Enter name">
|
'</div>\\n'"
|
||||||
</div>"
|
|
||||||
`)
|
`)
|
||||||
|
|
||||||
// Should NOT contain script/style tags (they're removed)
|
// Should NOT contain script/style tags (they're removed)
|
||||||
@@ -3800,10 +3784,8 @@ describe('Auto-enable Tests', () => {
|
|||||||
let client: Awaited<ReturnType<typeof createMCPClient>>['client']
|
let client: Awaited<ReturnType<typeof createMCPClient>>['client']
|
||||||
let cleanup: (() => Promise<void>) | null = null
|
let cleanup: (() => Promise<void>) | null = null
|
||||||
|
|
||||||
// Set env var before any setup runs
|
|
||||||
process.env.PLAYWRITER_AUTO_ENABLE = '1'
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
process.env.PLAYWRITER_AUTO_ENABLE = '1'
|
||||||
testCtx = await setupTestContext({ port: TEST_PORT, tempDirPrefix: 'pw-auto-test-' })
|
testCtx = await setupTestContext({ port: TEST_PORT, tempDirPrefix: 'pw-auto-test-' })
|
||||||
|
|
||||||
const result = await createMCPClient({ port: TEST_PORT })
|
const result = await createMCPClient({ port: TEST_PORT })
|
||||||
|
|||||||
Reference in New Issue
Block a user