Fix formatting on new tests

This commit is contained in:
Max Berger
2026-03-10 23:35:40 +01:00
parent d99631e47d
commit 9c88ba07be
4 changed files with 99 additions and 62 deletions

View File

@@ -47,10 +47,12 @@ def test_delete_wrong_confirmation(page: Page, radicale_server: str) -> None:
# Check for error message
error_locator = page.locator('#deletecollectionscene span[data-name="error"]')
expect(error_locator).to_be_visible()
expect(error_locator).to_contain_text("Please type DELETE in the confirmation field")
expect(error_locator).to_contain_text(
"Please type DELETE in the confirmation field"
)
# Scene should still be visible
expect(page.locator('#deletecollectionscene')).to_be_visible()
expect(page.locator("#deletecollectionscene")).to_be_visible()
def test_delete_correct_confirmation(page: Page, radicale_server: str) -> None:
@@ -58,7 +60,7 @@ def test_delete_correct_confirmation(page: Page, radicale_server: str) -> None:
create_collection(page, radicale_server)
# Verify collection exists
expect(page.locator('article:not(.hidden)')).to_have_count(1)
expect(page.locator("article:not(.hidden)")).to_have_count(1)
# Open delete scene
page.hover("article:not(.hidden)")
@@ -69,7 +71,7 @@ def test_delete_correct_confirmation(page: Page, radicale_server: str) -> None:
page.click('#deletecollectionscene button[data-name="delete"]')
# Verify collection is gone
expect(page.locator('article:not(.hidden)')).to_have_count(0)
expect(page.locator("article:not(.hidden)")).to_have_count(0)
# Scene should be hidden
expect(page.locator('#deletecollectionscene')).to_be_hidden()
expect(page.locator("#deletecollectionscene")).to_be_hidden()

View File

@@ -37,7 +37,7 @@ def test_edit_save(page: Page, radicale_server: str) -> None:
create_collection(page, radicale_server)
# Get original values
article = page.locator('article:not(.hidden)')
article = page.locator("article:not(.hidden)")
# Open edit scene
page.hover("article:not(.hidden)")
@@ -60,7 +60,7 @@ def test_edit_cancel(page: Page, radicale_server: str) -> None:
create_collection(page, radicale_server)
# Get original values
article = page.locator('article:not(.hidden)')
article = page.locator("article:not(.hidden)")
original_title = article.locator('[data-name="title"]').text_content()
original_description = article.locator('[data-name="description"]').text_content()
@@ -70,9 +70,13 @@ def test_edit_cancel(page: Page, radicale_server: str) -> None:
# Update title and description but cancel
page.fill('#editcollectionscene input[data-name="displayname"]', "Changed Title")
page.fill('#editcollectionscene input[data-name="description"]', "Changed Description")
page.fill(
'#editcollectionscene input[data-name="description"]', "Changed Description"
)
page.click('#editcollectionscene button[data-name="cancel"]')
# Verify values remain unchanged
expect(article.locator('[data-name="title"]')).to_have_text(original_title)
expect(article.locator('[data-name="description"]')).to_have_text(original_description)
expect(article.locator('[data-name="description"]')).to_have_text(
original_description
)

View File

@@ -118,8 +118,12 @@ def test_share_with_property_overrides(page: Page, radicale_server: str) -> None
login(page, radicale_server)
# Create a collection with specific details
page.click('a[data-name="new"]')
page.locator('#createcollectionscene input[data-name="displayname"]').fill("Test Collection")
page.locator('#createcollectionscene input[data-name="description"]').fill("Original Description")
page.locator('#createcollectionscene input[data-name="displayname"]').fill(
"Test Collection"
)
page.locator('#createcollectionscene input[data-name="description"]').fill(
"Original Description"
)
page.locator('#createcollectionscene input[data-name="color"]').fill("#ff0000")
page.click('#createcollectionscene button[data-name="submit"]')
@@ -128,14 +132,18 @@ def test_share_with_property_overrides(page: Page, radicale_server: str) -> None
page.click('button[data-name="sharebytoken"]')
# Verify defaults
expect(page.locator('input[data-name="description_override"]')).to_have_value("Original Description")
expect(page.locator('input[data-name="description_override"]')).to_have_value(
"Original Description"
)
expect(page.locator('input[data-name="color_override"]')).to_have_value("#ff0000")
expect(page.locator('input[data-name="description_override"]')).to_be_disabled()
expect(page.locator('input[data-name="color_override"]')).to_be_disabled()
# Set overrides
page.click('label[for="newshare_attr_description_enabled"]')
page.locator('input[data-name="description_override"]').fill("Overridden Description")
page.locator('input[data-name="description_override"]').fill(
"Overridden Description"
)
page.click('label[for="newshare_attr_color_enabled"]')
page.locator('input[data-name="color_override"]').fill("#00ff00")
@@ -151,9 +159,15 @@ def test_share_journal_no_overrides(page: Page, radicale_server: str) -> None:
login(page, radicale_server)
# Create a collection of type JOURNAL
page.click('a[data-name="new"]')
page.locator('#createcollectionscene select[data-name="type"]').select_option("JOURNAL")
page.locator('#createcollectionscene input[data-name="displayname"]').fill("Test Journal")
page.locator('#createcollectionscene input[data-name="description"]').fill("Journal Description")
page.locator('#createcollectionscene select[data-name="type"]').select_option(
"JOURNAL"
)
page.locator('#createcollectionscene input[data-name="displayname"]').fill(
"Test Journal"
)
page.locator('#createcollectionscene input[data-name="description"]').fill(
"Journal Description"
)
page.click('#createcollectionscene button[data-name="submit"]')
page.hover("article:not(.hidden)")
@@ -187,7 +201,7 @@ def test_edit_share_by_token(page: Page, radicale_server: str) -> None:
# Edit to RW
page.click('tr:not(.hidden) button[data-name="edit"]')
expect(page.locator('#newshare h1')).to_have_text("Edit Share")
expect(page.locator("#newshare h1")).to_have_text("Edit Share")
page.click('label[for="newshare_attr_permissions_rw"]')
page.click('#newshare button[data-name="submit"]')
@@ -214,7 +228,7 @@ def test_edit_share_by_map(page: Page, radicale_server: str) -> None:
# Edit map share
page.click('tr:not(.hidden) button[data-name="edit"]')
expect(page.locator('#newshare h1')).to_have_text("Edit Share")
expect(page.locator("#newshare h1")).to_have_text("Edit Share")
expect(page.locator('input[data-name="shareuser"]')).to_be_disabled()
expect(page.locator('input[data-name="sharehref"]')).to_be_disabled()

View File

@@ -46,7 +46,9 @@ def test_upload_zero_files(page: Page, radicale_server: str) -> None:
expect(error_locator).to_contain_text("Please select at least one file")
def test_upload_one_file_custom_href(page: Page, radicale_server: str, tmp_path: pathlib.Path) -> None:
def test_upload_one_file_custom_href(
page: Page, radicale_server: str, tmp_path: pathlib.Path
) -> None:
login(page, radicale_server)
# Create a fake file to upload
@@ -56,22 +58,30 @@ def test_upload_one_file_custom_href(page: Page, radicale_server: str, tmp_path:
page.click('.fabcontainer a[data-name="upload"]')
# Upload 1 file and set custom href
page.set_input_files('#uploadcollectionscene input[data-name="uploadfile"]', str(test_file))
page.set_input_files(
'#uploadcollectionscene input[data-name="uploadfile"]', str(test_file)
)
page.fill('#uploadcollectionscene input[data-name="href"]', "testcollection")
page.click('#uploadcollectionscene button[data-name="submit"]')
# Wait for upload to complete in the list item
expect(page.locator('#uploadcollectionscene li:not(.hidden) [data-name="success"]')).to_be_visible()
expect(
page.locator('#uploadcollectionscene li:not(.hidden) [data-name="success"]')
).to_be_visible()
# Close scene
page.click('#uploadcollectionscene button[data-name="close"]')
# Verify 1 collection exists with "testcollection" in url
expect(page.locator('article:not(.hidden)')).to_have_count(1)
expect(page.locator('article:not(.hidden) input[data-name="url"]')).to_have_value(re.compile(r".*testcollection/.*"))
expect(page.locator("article:not(.hidden)")).to_have_count(1)
expect(page.locator('article:not(.hidden) input[data-name="url"]')).to_have_value(
re.compile(r".*testcollection/.*")
)
def test_upload_two_files(page: Page, radicale_server: str, tmp_path: pathlib.Path) -> None:
def test_upload_two_files(
page: Page, radicale_server: str, tmp_path: pathlib.Path
) -> None:
login(page, radicale_server)
# Create two fake files
@@ -83,20 +93,27 @@ def test_upload_two_files(page: Page, radicale_server: str, tmp_path: pathlib.Pa
page.click('.fabcontainer a[data-name="upload"]')
# Upload 2 files
page.set_input_files('#uploadcollectionscene input[data-name="uploadfile"]', [str(file1), str(file2)])
page.set_input_files(
'#uploadcollectionscene input[data-name="uploadfile"]', [str(file1), str(file2)]
)
# HREF field should be hidden
expect(page.locator('#uploadcollectionscene input[data-name="href"]')).to_be_hidden()
expect(page.locator('#uploadcollectionscene [data-name="hreflimitmsg"]')).to_be_visible()
expect(
page.locator('#uploadcollectionscene input[data-name="href"]')
).to_be_hidden()
expect(
page.locator('#uploadcollectionscene [data-name="hreflimitmsg"]')
).to_be_visible()
page.click('#uploadcollectionscene button[data-name="submit"]')
# Wait for uploads to complete
# Wait until 2 entries in the upload list show success
expect(page.locator('#uploadcollectionscene li:not(.hidden) [data-name="success"]')).to_have_count(2)
expect(
page.locator('#uploadcollectionscene li:not(.hidden) [data-name="success"]')
).to_have_count(2)
# Close scene
page.click('#uploadcollectionscene button[data-name="close"]')
# Verify 2 collections exist
expect(page.locator('article:not(.hidden)')).to_have_count(2)
expect(page.locator("article:not(.hidden)")).to_have_count(2)