diff --git a/e2e/login.spec.ts b/e2e/login.spec.ts index 5837a44..ebf2f0c 100644 --- a/e2e/login.spec.ts +++ b/e2e/login.spec.ts @@ -47,7 +47,7 @@ test("logs in", async ({ page, userAgent }) => { await page.goto("./"); await expect(page).toHaveTitle(/WordBook - Internet redefined/); await expect(await page.getByText(/WordBook - the Internet redefined/i)).toBeVisible(); - await switchBar(page) + await switchBar(page); const loc = page.getByText(/Log in/i).filter({ hasNotText: /account/ }); await expect(loc).toBeVisible(); await loc.click(); @@ -56,7 +56,7 @@ test("logs in", async ({ page, userAgent }) => { await (await page.$("#password"))?.fill("123"); await (await page.getByText(/submit/i)).click(); await expect(page.locator(".w-md-editor")).toBeVisible(); - await switchBar(page) + await switchBar(page); await expect(page.locator("a").filter({ hasText: "WordBook" })).toBeVisible(); await expect(page.locator("#menu svg.w-full")).toBeVisible(); }); diff --git a/e2e/post.spec.ts b/e2e/post.spec.ts index bee238a..524fba5 100644 --- a/e2e/post.spec.ts +++ b/e2e/post.spec.ts @@ -38,7 +38,7 @@ test("register and login", async ({ userAgent }) => { await page.goto("./"); await expect(page).toHaveTitle(/WordBook - Internet redefined/); await expect(await page.getByText(/WordBook - the Internet redefined/i)).toBeVisible(); - await switchBar(page) + await switchBar(page); const loc = page.getByText(/Log in/i).filter({ hasNotText: /account/ }); await expect(loc).toBeVisible(); await loc.click(); @@ -47,7 +47,7 @@ test("register and login", async ({ userAgent }) => { await (await page.$("#password"))?.fill("123"); await (await page.getByText(/submit/i)).click(); await expect(page.locator(".w-md-editor")).toBeVisible(); - await switchBar(page) + await switchBar(page); await expect(await page.locator("a").filter({ hasText: "WordBook" })).toBeVisible(); await expect(await page.locator("#menu svg.w-full")).toBeVisible(); }); @@ -56,7 +56,7 @@ test("submit a post", async ({ userAgent }) => { const id = sha256(userAgent as string); const date = Date.now(); await expect(page.locator("#menu svg.w-full")).toBeVisible(); - await switchBar(page) + await switchBar(page); await expect(page.locator(".w-md-editor")).toBeVisible(); await page.locator("textarea").fill("First post by " + "test3@email_" + id + ".com in " + date); await page.getByText(/submit/i).scrollIntoViewIfNeeded(); diff --git a/lib/e2e/switchBar/index.ts b/lib/e2e/switchBar/index.ts index f594a41..b76c195 100644 --- a/lib/e2e/switchBar/index.ts +++ b/lib/e2e/switchBar/index.ts @@ -1,7 +1,7 @@ import { Page } from "@playwright/test"; -export async function switchBar(page:Page){ - const sw = page.locator('#switch') - if(!await sw.isVisible()) return - await sw.click() -} \ No newline at end of file +export async function switchBar(page: Page) { + const sw = page.locator("#switch"); + if (!(await sw.isVisible())) return; + await sw.click(); +}