aboutsummaryrefslogtreecommitdiff
path: root/tests/playwright/test_no_image_uploads.py
blob: b1336975d1ded60525077f79419d6a78f309a7b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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()