feat: url текущей страницы в ответе задачи (#116)
SPA меняет адрес без навигации (страница созданной заявки и т.п.): ответ v1/v2 отдаёт page.url после действий, клиент 0.2.1 - Result.url. Документация и unit-тесты. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
95b5057d9f
commit
f21483489a
9 files changed
+14
-2
No files matched your search
@@ -21,6 +21,8 @@ class FakeContext:
|
||||
|
||||
|
||||
class FakePage:
|
||||
url = "https://example.com/after-actions"
|
||||
|
||||
def __init__(self, context):
|
||||
self.context = context
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ def test_run(rx, monkeypatch):
|
||||
result = rx.run("https://example.com", [Action.inner_text("h1")], html=True)
|
||||
assert result.ok and result.results == ["Example"]
|
||||
assert result.html == "<body>page</body>" and result.user_agent == "UA/engine"
|
||||
assert result.url == "https://example.com/after-actions"
|
||||
assert result.cookie("cf_clearance") == "secret-cookie"
|
||||
assert result.session_id
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ def test_ok(env, monkeypatch):
|
||||
assert data["status"] == "ok"
|
||||
assert "code" not in data and "error" not in data
|
||||
assert data["user_agent"] == "UA/engine"
|
||||
assert data["url"] == "https://example.com/after-actions"
|
||||
assert data["actions"] == [{"type": "wait_for", "ok": True, "duration_ms": 5}]
|
||||
assert data["html"] == "<body>page</body>"
|
||||
assert data["screenshot"] == "cG5n" # base64(b"png")
|
||||
|
||||
Reference in new issue
Block a user