mirror of
https://github.com/meshtastic/web.git
synced 2026-08-01 15:36:28 -04:00
* chore(deps-dev): bump oxfmt from 0.58.0 to 0.59.0 Bumps [oxfmt](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxfmt) from 0.58.0 to 0.59.0. - [Release notes](https://github.com/oxc-project/oxc/releases) - [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxfmt/CHANGELOG.md) - [Commits](https://github.com/oxc-project/oxc/commits/oxfmt_v0.59.0/npm/oxfmt) --- updated-dependencies: - dependency-name: oxfmt dependency-version: 0.59.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * chore: fix formatting issues for oxfmt 0.59.0 * fix: add vitest.config.ts for packages/ui to avoid unplugin-dts TypeScript 7 crash --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Dan Ditomaso <dan.ditomaso@gmail.com> Co-authored-by: Hunter Thornsberry <hunter@hunterthornsberry.com>
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import { expect, type Page } from "@playwright/test";
|
|
|
|
/**
|
|
* Drives the "Add Connection" dialog to connect to a device over the HTTP(S)
|
|
* phone API. The dialog defaults to the HTTP tab; "Save connection" only enables
|
|
* after a successful "Test connection". On success the app navigates to
|
|
* /messages/broadcast/0.
|
|
*/
|
|
export class ConnectionPage {
|
|
constructor(private readonly page: Page) {}
|
|
|
|
async connectHttp(opts: {
|
|
host: string;
|
|
tls: boolean;
|
|
name?: string;
|
|
}): Promise<void> {
|
|
const { host, tls, name = "E2E Device" } = opts;
|
|
const page = this.page;
|
|
|
|
await page.goto("/");
|
|
await page.getByRole("button", { name: "Add Connection" }).first().click();
|
|
|
|
const dialog = page.getByRole("dialog");
|
|
await expect(dialog).toBeVisible();
|
|
// HTTP is the default tab, but click it to be explicit/robust.
|
|
await dialog.getByRole("tab", { name: "HTTP" }).click();
|
|
|
|
await dialog.locator("#name-http").fill(name);
|
|
await dialog.locator("#url").fill(host);
|
|
|
|
const httpsSwitch = dialog.getByRole("switch");
|
|
const isChecked =
|
|
(await httpsSwitch.getAttribute("aria-checked")) === "true";
|
|
if (tls !== isChecked) {
|
|
await httpsSwitch.click();
|
|
}
|
|
|
|
await dialog.getByRole("button", { name: "Test connection" }).click();
|
|
|
|
const save = dialog.getByRole("button", { name: "Save connection" });
|
|
await expect(
|
|
save,
|
|
"Save enables only after the device is reachable",
|
|
).toBeEnabled({
|
|
timeout: 20_000,
|
|
});
|
|
await save.click();
|
|
|
|
await expect(page).toHaveURL(/\/messages\/broadcast\/0/, {
|
|
timeout: 60_000,
|
|
});
|
|
}
|
|
}
|