Skip to content

Stabilize PWA offline system spec and offline banner behavior - #1007

Draft
moustachu with Copilot wants to merge 1 commit into
developfrom
copilot/fix-system-specs-test
Draft

Stabilize PWA offline system spec and offline banner behavior#1007
moustachu with Copilot wants to merge 1 commit into
developfrom
copilot/fix-system-specs-test

Conversation

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown

The failing System specs / Test job came from the PWA offline flow being timing-sensitive: the cached homepage could load offline before the service worker reliably controlled the page, and the offline banner visibility depended on a one-time page-load check.

  • Harden service-worker timing in the PWA spec

    • Wait for navigator.serviceWorker.ready
    • Revisit the homepage so the service worker can take control
    • Wait for controllerchange before switching the browser offline
  • Make the offline banner reactive instead of load-only

    • Override the Decidim offline banner partial
    • Recompute banner visibility on offline, online, and pageshow
    • Keep the banner visible when serving the cached page offline, not only on initial DOMContentLoaded
  • Resulting behavior

    • The PWA spec no longer assumes the service worker is immediately active after the first visit
    • The UI now reflects offline state transitions after navigation, which is the condition exercised by the failing system spec
visit decidim.root_path
wait_for_service_worker_to_be_ready

visit decidim.root_path
wait_for_service_worker_to_control_page

with_browser_in_offline_mode do
  visit decidim.root_path
  expect(page).to have_content("Your network is offline...")
end

Copilot AI changed the title [WIP] Fix failing GitHub Actions job 'System specs / Test' Stabilize PWA offline system spec and offline banner behavior Jul 17, 2026
Copilot AI requested a review from moustachu July 17, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants