From 2fc1da6bac2c45768f931e52ca0f276d2a39fba9 Mon Sep 17 00:00:00 2001 From: Brian Helba Date: Tue, 26 May 2026 12:57:07 -0400 Subject: [PATCH 1/4] Fix behavior on the cohort publish page --- isic/ingest/templates/ingest/cohort_publish.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/isic/ingest/templates/ingest/cohort_publish.html b/isic/ingest/templates/ingest/cohort_publish.html index 32a7d0ebc..cc524d380 100644 --- a/isic/ingest/templates/ingest/cohort_publish.html +++ b/isic/ingest/templates/ingest/cohort_publish.html @@ -122,9 +122,9 @@ entries: [], init() { - const select = document.getElementById("additional-collections-selection"); - select.addEventListener("change", () => { - this.fetchSharingInfo(); + // Select2 fires jQuery events, not native DOM events; addEventListener won't work here. + $("#additional-collections-selection").on("change", async () => { + await this.fetchSharingInfo(); }); }, From 205b62c6a923e45684b31a9a4a1b5c4271a02c8d Mon Sep 17 00:00:00 2001 From: annehaley Date: Tue, 2 Jun 2026 18:45:11 +0000 Subject: [PATCH 2/4] Add check for sharing notice visibility in cohort publish test --- isic/ingest/tests/test_publish_browser.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/isic/ingest/tests/test_publish_browser.py b/isic/ingest/tests/test_publish_browser.py index cc0fd6a6f..997df0718 100644 --- a/isic/ingest/tests/test_publish_browser.py +++ b/isic/ingest/tests/test_publish_browser.py @@ -88,6 +88,16 @@ def test_cohort_publish_with_additional_collections( page.locator(".select2-selection__choice", has_text=extra_collection_b.name) ).to_be_visible() + # Check that sharing notice is visible and lists other_user twice + # First for collection B and then for collection A + sharing_notice = page.get_by_text("Publishing to these collections will give access to:") + expect(sharing_notice).to_be_visible() + sharing_entries = sharing_notice.locator("..").locator("ul").locator("li") + expect(sharing_entries).to_have_count(2) + user_name = f"{other_user.first_name} {other_user.last_name}" + expect(sharing_entries.first).to_have_text(f"{user_name} (owner of {extra_collection_b.name})") + expect(sharing_entries.last).to_have_text(f"{user_name} (owner of {extra_collection_a.name})") + # Submit with confirmation dialog page.on("dialog", lambda dialog: dialog.accept()) page.get_by_role("button", name="Publish 1 accessions").click() From 3f8fea1668bd4bbcd657229208cce26fa9b25d66 Mon Sep 17 00:00:00 2001 From: annehaley Date: Tue, 2 Jun 2026 19:16:20 +0000 Subject: [PATCH 3/4] Don't assume the order of sharing entries in test (order varies) --- isic/ingest/tests/test_publish_browser.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/isic/ingest/tests/test_publish_browser.py b/isic/ingest/tests/test_publish_browser.py index 997df0718..9c857bb89 100644 --- a/isic/ingest/tests/test_publish_browser.py +++ b/isic/ingest/tests/test_publish_browser.py @@ -88,15 +88,15 @@ def test_cohort_publish_with_additional_collections( page.locator(".select2-selection__choice", has_text=extra_collection_b.name) ).to_be_visible() - # Check that sharing notice is visible and lists other_user twice - # First for collection B and then for collection A + # Check that sharing notice is visible and lists other_user twice, once for each collection sharing_notice = page.get_by_text("Publishing to these collections will give access to:") expect(sharing_notice).to_be_visible() sharing_entries = sharing_notice.locator("..").locator("ul").locator("li") expect(sharing_entries).to_have_count(2) + sharing_entries_text = sharing_entries.all_inner_texts() user_name = f"{other_user.first_name} {other_user.last_name}" - expect(sharing_entries.first).to_have_text(f"{user_name} (owner of {extra_collection_b.name})") - expect(sharing_entries.last).to_have_text(f"{user_name} (owner of {extra_collection_a.name})") + assert f"{user_name} (owner of {extra_collection_a.name})" in sharing_entries_text + assert f"{user_name} (owner of {extra_collection_b.name})" in sharing_entries_text # Submit with confirmation dialog page.on("dialog", lambda dialog: dialog.accept()) From 3d0030a4f8d8788468e3f3e2472882c20cd0736f Mon Sep 17 00:00:00 2001 From: annehaley Date: Wed, 3 Jun 2026 16:52:58 +0000 Subject: [PATCH 4/4] Match entry elements by role instead of DOM position --- isic/ingest/tests/test_publish_browser.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/isic/ingest/tests/test_publish_browser.py b/isic/ingest/tests/test_publish_browser.py index 9c857bb89..9e4da3574 100644 --- a/isic/ingest/tests/test_publish_browser.py +++ b/isic/ingest/tests/test_publish_browser.py @@ -89,14 +89,12 @@ def test_cohort_publish_with_additional_collections( ).to_be_visible() # Check that sharing notice is visible and lists other_user twice, once for each collection - sharing_notice = page.get_by_text("Publishing to these collections will give access to:") - expect(sharing_notice).to_be_visible() - sharing_entries = sharing_notice.locator("..").locator("ul").locator("li") - expect(sharing_entries).to_have_count(2) - sharing_entries_text = sharing_entries.all_inner_texts() - user_name = f"{other_user.first_name} {other_user.last_name}" - assert f"{user_name} (owner of {extra_collection_a.name})" in sharing_entries_text - assert f"{user_name} (owner of {extra_collection_b.name})" in sharing_entries_text + expect(page.get_by_text("will give access to")).to_be_visible() + full_name = f"{other_user.first_name} {other_user.last_name}" + entries = page.get_by_role("listitem").filter(has_text=full_name) + expect(entries).to_have_count(2) + expect(entries.filter(has_text=extra_collection_a.name)).to_be_visible() + expect(entries.filter(has_text=extra_collection_b.name)).to_be_visible() # Submit with confirmation dialog page.on("dialog", lambda dialog: dialog.accept())