Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): de-flake PaywallModal upgrade-mutation tests (#13361)

Abhimanyu Yadavdb93e4808a30
diff --git a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx
index d741f34c41..4bbf417695 100644
--- a/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/PaywallGate/__tests__/PaywallModal.test.tsx
@@ -47,6 +47,15 @@ vi.mock("@/lib/supabase/hooks/useSupabase", () => ({
}),
}));
+// The shared test wrapper mounts OnboardingProvider, which asynchronously
+// checks onboarding completion and can fire router.replace("/onboarding").
+// That shares this file's mocked next/navigation replace, so the stray
+// redirect races into assertions that the paywall did NOT navigate. Render
+// children directly to keep navigation owned solely by PaywallModal.
+vi.mock("@/providers/onboarding/onboarding-provider", () => ({
+ default: ({ children }: { children: React.ReactNode }) => <>{children}</>,
+}));
+
const mockReplace = vi.fn();
vi.mock("next/navigation", () => ({
useRouter: () => ({