2024-07-25 12:39:01 +00:00
|
|
|
#!/usr/bin/env python3
|
2022-05-23 21:44:51 +00:00
|
|
|
|
|
|
|
import time
|
|
|
|
from flask import url_for
|
2022-08-17 11:21:06 +00:00
|
|
|
from ..util import live_server_setup, wait_for_all_checks
|
2022-05-23 21:44:51 +00:00
|
|
|
import logging
|
|
|
|
|
2022-11-24 19:53:01 +00:00
|
|
|
# Requires playwright to be installed
|
2024-07-11 13:03:42 +00:00
|
|
|
def test_fetch_webdriver_content(client, live_server, measure_memory_usage):
|
2022-05-23 21:44:51 +00:00
|
|
|
live_server_setup(live_server)
|
|
|
|
|
|
|
|
#####################
|
|
|
|
res = client.post(
|
2025-03-18 09:40:22 +00:00
|
|
|
url_for("settings.settings_page"),
|
2022-05-23 21:44:51 +00:00
|
|
|
data={"application-empty_pages_are_a_change": "",
|
|
|
|
"requests-time_between_check-minutes": 180,
|
|
|
|
'application-fetch_backend': "html_webdriver"},
|
|
|
|
follow_redirects=True
|
|
|
|
)
|
|
|
|
|
|
|
|
assert b"Settings updated." in res.data
|
|
|
|
|
|
|
|
# Add our URL to the import page
|
|
|
|
res = client.post(
|
2025-03-18 09:40:22 +00:00
|
|
|
url_for("imports.import_page"),
|
2022-05-23 21:44:51 +00:00
|
|
|
data={"urls": "https://changedetection.io/ci-test.html"},
|
|
|
|
follow_redirects=True
|
|
|
|
)
|
|
|
|
|
|
|
|
assert b"1 Imported" in res.data
|
2022-08-17 11:21:06 +00:00
|
|
|
wait_for_all_checks(client)
|
2022-05-23 21:44:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
res = client.get(
|
2025-03-18 09:40:22 +00:00
|
|
|
url_for("ui.ui_views.preview_page", uuid="first"),
|
2022-05-23 21:44:51 +00:00
|
|
|
follow_redirects=True
|
|
|
|
)
|
|
|
|
logging.getLogger().info("Looking for correct fetched HTML (text) from server")
|
|
|
|
|
2024-01-16 08:48:16 +00:00
|
|
|
assert b'cool it works' in res.data
|