|
| 1 | +import { expect, story } from "../../storybook/playwright/story" |
| 2 | + |
| 3 | +story("settings menu reconnect retains its prompt handler across server updates", async ({ mount, page }) => { |
| 4 | + const component = await mount("app-dialog-ssh--settings-reconnect") |
| 5 | + await component.getByRole("button", { name: "More options" }).click() |
| 6 | + await page.getByRole("menuitem", { name: "Connect", exact: true }).click() |
| 7 | + const dialog = page.getByRole("dialog") |
| 8 | + await expect(dialog.getByRole("textbox")).toBeVisible() |
| 9 | + await dialog.getByRole("textbox").fill("fixture-password") |
| 10 | + await dialog.getByRole("button", { name: "Continue" }).click() |
| 11 | + await expect(dialog.getByRole("textbox", { name: "Verification code:" })).toBeVisible() |
| 12 | + await dialog.getByRole("textbox").fill("123456") |
| 13 | + await dialog.getByRole("button", { name: "Continue" }).click() |
| 14 | + await expect(dialog).toHaveCount(0) |
| 15 | + await expect(component.getByRole("button", { name: "Authenticate", exact: true })).toHaveCount(0) |
| 16 | +}) |
| 17 | + |
| 18 | +story("cancelling a version mismatch permits reconnecting again", async ({ mount, page }) => { |
| 19 | + const component = await mount("app-dialog-ssh--incompatible-session") |
| 20 | + await component.getByRole("button", { name: "Reconnect", exact: true }).click() |
| 21 | + const dialog = page.getByRole("dialog") |
| 22 | + await expect(dialog.getByRole("alert")).toBeVisible() |
| 23 | + await dialog.getByRole("button", { name: "Cancel", exact: true }).click() |
| 24 | + await expect(dialog).toHaveCount(0) |
| 25 | + await component.getByRole("button", { name: "Reconnect", exact: true }).click() |
| 26 | + await expect(dialog.getByRole("alert")).toBeVisible() |
| 27 | + await dialog.getByRole("button", { name: "Cancel", exact: true }).click() |
| 28 | + await expect(dialog).toHaveCount(0) |
| 29 | +}) |
| 30 | + |
| 31 | +story("adding a server keeps all SSH challenges in the original connection dialog", async ({ mount, page }) => { |
| 32 | + await mount("app-dialog-ssh--host") |
| 33 | + const dialog = page.getByRole("dialog") |
| 34 | + await dialog.getByRole("textbox", { name: "Host or SSH command" }).fill("ssh devbox") |
| 35 | + await dialog.getByRole("button", { name: "Add server", exact: true }).click() |
| 36 | + await expect(dialog).toHaveCount(1) |
| 37 | + await expect(dialog.getByRole("button", { name: "Cancel", exact: true })).toBeFocused() |
| 38 | + await dialog.getByRole("button", { name: "Trust and connect" }).click() |
| 39 | + await dialog.getByRole("textbox").fill("fixture-password") |
| 40 | + await dialog.getByRole("button", { name: "Continue", exact: true }).click() |
| 41 | + await dialog.getByRole("textbox", { name: "Verification code:" }).fill("123456") |
| 42 | + await dialog.getByRole("button", { name: "Continue", exact: true }).click() |
| 43 | + await expect(dialog).toHaveCount(0) |
| 44 | +}) |
| 45 | + |
| 46 | +story("updating an incompatible connection continues authentication in the same dialog", async ({ mount, page }) => { |
| 47 | + const component = await mount("app-dialog-ssh--incompatible-session") |
| 48 | + await component.getByRole("button", { name: "Reconnect", exact: true }).click() |
| 49 | + const dialog = page.getByRole("dialog") |
| 50 | + await dialog.getByRole("button", { name: "Update and reconnect", exact: true }).click() |
| 51 | + await expect(dialog).toHaveCount(1) |
| 52 | + await dialog.getByRole("textbox").fill("fixture-password") |
| 53 | + await dialog.getByRole("button", { name: "Continue", exact: true }).click() |
| 54 | + await dialog.getByRole("textbox", { name: "Verification code:" }).fill("123456") |
| 55 | + await dialog.getByRole("button", { name: "Continue", exact: true }).click() |
| 56 | + await expect(dialog).toHaveCount(0) |
| 57 | + await expect(component.getByText("Session connected")).toBeVisible() |
| 58 | +}) |
| 59 | + |
| 60 | +story("key-based reconnect completes without opening an authentication dialog", async ({ mount, page }) => { |
| 61 | + const component = await mount("app-dialog-ssh--key-reconnect") |
| 62 | + await component.getByRole("button", { name: "Reconnect", exact: true }).click() |
| 63 | + await expect(component.getByRole("button", { name: "Connecting to SSH server" })).toBeDisabled() |
| 64 | + await expect(page.getByRole("dialog")).toHaveCount(0) |
| 65 | + await expect(component.getByText("Session connected")).toBeVisible() |
| 66 | + await expect(page.getByRole("dialog")).toHaveCount(0) |
| 67 | +}) |
0 commit comments