This commit is contained in:
Tommy D. Rossi
2025-12-19 19:23:06 +01:00
parent f97052f4f6
commit 660fb4c014
2 changed files with 6 additions and 10 deletions
+4 -10
View File
@@ -1741,8 +1741,8 @@ describe('MCP Server Tests', () => {
{
"text": "Return value:
{
"error": "Page not found",
"urls": []
"matchesDark": true,
"matchesLight": false
}",
"type": "text",
},
@@ -1968,20 +1968,14 @@ describe('CDP Session Tests', () => {
sampleFunctionNames: functionNames,
}).toMatchInlineSnapshot(`
{
"durationMicroseconds": 7536,
"durationMicroseconds": 7500,
"hasNodes": true,
"nodeCount": 20,
"nodeCount": 7,
"sampleFunctionNames": [
"(root)",
"(program)",
"(idle)",
"evaluate",
"fibonacci",
"fibonacci",
"fibonacci",
"fibonacci",
"fibonacci",
"fibonacci",
],
}
`)
+2
View File
@@ -51,9 +51,11 @@ IMPORTANT! never call bringToFront unless specifically asked by the user. It is
- only call `page.close()` if the user asks you so or if you previously created this page yourself with `newPage`. do not close user created pages unless asked
- try to never sleep or run `page.waitForTimeout` unless you have to. there are better ways to wait for an element
- use `page.waitForLoadState('load')` instead of `page.waitForEvent('load')`. `waitForEvent` waits for a future event and will timeout if the page is already loaded, while `waitForLoadState` resolves immediately if already in that state
- never close browser or context. NEVER call `browser.close()`
- NEVER use `page.context().newCDPSession()` or `browser.newCDPSession()` - these do not work through the playwriter relay. If you need to send raw CDP commands, use the `getCDPSession` utility function instead.
## always check the current page state after an action
after you click a button or submit a form you ALWAYS have to then check what is the current state of the page. you cannot assume what happened after doing an action. instead run the following code to know what happened after the action: