SPB Git

Repository Public

mobile.spec.ts 4.2 KB 90 lines typescript

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : ORIX App Universe8 * File             : e2e/mobile.spec.ts9 * Module           : e2e10 * Repository       : https://git.spboucher.ai/orix-spboucher-ai11 * Project Website  : https://www.orixlab.dev12 * Created          : 2026-11-2113 * Last Modified    : 2026-11-2114 *15 * Author           : Simon-Pierre Boucher16 * Position         : Professor of Finance17 * Institution      : Université du Québec en Outaouais (UQO)18 * Organization     : SP Boucher19 * Website          : https://spboucher.ai20 * Git              : https://git.spboucher.ai21 *22 * Preferred Contact: support@spboucher.ai23 * Development      : dev@spboucher.ai24 * Support          : support@spboucher.ai25 * Security/Admin   : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License          : None specified (no license file in this repository)34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243import { expect, test } from "@playwright/test";44import { FIXTURES, MOBILE_LINEUP } from "./catalog";4546/** Runs on a phone and on a tablet viewport (see playwright.config.ts). */47test("no horizontal overflow, readable hero, reachable navigation", async ({ page, viewport }) => {48  for (const path of ["/", "/downloads", "/apps", "/apps/scan", "/apps/monitor", "/compare", "/ecosystem", "/fr"]) {49    await page.goto(path);50    const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);51    expect(overflow, `${path} overflows by ${overflow}px`).toBeLessThanOrEqual(0);52  }53  await page.goto("/");54  await expect(page.getByRole("heading", { level: 1 })).toBeVisible();55  if (viewport!.width < 768) {56    await page.getByRole("button", { name: "Menu" }).click();57    await page.getByRole("navigation", { name: "Primary" }).getByRole("link", { name: "Apps" }).click();58  } else await page.getByRole("navigation", { name: "Primary" }).getByRole("link", { name: "Apps" }).click();59  await expect(page).toHaveURL(/\/apps$/);60});6162test("touch: first tap on an orbiting icon selects it, the card opens the page", async ({ page }) => {63  await page.goto("/");64  await page.getByTestId("universe").scrollIntoViewIfNeeded();65  await page.getByRole("button", { name: "Pause motion" }).click();66  await page.getByTestId("orb-calc").tap();67  await expect(page).toHaveURL(/\/$/);68  await expect(page.getByTestId("universe-detail")).toContainText("ORIX Calc");69  await page.getByTestId("universe-detail").getByRole("link").tap();70  await expect(page).toHaveURL(/\/apps\/calc$/);71});7273test("catalog controls and download actions are comfortable touch targets", async ({ page }) => {74  await page.goto("/apps");75  await page.getByTestId("platform-ios").tap();76  await expect(page.getByTestId("app-card")).toHaveCount(MOBILE_LINEUP.length + FIXTURES.ios.length);77  for (const chip of await page.locator(".chip").all()) expect((await chip.boundingBox())!.height).toBeGreaterThanOrEqual(36);78  await page.goto("/apps/fixture-mac");79  const btn = page.getByTestId("dl-mac").getByRole("link", { name: "Download for Mac" });80  expect((await btn.boundingBox())!.height).toBeGreaterThanOrEqual(44);81});8283test("screenshots are sized for the screen and lazy-loaded", async ({ page }) => {84  await page.goto("/apps/audio");85  const imgs = page.getByTestId("gallery").locator("img");86  await expect(imgs).toHaveCount(10);87  expect(await imgs.nth(6).getAttribute("loading")).toBe("lazy");88  expect(await imgs.first().getAttribute("srcset")).toContain("/_next/image");89});90
Files main
Menu

Theme