diff --git a/apps/web/tests/getting-started.spec.ts b/apps/web/tests/getting-started.spec.ts index 03b47c91..f8df0d17 100644 --- a/apps/web/tests/getting-started.spec.ts +++ b/apps/web/tests/getting-started.spec.ts @@ -116,18 +116,17 @@ test("onboarding defers, resumes and completes once; settings show one focused s await expect(catalog.getByText("Metadata defaults saved.")).toBeVisible(); await page.goto("/settings#sources"); const mam = page.getByRole("form", { name: "MAM connection settings" }); - if (!(await mam.isVisible())) - await page - .getByRole("region", { name: "MAM settings", exact: true }) - .locator("summary") - .first() - .click(); - if (!(await mam.isVisible())) - await page - .getByRole("region", { name: "MAM settings", exact: true }) - .locator("summary") - .first() - .click(); + // Open the MAM row, waiting for it to render before checking again, so a second click does not + // close it. + await expect(async () => { + if (!(await mam.isVisible())) + await page + .getByRole("region", { name: "MAM settings", exact: true }) + .locator("summary") + .first() + .click(); + await expect(mam).toBeVisible({ timeout: 1500 }); + }).toPass(); await mam.getByText("Advanced settings", { exact: true }).click(); await mam .getByLabel("MAM URL", { exact: true }) diff --git a/tests/unit/test_qbittorrent_metadata.py b/tests/unit/test_qbittorrent_metadata.py index b00aab40..490dc8be 100644 --- a/tests/unit/test_qbittorrent_metadata.py +++ b/tests/unit/test_qbittorrent_metadata.py @@ -89,8 +89,12 @@ def handler(request): "http://qbit.test", "fixture", "fixture", transport=httpx.MockTransport(handler) ) as client: with pytest.raises(AdapterError) as error: + # Only the pending case should run out of time. The others start a torrent probe + # process, which can take longer than 0.2 seconds on a busy machine. await client.resolve_magnet( - "magnet:?xt=urn:btih:" + "a" * 40, interval=0.01, wait_seconds=0.2 + "magnet:?xt=urn:btih:" + "a" * 40, + interval=0.01, + wait_seconds=0.2 if failure == "pending" else 10, ) assert error.value.kind == ( FailureKind.TIMEOUT if failure == "pending" else FailureKind.PARSER