Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: fix expectURL caches (#38814)

Simon Knottc84fe94f7c84
diff --git a/tests/library/__llm_cache__/library-agent-expect-expectURL-success.json b/tests/library/__llm_cache__/library-agent-expect-expectURL-success.json
index 0848d8a56b..3e6873ad25 100644
--- a/tests/library/__llm_cache__/library-agent-expect-expectURL-success.json
+++ b/tests/library/__llm_cache__/library-agent-expect-expectURL-success.json
@@ -1,11 +1,38 @@
{
+ "218b122dd19ab410fa8e1982e7330a92175a3f4a": {
+ "result": {
+ "role": "assistant",
+ "content": [
+ {
+ "type": "text",
+ "text": "I see the issue - the page URL is the full URL `http://localhost:8907/page.html`, not just the path. Let me adjust the assertion to use a regex pattern that will match the path portion:"
+ },
+ {
+ "type": "tool_call",
+ "name": "browser_expect_url",
+ "arguments": {
+ "regex": "/page\\.html$/",
+ "_is_done": true
+ },
+ "id": "toolu_01C6XynJnfEwtCQLmMJinLxi"
+ }
+ ],
+ "stopReason": {
+ "code": "ok"
+ }
+ },
+ "usage": {
+ "input": 2165,
+ "output": 125
+ }
+ },
"3393f1e7925b53d87c1ebcdc7411dc04bfc11aec": {
"result": {
"role": "assistant",
"content": [
{
"type": "text",
- "text": "I need to verify that the page URL is `/page.html`. I'll use the `browser_expect_url` tool to assert this condition."
+ "text": "I need to verify that the page URL is `/page.html`. Let me check this using the browser_expect_url tool."
},
{
"type": "tool_call",
@@ -14,7 +41,7 @@
"url": "/page.html",
"_is_done": true
},
- "id": "toolu_0131XYp1i3XJgJsb6xHePBUV"
+ "id": "toolu_0126LdEZe32PoAJfJwrSG8PT"
}
],
"stopReason": {
@@ -23,7 +50,34 @@
},
"usage": {
"input": 1930,
- "output": 109
+ "output": 105
+ }
+ },
+ "421d60b4ee07460745af9a285bf151c2690ba498": {
+ "result": {
+ "role": "assistant",
+ "content": [
+ {
+ "type": "text",
+ "text": "I see the issue - the actual URL is the full URL `http://localhost:8955/page.html`, not just the path `/page.html`. Let me use a regex pattern to match the URL that ends with `/page.html`:"
+ },
+ {
+ "type": "tool_call",
+ "name": "browser_expect_url",
+ "arguments": {
+ "regex": "/page\\.html$/",
+ "_is_done": true
+ },
+ "id": "toolu_01PVEVCMMAbyRbV8ryw4Vq21"
+ }
+ ],
+ "stopReason": {
+ "code": "ok"
+ }
+ },
+ "usage": {
+ "input": 2169,
+ "output": 130
}
},
"4c51af7388a0114714b58e25495f23f5fb9306b8": {
diff --git a/tests/library/__llm_cache__/library-agent-expect-expectURL-with-regex-error.json b/tests/library/__llm_cache__/library-agent-expect-expectURL-with-regex-error.json
index 22a9c6e04f..b61bc53b1d 100644
--- a/tests/library/__llm_cache__/library-agent-expect-expectURL-with-regex-error.json
+++ b/tests/library/__llm_cache__/library-agent-expect-expectURL-with-regex-error.json
@@ -125,5 +125,32 @@
"input": 2165,
"output": 114
}
+ },
+ "ce3f938674ba0ecfceaf13ee135fda66576c596c": {
+ "result": {
+ "role": "assistant",
+ "content": [
+ {
+ "type": "text",
+ "text": "I see the URL is \"http://localhost:8907/other.html\". Let me adjust the regex pattern to match URLs containing \"other\" more appropriately:"
+ },
+ {
+ "type": "tool_call",
+ "name": "browser_expect_url",
+ "arguments": {
+ "regex": "/other/",
+ "_is_done": true
+ },
+ "id": "toolu_01QmJpJPqx7PV9iDBD3FBYcb"
+ }
+ ],
+ "stopReason": {
+ "code": "ok"
+ }
+ },
+ "usage": {
+ "input": 2165,
+ "output": 111
+ }
}
}
\ No newline at end of file
diff --git a/tests/library/__llm_cache__/library-agent-expect-expectURL-with-regex.json b/tests/library/__llm_cache__/library-agent-expect-expectURL-with-regex.json
index b3b2d7ac08..26cef04cbf 100644
--- a/tests/library/__llm_cache__/library-agent-expect-expectURL-with-regex.json
+++ b/tests/library/__llm_cache__/library-agent-expect-expectURL-with-regex.json
@@ -1,4 +1,31 @@
{
+ "33442824e378e1a876db44e19303faf430e8d492": {
+ "result": {
+ "role": "assistant",
+ "content": [
+ {
+ "type": "text",
+ "text": "I need to fix the regex format - it needs to be a complete regex pattern with closing slash and optional flags."
+ },
+ {
+ "type": "tool_call",
+ "name": "browser_expect_url",
+ "arguments": {
+ "regex": "/page/",
+ "_is_done": true
+ },
+ "id": "toolu_01UKuRAcqrarenSYTfGLJrc9"
+ }
+ ],
+ "stopReason": {
+ "code": "ok"
+ }
+ },
+ "usage": {
+ "input": 2113,
+ "output": 100
+ }
+ },
"c67b3d627e92564582281fd7713d0f3de70a3a44": {
"result": {
"role": "assistant",
@@ -32,7 +59,7 @@
"content": [
{
"type": "text",
- "text": "I need to verify that the page URL matches the pattern \"/page\". I'll use the `browser_expect_url` tool with a regex pattern to check this."
+ "text": "I need to verify that the page URL matches the pattern `/page`. I'll use the `browser_expect_url` tool with a regex pattern."
},
{
"type": "tool_call",
@@ -41,7 +68,7 @@
"regex": "/page",
"_is_done": true
},
- "id": "toolu_01CSnFjEnGm46uxyxLfUdQoT"
+ "id": "toolu_017sobJzrZUJ9pxgJ7hSuv5u"
}
],
"stopReason": {
@@ -50,7 +77,7 @@
},
"usage": {
"input": 1929,
- "output": 110
+ "output": 107
}
}
}
\ No newline at end of file
diff --git a/tests/library/__llm_cache__/library-agent-expect-expectURL-wrong-URL-error.json b/tests/library/__llm_cache__/library-agent-expect-expectURL-wrong-URL-error.json
index ce0f2c2aa7..6c456d8b74 100644
--- a/tests/library/__llm_cache__/library-agent-expect-expectURL-wrong-URL-error.json
+++ b/tests/library/__llm_cache__/library-agent-expect-expectURL-wrong-URL-error.json
@@ -14,7 +14,7 @@
"url": "/other.html",
"_is_done": true
},
- "id": "toolu_01SEru6Vuneyu58u6yQ6faKy"
+ "id": "toolu_01G9ZzdYXENshXQ8jShDmvJy"
}
],
"stopReason": {
@@ -26,6 +26,33 @@
"output": 109
}
},
+ "6aacb908b26146c99406cec686aaf78e2398d3c8": {
+ "result": {
+ "role": "assistant",
+ "content": [
+ {
+ "type": "text",
+ "text": "I see the issue - the actual URL is the full URL `http://localhost:8959/other.html`, not just the relative path. Let me adjust the assertion to match the actual URL pattern using a regex that checks if the URL ends with `/other.html`:"
+ },
+ {
+ "type": "tool_call",
+ "name": "browser_expect_url",
+ "arguments": {
+ "regex": "/\\/other\\.html$/",
+ "_is_done": true
+ },
+ "id": "toolu_011zZt5A2gYEv1VwEAmjNTLm"
+ }
+ ],
+ "stopReason": {
+ "code": "ok"
+ }
+ },
+ "usage": {
+ "input": 2169,
+ "output": 136
+ }
+ },
"bae6a40c194c52f6df380d43bae1648192ad1f8a": {
"result": {
"role": "assistant",
@@ -52,5 +79,32 @@
"input": 2169,
"output": 126
}
+ },
+ "f3512ecc7b43a5238007d361e22f0c67faf72cbf": {
+ "result": {
+ "role": "assistant",
+ "content": [
+ {
+ "type": "text",
+ "text": "I see the issue - the actual URL is the full URL `http://localhost:8911/other.html` while I was checking for just `/other.html`. Let me use a regex pattern to match URLs ending with `/other.html`:"
+ },
+ {
+ "type": "tool_call",
+ "name": "browser_expect_url",
+ "arguments": {
+ "regex": "/\\/other\\.html$/",
+ "_is_done": true
+ },
+ "id": "toolu_01GULjRje8iHqa5c37r9dtTW"
+ }
+ ],
+ "stopReason": {
+ "code": "ok"
+ }
+ },
+ "usage": {
+ "input": 2169,
+ "output": 131
+ }
}
}
\ No newline at end of file