Update mcp.test.ts
This commit is contained in:
@@ -1885,7 +1885,7 @@ describe('MCP Server Tests', () => {
|
|||||||
console.log('Stagehand initialized')
|
console.log('Stagehand initialized')
|
||||||
|
|
||||||
const context = stagehand.context
|
const context = stagehand.context
|
||||||
console.log('Stagehand context:', context)
|
// console.log('Stagehand context:', context)
|
||||||
expect(context).toBeDefined()
|
expect(context).toBeDefined()
|
||||||
|
|
||||||
const pages = context.pages()
|
const pages = context.pages()
|
||||||
@@ -1970,7 +1970,7 @@ describe('CDP Session Tests', () => {
|
|||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
testCtx = await setupTestContext({ tempDirPrefix: 'pw-cdp-test-' })
|
testCtx = await setupTestContext({ tempDirPrefix: 'pw-cdp-test-' })
|
||||||
|
|
||||||
const serviceWorker = await getExtensionServiceWorker(testCtx.browserContext)
|
const serviceWorker = await getExtensionServiceWorker(testCtx.browserContext)
|
||||||
await serviceWorker.evaluate(async () => {
|
await serviceWorker.evaluate(async () => {
|
||||||
await globalThis.disconnectEverything()
|
await globalThis.disconnectEverything()
|
||||||
@@ -2327,10 +2327,10 @@ describe('CDP Session Tests', () => {
|
|||||||
|
|
||||||
const afterNavTargets = await cdpSession.send('Target.getTargets')
|
const afterNavTargets = await cdpSession.send('Target.getTargets')
|
||||||
const allPageTargets = afterNavTargets.targetInfos.filter(t => t.type === 'page')
|
const allPageTargets = afterNavTargets.targetInfos.filter(t => t.type === 'page')
|
||||||
|
|
||||||
const aboutBlankTargets = allPageTargets.filter(t => t.url === 'about:blank')
|
const aboutBlankTargets = allPageTargets.filter(t => t.url === 'about:blank')
|
||||||
expect(aboutBlankTargets).toHaveLength(0)
|
expect(aboutBlankTargets).toHaveLength(0)
|
||||||
|
|
||||||
const exampleComTargets = allPageTargets.filter(t => t.url.includes('example.com'))
|
const exampleComTargets = allPageTargets.filter(t => t.url.includes('example.com'))
|
||||||
expect(exampleComTargets).toHaveLength(0)
|
expect(exampleComTargets).toHaveLength(0)
|
||||||
|
|
||||||
@@ -2371,10 +2371,10 @@ describe('CDP Session Tests', () => {
|
|||||||
|
|
||||||
const { targetInfos } = await cdpSession.send('Target.getTargets')
|
const { targetInfos } = await cdpSession.send('Target.getTargets')
|
||||||
const allPageTargets = targetInfos.filter(t => t.type === 'page')
|
const allPageTargets = targetInfos.filter(t => t.type === 'page')
|
||||||
|
|
||||||
const aboutBlankTargets = allPageTargets.filter(t => t.url === 'about:blank')
|
const aboutBlankTargets = allPageTargets.filter(t => t.url === 'about:blank')
|
||||||
expect(aboutBlankTargets).toHaveLength(0)
|
expect(aboutBlankTargets).toHaveLength(0)
|
||||||
|
|
||||||
const pageTargets = allPageTargets
|
const pageTargets = allPageTargets
|
||||||
.map(t => ({ type: t.type, url: t.url }))
|
.map(t => ({ type: t.type, url: t.url }))
|
||||||
.sort((a, b) => a.url.localeCompare(b.url))
|
.sort((a, b) => a.url.localeCompare(b.url))
|
||||||
|
|||||||
Reference in New Issue
Block a user