From 2ba3a6d53f928f8555d13de0d6da9642756f18e5 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sun, 10 Jul 2022 20:05:48 +0200 Subject: [PATCH] Test improvement: Extract text should return all matches --- changedetectionio/tests/test_extract_regex.py | 9 ++++++--- x | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 x diff --git a/changedetectionio/tests/test_extract_regex.py b/changedetectionio/tests/test_extract_regex.py index e59a22b6..d51200d3 100644 --- a/changedetectionio/tests/test_extract_regex.py +++ b/changedetectionio/tests/test_extract_regex.py @@ -33,7 +33,7 @@ def set_modified_response():
So let's see what happens.
Some text thats the same
-
Some text that did change ( 1000 online
80 guests)
+
Some text that did change ( 1000 online
80 guests
2000 online )
""" @@ -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 assert b'
1000 online' in res.data - + + # All regex matching should be here + assert b'
2000 online' in res.data + # Both regexs should be here assert b'
80 guests' in res.data # Should not be here - assert b'Some text that did change' not in res.data \ No newline at end of file + assert b'Some text that did change' not in res.data diff --git a/x b/x new file mode 100644 index 00000000..0219e789 --- /dev/null +++ b/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.