From 11f1875817325a8dca275870e205da4b9c1a6138 Mon Sep 17 00:00:00 2001 From: Max Berger Date: Sat, 21 Mar 2026 17:54:10 +0100 Subject: [PATCH 1/3] Add integration test for download functionality --- integ_tests/test_download.py | 74 ++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 integ_tests/test_download.py diff --git a/integ_tests/test_download.py b/integ_tests/test_download.py new file mode 100644 index 00000000..594a24f8 --- /dev/null +++ b/integ_tests/test_download.py @@ -0,0 +1,74 @@ +# This file is part of Radicale - CalDAV and CardDAV server +# Copyright © 2026-2026 Max Berger +# +# This library is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Radicale. If not, see . + +""" +Integration tests for download page +""" + +import pathlib +from typing import Any, Generator + +import pytest +from playwright.sync_api import Page + +from integ_tests.common import login, start_radicale_server + + +@pytest.fixture +def radicale_server(tmp_path: pathlib.Path) -> Generator[str, Any, None]: + yield from start_radicale_server(tmp_path) + + +def test_download_addressbook(page: Page, radicale_server: str) -> None: + login(page, radicale_server) + page.click('.fabcontainer a[data-name="new"]') + + # an address book is created + page.select_option('#createcollectionscene select[data-name="type"]', "ADDRESSBOOK") + page.locator('#createcollectionscene input[data-name="displayname"]').fill("Abname") + page.click('#createcollectionscene button[data-name="submit"]') + + # Start waiting for the download + with page.expect_download() as download_info: + # Perform the action that initiates download + page.hover("article:not(.hidden)") + page.click('article:not(.hidden) a[data-name="download"]') + + download = download_info.value + assert download.suggested_filename == "Abname.vcf" + + +def test_download_calendar_uses_displayname_ics( + page: Page, radicale_server: str +) -> None: + login(page, radicale_server) + page.click('.fabcontainer a[data-name="new"]') + + # a calendar is created + page.select_option('#createcollectionscene select[data-name="type"]', "CALENDAR") + page.locator('#createcollectionscene input[data-name="displayname"]').fill( + "Calname" + ) + page.click('#createcollectionscene button[data-name="submit"]') + + # Start waiting for the download + with page.expect_download() as download_info: + # Perform the action that initiates download + page.hover("article:not(.hidden)") + page.click('article:not(.hidden) a[data-name="download"]') + + download = download_info.value + assert download.suggested_filename == "Calname.ics" From fc18cadd384fabcf928ef0d671aeb5a48cb2e5a7 Mon Sep 17 00:00:00 2001 From: Max Berger Date: Sat, 21 Mar 2026 22:58:22 +0100 Subject: [PATCH 2/3] Fix: Break infinite loop during cache load failure --- radicale/web/internal_data/js/utils/collections_cache.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/radicale/web/internal_data/js/utils/collections_cache.js b/radicale/web/internal_data/js/utils/collections_cache.js index 7110df0f..cc5669c6 100644 --- a/radicale/web/internal_data/js/utils/collections_cache.js +++ b/radicale/web/internal_data/js/utils/collections_cache.js @@ -26,7 +26,7 @@ import { is_current_scene, pop_scene, push_scene } from "../scenes/scene_manager class CollectionsCache { constructor() { - this.child_collections = null; + /** @type {?Array} */ this.child_collections = null; /** @type {?Array} */ this.incoming_shares = null; this.server_features = null; /** @type {?XMLHttpRequest} */ this.collections_req = null; @@ -73,6 +73,8 @@ class CollectionsCache { } if (error) { onerror(error); + this.child_collections = []; + this.incoming_shares = []; pop_scene(); } else if (collections !== null && shares !== null) { this.child_collections = collections; From 01b9df4666558534aa43889e4e468a9dd434ef8d Mon Sep 17 00:00:00 2001 From: Max Berger Date: Sat, 21 Mar 2026 23:45:08 +0100 Subject: [PATCH 3/3] Add Error Handling for collections cache load failures --- radicale/web/internal_data/index.html | 1 + .../js/scenes/CollectionsScene.js | 18 +++++++++++++++--- .../js/utils/collections_cache.js | 6 +++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/radicale/web/internal_data/index.html b/radicale/web/internal_data/index.html index bcaf868b..c1b917e3 100644 --- a/radicale/web/internal_data/index.html +++ b/radicale/web/internal_data/index.html @@ -54,6 +54,7 @@