aboutsummaryrefslogtreecommitdiff
path: root/tests/playwright
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2023-11-25 11:07:59 +0100
committerDaniel Schadt <kingdread@gmx.de>2023-11-25 11:07:59 +0100
commit6e6a5a836dd1bd567078896a9e75d93061fd13a6 (patch)
tree45000737a4f18a99397f793a2cd1ad2a42d3002f /tests/playwright
parent40779bcfea8fce9a23c552cf449d25a0971ee329 (diff)
parentac2eea33e8e2b03a0c4c1c170e6141355bef01a5 (diff)
downloadfietsboek-6e6a5a836dd1bd567078896a9e75d93061fd13a6.tar.gz
fietsboek-6e6a5a836dd1bd567078896a9e75d93061fd13a6.tar.bz2
fietsboek-6e6a5a836dd1bd567078896a9e75d93061fd13a6.zip
Merge branch 'disable-image-upload'
Diffstat (limited to 'tests/playwright')
-rw-r--r--tests/playwright/conftest.py4
-rw-r--r--tests/playwright/test_no_image_uploads.py34
2 files changed, 36 insertions, 2 deletions
diff --git a/tests/playwright/conftest.py b/tests/playwright/conftest.py
index 12a0047..4e7f5a4 100644
--- a/tests/playwright/conftest.py
+++ b/tests/playwright/conftest.py
@@ -15,7 +15,7 @@ from fietsboek.config import Config
import pytest
-@pytest.fixture(scope="session")
+@pytest.fixture(scope="module")
def server_port():
"""Return a (likely) free port.
@@ -29,7 +29,7 @@ def server_port():
return port
-@pytest.fixture(scope="session", autouse=True)
+@pytest.fixture(scope="module", autouse=True)
def running_server(server_port, app):
"""Have the app running as an actual server."""
server = simple_server.make_server("127.0.0.1", server_port, app)
diff --git a/tests/playwright/test_no_image_uploads.py b/tests/playwright/test_no_image_uploads.py
new file mode 100644
index 0000000..b133697
--- /dev/null
+++ b/tests/playwright/test_no_image_uploads.py
@@ -0,0 +1,34 @@
+import pytest
+from playwright.sync_api import Page, expect
+
+from testutils import extract_and_upload
+
+
+@pytest.fixture(scope="module")
+def app_settings(app_settings):
+ """Override the standard app settings to disable image uploads."""
+ app_settings["fietsboek.enable_image_uploads"] = "false"
+ return app_settings
+
+
+def test_image_button_disabled_during_upload(page: Page, playwright_helper, tmp_path, dbaccess):
+ playwright_helper.login()
+
+ page.goto("/")
+ page.get_by_text("Upload").click()
+
+ # We unpack one of the test GPX files
+ extract_and_upload(page, "Teasi_1.gpx.gz", tmp_path)
+
+ # We now fill in most of the data
+ expect(page.locator("#selectImagesButton")).to_be_disabled()
+
+
+def test_image_button_disabled_during_edit(page: Page, playwright_helper, dbaccess):
+ playwright_helper.login()
+ track_id = playwright_helper.add_track().id
+
+ page.goto(f"/track/{track_id}")
+ page.locator(".btn", has_text="Edit").click()
+
+ expect(page.locator("#selectImagesButton")).to_be_disabled()