Test improvement: Extract text should return all matches

pull/748/head
dgtlmoon 2 years ago
parent 2f636553a9
commit 2ba3a6d53f

@ -33,7 +33,7 @@ def set_modified_response():
</br> </br>
So let's see what happens. </br> So let's see what happens. </br>
<div id="sametext">Some text thats the same</div> <div id="sametext">Some text thats the same</div>
<div id="changetext">Some text that did change ( 1000 online <br/> 80 guests)</div> <div id="changetext">Some text that did change ( 1000 online <br/> 80 guests<br/> 2000 online )</div>
</body> </body>
</html> </html>
""" """
@ -119,9 +119,12 @@ def test_check_filter_and_regex_extract(client, live_server):
# Class will be blank for now because the frontend didnt apply the diff # Class will be blank for now because the frontend didnt apply the diff
assert b'<div class="">1000 online' in res.data assert b'<div class="">1000 online' in res.data
# All regex matching should be here
assert b'<div class="">2000 online' in res.data
# Both regexs should be here # Both regexs should be here
assert b'<div class="">80 guests' in res.data assert b'<div class="">80 guests' in res.data
# Should not be here # Should not be here
assert b'Some text that did change' not in res.data assert b'Some text that did change' not in res.data

16
x

@ -0,0 +1,16 @@
diff --git a/changedetectionio/content_fetcher.py b/changedetectionio/content_fetcher.py
index 331ef959..ca43edc8 100644
--- a/changedetectionio/content_fetcher.py
+++ b/changedetectionio/content_fetcher.py
@@ -309,7 +309,10 @@ class base_html_playwright(Fetcher):
page.set_default_navigation_timeout(90000)
page.set_default_timeout(90000)
- # Bug - never set viewport size BEFORE page.goto
+ # Listen for all console events and handle errors
+ page.on("console", lambda msg: print(f"Playwright console: Watch URL: {url} {msg.type}: {msg.text} {msg.args}"))
+
+ # Bug - never set viewport size BEFORE page.goto
# Waits for the next navigation. Using Python context manager
# prevents a race condition between clicking and waiting for a navigation.
Loading…
Cancel
Save