diff --git a/.github/workflows/test-only.yml b/.github/workflows/test-only.yml index 4ed3499d..3064e97d 100644 --- a/.github/workflows/test-only.yml +++ b/.github/workflows/test-only.yml @@ -30,7 +30,7 @@ jobs: # Selenium+browserless docker run --network changedet-network -d --hostname selenium -p 4444:4444 --rm --shm-size="2g" selenium/standalone-chrome:4 - docker run --network changedet-network -d --hostname browserless -e "FUNCTION_BUILT_INS=[\"fs\",\"crypto\"]" -e "DEFAULT_LAUNCH_ARGS=[\"--window-size=1920,1080\"]" --rm -p 3000:3000 --shm-size="2g" browserless/chrome:1.60-chrome-stable + docker run --network changedet-network -d --name browserless --hostname browserless -e "FUNCTION_BUILT_INS=[\"fs\",\"crypto\"]" -e "DEFAULT_LAUNCH_ARGS=[\"--window-size=1920,1080\"]" --rm -p 3000:3000 --shm-size="2g" browserless/chrome:1.60-chrome-stable # For accessing custom browser tests docker run --network changedet-network -d --name browserless-custom-url --hostname browserless-custom-url -e "FUNCTION_BUILT_INS=[\"fs\",\"crypto\"]" -e "DEFAULT_LAUNCH_ARGS=[\"--window-size=1920,1080\"]" --rm --shm-size="2g" browserless/chrome:1.60-chrome-stable diff --git a/changedetectionio/run_custom_browser_url_tests.sh b/changedetectionio/run_custom_browser_url_tests.sh index 1447c72c..c9c49b5f 100755 --- a/changedetectionio/run_custom_browser_url_tests.sh +++ b/changedetectionio/run_custom_browser_url_tests.sh @@ -1,10 +1,44 @@ #!/bin/bash -# exit when any command fails -set -e +# run some tests and look if the 'custom-browser-search-string=1' connect string appeared in the correct containers + # enable debug set -x +# A extra browser is configured, but we never chose to use it, so it should NOT show in the logs +docker run --rm -e "PLAYWRIGHT_DRIVER_URL=ws://browserless:3000" --network changedet-network test-changedetectionio bash -c 'cd changedetectionio;pytest tests/custom_browser_url/test_custom_browser_url.py::test_request_not_via_custom_browser_url' +docker logs browserless-custom-url &>log.txt +grep 'custom-browser-search-string=1' log.txt +if [ $? -ne 0 ] +then + echo "saw a request in 'browserless-custom-url' container with 'custom-browser-search-string=1' when I should not" + exit 1 +fi + +docker logs browserless &>log.txt +grep 'custom-browser-search-string=1' log.txt +if [ $? -ne 0 ] +then + echo "saw a request in 'browser' container with 'custom-browser-search-string=1' when I should not" + exit 1 +fi + +# Special connect string should appear in the custom-url container, but not in the 'default' one docker run --rm -e "PLAYWRIGHT_DRIVER_URL=ws://browserless:3000" --network changedet-network test-changedetectionio bash -c 'cd changedetectionio;pytest tests/custom_browser_url/test_custom_browser_url.py::test_request_via_custom_browser_url' -docker logs browserless-custom-url +docker logs browserless-custom-url &>log.txt +grep 'custom-browser-search-string=1' log.txt +if [ $? -ne 1 ] +then + echo "Did not see request in 'browserless-custom-url' container with 'custom-browser-search-string=1' when I should" + exit 1 +fi + +docker logs browserless &>log.txt +grep 'custom-browser-search-string=1' log.txt +if [ $? -ne 0 ] +then + echo "saw a request in 'browser' container with 'custom-browser-search-string=1' when I should not" + exit 1 +fi + diff --git a/changedetectionio/tests/custom_browser_url/test_custom_browser_url.py b/changedetectionio/tests/custom_browser_url/test_custom_browser_url.py index f4557ecc..bfc2c95e 100644 --- a/changedetectionio/tests/custom_browser_url/test_custom_browser_url.py +++ b/changedetectionio/tests/custom_browser_url/test_custom_browser_url.py @@ -59,8 +59,6 @@ def do_test(client, live_server, make_test_use_extra_browser=False): }, follow_redirects=True ) - with open('/tmp/fuck.html' , 'wb') as f: - f.write(res.data) assert b"Updated watch." in res.data wait_for_all_checks(client)