Skip to content

Commit 5ac20ef

Browse files
committed
Simplify test cases, so that they pass on all browsers
1 parent d68cacf commit 5ac20ef

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

tests/async/test_asyncio.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,5 @@ async def test_should_return_proper_api_name_on_error(page: Page) -> None:
9797
False
9898
), "Accessing undefined JavaScript variable should have thrown exception"
9999
except Exception as error:
100-
assert (
101-
str(error)
102-
== """Page.evaluate: ReferenceError: does_not_exist is not defined
103-
at eval (eval at evaluate (:234:30), <anonymous>:1:1)
104-
at eval (<anonymous>)
105-
at UtilityScript.evaluate (<anonymous>:234:30)
106-
at UtilityScript.<anonymous> (<anonymous>:1:44)"""
107-
)
100+
# Each browser returns slightly different error messages, but they should all start with "Page.evaluate:", because that was the Playwright method where the error originated
101+
assert str(error).startswith("Page.evaluate:")

tests/sync/test_sync.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,5 @@ def test_should_return_proper_api_name_on_error(page: Page) -> None:
356356
False
357357
), "Accessing undefined JavaScript variable should have thrown exception"
358358
except Exception as error:
359-
assert (
360-
str(error)
361-
== """Page.evaluate: ReferenceError: does_not_exist is not defined
362-
at eval (eval at evaluate (:234:30), <anonymous>:1:1)
363-
at eval (<anonymous>)
364-
at UtilityScript.evaluate (<anonymous>:234:30)
365-
at UtilityScript.<anonymous> (<anonymous>:1:44)"""
366-
)
359+
# Each browser returns slightly different error messages, but they should all start with "Page.evaluate:", because that was the Playwright method where the error originated
360+
assert str(error).startswith("Page.evaluate:")

0 commit comments

Comments
 (0)