Update tests

This commit is contained in:
Arnaud 2025-02-25 16:08:31 +01:00
parent 5549f1336d
commit 3cac23cd3b
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663
2 changed files with 64 additions and 35 deletions

View File

@ -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")
});
await expect(page.locator("#url")).toHaveValue("");
await expect(page.locator("#url")).toHaveAttribute("aria-invalid");
await expect(page.locator(".refresh svg")).toHaveAttribute(
"color",
"#494949"
);
});

View File

@ -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(