diff --git a/e2e/onboarding.spec.ts b/e2e/onboarding.spec.ts index 6dd240f..a246cf6 100644 --- a/e2e/onboarding.spec.ts +++ b/e2e/onboarding.spec.ts @@ -1,58 +1,87 @@ -import { test, expect, } from '@playwright/test'; +import { test, expect } from "@playwright/test"; -test.describe('onboarding', () => { - test('onboarding steps', async ({ page, browserName }) => { - await page.context().setOffline(false) - await page.goto('/'); - await expect(page.getByText("Codex is a durable, decentralised data storage protocol, created so the world community can preserve its most important knowledge without risk of censorship.")).toBeVisible() - await page.locator('.navigation').click(); - await expect(page.locator('.navigation')).toHaveAttribute("aria-disabled"); - await page.getByLabel('Preferred name').fill('Arnaud'); - await expect(page.locator('.navigation')).not.toHaveAttribute("aria-disabled"); - await page.locator('.navigation').click(); +test.describe("onboarding", () => { + test("onboarding steps", async ({ page, browserName }) => { + await page.context().setOffline(false); + await page.goto("/"); + await expect( + page.getByText( + "Codex is a durable, decentralised data storage protocol, created so the world community can preserve its most important knowledge without risk of censorship." + ) + ).toBeVisible(); + await page.locator(".navigation").click(); + await expect(page.locator(".navigation")).toHaveAttribute("aria-disabled"); + await page.getByLabel("Preferred name").fill("Arnaud"); + await expect(page.locator(".navigation")).not.toHaveAttribute( + "aria-disabled" + ); + await page.locator(".navigation").click(); // Network - await expect(page.locator(".health-checks ul li").nth(1).getByTestId("icon-error")).not.toBeVisible() - await expect(page.locator(".health-checks ul li").nth(1).getByTestId("icon-success")).toBeVisible() + await expect( + page.locator(".health-checks ul li").nth(1).getByTestId("icon-error") + ).not.toBeVisible(); + await expect( + page.locator(".health-checks ul li").nth(1).getByTestId("icon-success") + ).toBeVisible(); // Port forwarding - await expect(page.locator(".health-checks ul li").nth(2).getByTestId("icon-error")).not.toBeVisible() - await expect(page.locator(".health-checks ul li").nth(2).getByTestId("icon-success")).toBeVisible() + await expect( + page.locator(".health-checks ul li").nth(2).getByTestId("icon-error") + ).not.toBeVisible(); + await expect( + page.locator(".health-checks ul li").nth(2).getByTestId("icon-success") + ).toBeVisible(); // Codex node - await expect(page.locator(".health-checks ul li").nth(2).getByTestId("icon-error")).not.toBeVisible() - await expect(page.locator(".health-checks ul li").nth(2).getByTestId("icon-success")).toBeVisible() + await expect( + page.locator(".health-checks ul li").nth(2).getByTestId("icon-error") + ).not.toBeVisible(); + await expect( + page.locator(".health-checks ul li").nth(2).getByTestId("icon-success") + ).toBeVisible(); // Marketplace - await expect(page.locator(".health-checks ul li").nth(3).getByTestId("icon-warning")).toBeVisible({ timeout: 10_000 }) - await expect(page.locator(".health-checks ul li").nth(3).getByTestId("icon-success")).not.toBeVisible() + //await expect(page.locator(".health-checks ul li").nth(3).getByTestId("icon-warning")).toBeVisible({ timeout: 10_000 }) + await expect( + page.locator(".health-checks ul li").nth(3).getByTestId("icon-success") + ).toBeVisible(); // Can be simulated with File -> Work offline - if (browserName.toLowerCase() !== 'firefox') { - await page.context().setOffline(true) + if (browserName.toLowerCase() !== "firefox") { + await page.context().setOffline(true); // Network - await expect(page.locator(".health-checks ul li").nth(1).getByTestId("icon-error")).toBeVisible() - await expect(page.locator(".health-checks ul li").nth(1).getByTestId("icon-success")).not.toBeVisible() + await expect( + page.locator(".health-checks ul li").nth(1).getByTestId("icon-error") + ).toBeVisible(); + await expect( + page.locator(".health-checks ul li").nth(1).getByTestId("icon-success") + ).not.toBeVisible(); - await page.context().setOffline(false) + await page.context().setOffline(false); } }); test.beforeEach(async ({ page }) => { - await page.context().setOffline(false) + await page.context().setOffline(false); }); -}) +}); -test('does not display undefined when delete the url value', async ({ page }) => { - await page.goto('/onboarding-checks'); - await page.locator('#url').focus() +test("does not display undefined when delete the url value", async ({ + page, +}) => { + await page.goto("/onboarding-checks"); + await page.locator("#url").focus(); for (let i = 0; i < "http://localhost:8080".length; i++) { - await page.keyboard.press('Backspace'); + await page.keyboard.press("Backspace"); } - await expect(page.locator('#url')).toHaveValue(""); - await expect(page.locator('#url')).toHaveAttribute("aria-invalid") - await expect(page.locator('.refresh svg')).toHaveAttribute("color", "#494949") -}); \ No newline at end of file + await expect(page.locator("#url")).toHaveValue(""); + await expect(page.locator("#url")).toHaveAttribute("aria-invalid"); + await expect(page.locator(".refresh svg")).toHaveAttribute( + "color", + "#494949" + ); +}); diff --git a/e2e/storage-requests.spec.ts b/e2e/storage-requests.spec.ts index 95046c1..b6f777f 100644 --- a/e2e/storage-requests.spec.ts +++ b/e2e/storage-requests.spec.ts @@ -133,7 +133,7 @@ test("create a storage request by using decimal values", async ({ page }) => { "disabled" ); - const days = Math.random() * 7; + const days = 4; await page.getByLabel("Full period of the contract").fill(days.toFixed(1)); await expect(page.locator("footer .button--primary")).not.toHaveAttribute(