mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 13:05:14 +03:00
471 lines
21 KiB
TypeScript
471 lines
21 KiB
TypeScript
import { expect, test, type Page } from "@playwright/test"
|
|
import { fileDiff, openSession } from "../utils/workspace"
|
|
import { openReviewLauncher } from "../utils/side-panel"
|
|
import { base64Encode } from "@opencode/util/encode"
|
|
|
|
test("review content stays aligned with the side region in both directions", async ({ page }) => {
|
|
await page.setViewportSize({ width: 1400, height: 900 })
|
|
|
|
// A large nested branch diff; its first file is the sentinel that proves the virtualized tree stays mounted.
|
|
const diffs = [
|
|
fileDiff(".github/actions/setup-bun/action.yml", { additions: 7 }),
|
|
...Array.from({ length: 2_739 }, (_, index) =>
|
|
fileDiff(
|
|
`src/branch/d${String(Math.floor(index / 100)).padStart(5, "0")}/generated-${String(index).padStart(4, "0")}.ts`,
|
|
{ additions: 100, loaded: false },
|
|
),
|
|
),
|
|
]
|
|
|
|
await openSession(page, { name: "SideStack", vcsDiff: diffs })
|
|
const toggle = page.getByRole("button", { name: "Toggle review" })
|
|
await toggle.click()
|
|
await openReviewLauncher(page.locator("#review-panel"))
|
|
await expectTreeSentinel(page)
|
|
|
|
for (const direction of ["ltr", "rtl"] as const) {
|
|
await page.evaluate((direction) => (document.documentElement.dir = direction), direction)
|
|
await expect.poll(() => sideContentOffset(page, direction)).toBeLessThanOrEqual(1)
|
|
}
|
|
|
|
await page.reload()
|
|
await expect(page.locator("#review-panel")).toBeVisible()
|
|
await expectTreeSentinel(page)
|
|
})
|
|
|
|
test("new tab selection and closing stay in the focused pane", async ({ page }) => {
|
|
await page.setViewportSize({ width: 1440, height: 900 })
|
|
const directory = "C:/OpenCode/PaneNewTabs"
|
|
const key = `local\u0000${base64Encode(directory)}/ses_panenewtabs`
|
|
|
|
await openSession(page, {
|
|
name: "PaneNewTabs",
|
|
fileList: () => [],
|
|
fileContent: (path) => ({ type: "text", content: `contents:${path}` }),
|
|
seed: {
|
|
panes: { ses_panenewtabs: { review: true } },
|
|
storage: {
|
|
"opencode.global.dat:layout": {
|
|
sessionTabs: {
|
|
[key]: {
|
|
all: ["file://README.md", "file://notes.md"],
|
|
active: "file://README.md",
|
|
panes: { "file://notes.md": "split" },
|
|
selected: { side: "file://README.md", split: "file://notes.md" },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
const side = page.locator('[data-pane-content="side"]')
|
|
const split = page.locator('[data-pane-content="split"]')
|
|
const mod = (await page.evaluate(() => /Mac|iPhone|iPad/.test(navigator.platform))) ? "Meta" : "Control"
|
|
const sideTabs = side.getByRole("tab", { name: "New tab", exact: true })
|
|
const splitTabs = split.getByRole("tab", { name: "New tab", exact: true })
|
|
await expect(side.getByRole("tab", { name: "README.md", exact: true })).toHaveAttribute("aria-selected", "true")
|
|
await expect(split.getByRole("tab", { name: "notes.md", exact: true })).toHaveAttribute("aria-selected", "true")
|
|
|
|
await side.getByRole("button", { name: "Add tab", exact: true }).click()
|
|
await expect(sideTabs).toHaveCount(1)
|
|
await side.getByRole("button", { name: "Add tab", exact: true }).click()
|
|
await expect(sideTabs).toHaveCount(2)
|
|
// Pick the older New tab, so a fallback to the newest one cannot pass unnoticed.
|
|
await sideTabs.nth(0).click()
|
|
await expect(sideTabs.nth(0)).toHaveAttribute("aria-selected", "true")
|
|
|
|
await split.getByRole("button", { name: "Add tab", exact: true }).click()
|
|
await expect(splitTabs).toHaveAttribute("aria-selected", "true")
|
|
await expect(sideTabs.nth(0)).toHaveAttribute("aria-selected", "true")
|
|
await expect(sideTabs.nth(1)).toHaveAttribute("aria-selected", "false")
|
|
|
|
await splitTabs.click()
|
|
await splitTabs.press(`${mod}+w`)
|
|
await expect(splitTabs).toHaveCount(0)
|
|
await expect(split.getByRole("tab", { name: "notes.md", exact: true })).toHaveAttribute("aria-selected", "true")
|
|
await expect(sideTabs).toHaveCount(2)
|
|
await expect(sideTabs.nth(0)).toHaveAttribute("aria-selected", "true")
|
|
|
|
// With focus on the region itself, close falls back to the active pane, not another pane's New tab.
|
|
await split.getByRole("tab", { name: "notes.md", exact: true }).click()
|
|
await page.locator("#review-panel").focus()
|
|
await page.keyboard.press(`${mod}+w`)
|
|
await expect(split).toHaveCount(0)
|
|
await expect(sideTabs).toHaveCount(2)
|
|
await expect(sideTabs.nth(0)).toHaveAttribute("aria-selected", "true")
|
|
})
|
|
|
|
test("closing another pane's tab keeps the side pane's New tab", async ({ page }) => {
|
|
await page.setViewportSize({ width: 1440, height: 900 })
|
|
const directory = "C:/OpenCode/OtherPaneClose"
|
|
const key = `local\u0000${base64Encode(directory)}/ses_otherpaneclose`
|
|
|
|
await openSession(page, {
|
|
name: "OtherPaneClose",
|
|
fileList: () => [],
|
|
fileContent: (path) => ({ type: "text", content: `contents:${path}` }),
|
|
seed: {
|
|
panes: { ses_otherpaneclose: { review: true } },
|
|
storage: {
|
|
"opencode.global.dat:layout": {
|
|
sessionTabs: {
|
|
// The side pane selects nothing of its own, so it shows its fallback tab while the split pane is active.
|
|
[key]: {
|
|
all: ["review:changes", "file://README.md", "file://notes.md"],
|
|
active: "file://notes.md",
|
|
panes: { "file://notes.md": "split" },
|
|
selected: { split: "file://notes.md" },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
const side = page.locator('[data-pane-content="side"]')
|
|
const split = page.locator('[data-pane-content="split"]')
|
|
const sideNewTab = side.getByRole("tab", { name: "New tab", exact: true })
|
|
await expect(side.getByRole("tab", { name: "README.md", exact: true })).toHaveAttribute("aria-selected", "true")
|
|
|
|
await side.getByRole("button", { name: "Add tab", exact: true }).click()
|
|
await expect(sideNewTab).toHaveAttribute("aria-selected", "true")
|
|
|
|
// The selection falls back to the side pane's first tab, which is already listed there: no launcher opened it.
|
|
await split.getByRole("tab", { name: "notes.md", exact: true }).hover()
|
|
await split
|
|
.locator('div[data-value="file://notes.md"]')
|
|
.getByRole("button", { name: "Close tab", exact: true })
|
|
.click()
|
|
await expect(split).toHaveCount(0)
|
|
await expect(sideNewTab).toHaveCount(1)
|
|
await expect(sideNewTab).toHaveAttribute("aria-selected", "true")
|
|
})
|
|
|
|
test("closing the last New tab closes the side region, and only a New tab lists the launchers", async ({ page }) => {
|
|
await page.setViewportSize({ width: 1440, height: 900 })
|
|
await openSession(page, { name: "LastNewTab", seed: { panes: { ses_lastnewtab: { review: true } } } })
|
|
|
|
const panel = page.locator("#review-panel")
|
|
const toggle = page.getByRole("button", { name: "Toggle review", exact: true })
|
|
const newTab = panel.getByRole("tab", { name: "New tab", exact: true })
|
|
const review = panel.getByRole("button", { name: /^Review/ })
|
|
|
|
// An empty side region opens on a New tab listing the launchers.
|
|
await expect(newTab).toHaveAttribute("aria-selected", "true")
|
|
await expect(review).toBeVisible()
|
|
|
|
// Closing it leaves no tab, so the region closes rather than listing the launchers without one.
|
|
await newTab.locator("..").getByRole("button", { name: "Close tab" }).click()
|
|
await expect(toggle).toHaveAttribute("aria-expanded", "false")
|
|
|
|
await toggle.click()
|
|
await expect(newTab).toHaveAttribute("aria-selected", "true")
|
|
await expect(review).toBeVisible()
|
|
|
|
// Closing and reopening the region keeps its one New tab instead of adding another each time.
|
|
for (const _ of [1, 2, 3]) {
|
|
await toggle.click()
|
|
await expect(toggle).toHaveAttribute("aria-expanded", "false")
|
|
await toggle.click()
|
|
await expect(toggle).toHaveAttribute("aria-expanded", "true")
|
|
await expect(newTab).toHaveCount(1)
|
|
}
|
|
})
|
|
|
|
test("New tabs stay when a launcher in another one opens a tab, or when the tab before them closes", async ({
|
|
page,
|
|
}) => {
|
|
await page.setViewportSize({ width: 1440, height: 900 })
|
|
await openSession(page, { name: "ManyNewTabs", seed: { panes: { ses_manynewtabs: { review: true } } } })
|
|
|
|
const panel = page.locator("#review-panel")
|
|
const toggle = page.getByRole("button", { name: "Toggle review", exact: true })
|
|
const newTabs = panel.getByRole("tab", { name: "New tab", exact: true })
|
|
const review = panel.getByRole("tab", { name: "Review", exact: true })
|
|
|
|
await expect(newTabs).toHaveCount(1)
|
|
await panel.getByRole("button", { name: "Add tab", exact: true }).click()
|
|
await panel.getByRole("button", { name: "Add tab", exact: true }).click()
|
|
await expect(newTabs).toHaveCount(3)
|
|
await expect(newTabs.nth(2)).toHaveAttribute("aria-selected", "true")
|
|
|
|
// A launcher in the middle New tab replaces only that one.
|
|
await newTabs.nth(1).click()
|
|
await openReviewLauncher(panel)
|
|
await expect(review).toHaveAttribute("aria-selected", "true")
|
|
await expect(newTabs).toHaveCount(2)
|
|
|
|
// Selecting another tab keeps the New tabs too.
|
|
await newTabs.nth(0).click()
|
|
await expect(newTabs.nth(0)).toHaveAttribute("aria-selected", "true")
|
|
await review.click()
|
|
await expect(review).toHaveAttribute("aria-selected", "true")
|
|
await expect(newTabs).toHaveCount(2)
|
|
|
|
// Closing the strip's first tab shows a New tab instead of closing the region.
|
|
await review.hover()
|
|
await panel
|
|
.locator('div[data-value="review:changes"]')
|
|
.getByRole("button", { name: "Close tab", exact: true })
|
|
.click()
|
|
await expect(review).toHaveCount(0)
|
|
await expect(toggle).toHaveAttribute("aria-expanded", "true")
|
|
await expect(newTabs).toHaveCount(2)
|
|
await expect(newTabs.nth(1)).toHaveAttribute("aria-selected", "true")
|
|
|
|
// The region closes with its last New tab.
|
|
await newTabs.nth(0).click({ button: "middle" })
|
|
await expect(newTabs).toHaveCount(1)
|
|
await newTabs.click({ button: "middle" })
|
|
await expect(toggle).toHaveAttribute("aria-expanded", "false")
|
|
})
|
|
|
|
test("tabs in a narrow side strip shrink to keep their close buttons, and a tab's menu closes the others or those to its right", async ({
|
|
page,
|
|
}) => {
|
|
await page.setViewportSize({ width: 1000, height: 700 })
|
|
const directory = "C:/OpenCode/NarrowStrip"
|
|
const key = `local\u0000${base64Encode(directory)}/ses_narrowstrip`
|
|
const files = ["a.md", "a-file-name-long-enough-to-overflow-the-side-strip-by-itself.md", "b.md"]
|
|
|
|
await openSession(page, {
|
|
name: "NarrowStrip",
|
|
fileList: () => [],
|
|
fileContent: (path) => ({ type: "text", content: `contents:${path}` }),
|
|
seed: {
|
|
panes: { ses_narrowstrip: { review: true, sessionWidth: 640 } },
|
|
storage: {
|
|
"opencode.global.dat:layout": {
|
|
sessionTabs: { [key]: { all: files.map((file) => `file://${file}`), active: `file://${files[1]}` } },
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
const side = page.locator('[data-pane-content="side"]')
|
|
const add = side.getByRole("button", { name: "Add tab", exact: true })
|
|
await expect(side.getByRole("tab", { name: files[1], exact: true })).toHaveAttribute("aria-selected", "true")
|
|
|
|
// Every tab's close button stays left of "+", instead of the strip scrolling it away under its edge fade.
|
|
const end = (await add.boundingBox())!.x
|
|
const closes = side.locator('[data-pane-strip="side"] [data-slot="tabs-trigger-close-button"]')
|
|
await expect(closes).toHaveCount(files.length)
|
|
|
|
for (const close of await closes.all()) {
|
|
const box = (await close.boundingBox())!
|
|
expect(box.x + box.width).toBeLessThanOrEqual(end)
|
|
}
|
|
|
|
await side.getByRole("tab", { name: files[1], exact: true }).click({ button: "right" })
|
|
await page.getByRole("menuitem", { name: "Close tabs to the right", exact: true }).click()
|
|
await expect(side.getByRole("tab")).toHaveText(["a.md", files[1]])
|
|
|
|
await side.getByRole("tab", { name: "a.md", exact: true }).click({ button: "right" })
|
|
await page.getByRole("menuitem", { name: "Close other tabs", exact: true }).click()
|
|
await expect(side.getByRole("tab")).toHaveCount(1)
|
|
await expect(side.getByRole("tab", { name: "a.md", exact: true })).toHaveAttribute("aria-selected", "true")
|
|
|
|
// With nothing else to close, the menu offers only the tab itself.
|
|
await side.getByRole("tab", { name: "a.md", exact: true }).click({ button: "right" })
|
|
await expect(page.getByRole("menuitem", { name: "Close other tabs", exact: true })).toBeDisabled()
|
|
await expect(page.getByRole("menuitem", { name: "Close tabs to the right", exact: true })).toBeDisabled()
|
|
await page.getByRole("menuitem", { name: "Close tab", exact: true }).click()
|
|
await expect(side.getByRole("tab", { name: "a.md", exact: true })).toHaveCount(0)
|
|
})
|
|
|
|
test("a reopened side tab returns to where it closed", async ({ page }) => {
|
|
await page.setViewportSize({ width: 1440, height: 900 })
|
|
const directory = "C:/OpenCode/ReopenPlace"
|
|
const key = `local\u0000${base64Encode(directory)}/ses_reopenplace`
|
|
const files = ["a.md", "b.md", "c.md"]
|
|
|
|
await openSession(page, {
|
|
name: "ReopenPlace",
|
|
fileList: () => [],
|
|
fileContent: (path) => ({ type: "text", content: `contents:${path}` }),
|
|
seed: {
|
|
panes: { ses_reopenplace: { review: true } },
|
|
storage: {
|
|
"opencode.global.dat:layout": {
|
|
sessionTabs: { [key]: { all: files.map((file) => `file://${file}`), active: "file://b.md" } },
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
const side = page.locator('[data-pane-content="side"]')
|
|
await expect(side.getByRole("tab", { name: "b.md", exact: true })).toHaveAttribute("aria-selected", "true")
|
|
|
|
await page.getByRole("textbox", { name: "Prompt", exact: true }).click()
|
|
await page.keyboard.press("ControlOrMeta+w")
|
|
await expect(side.getByRole("tab")).toHaveText(["a.md", "c.md"])
|
|
|
|
await page.keyboard.press("ControlOrMeta+Shift+t")
|
|
await expect(side.getByRole("tab")).toHaveText(["a.md", "b.md", "c.md"])
|
|
await expect(side.getByRole("tab", { name: "b.md", exact: true })).toHaveAttribute("aria-selected", "true")
|
|
})
|
|
|
|
async function expectTreeSentinel(page: Page) {
|
|
const tree = page.locator('#review-panel [data-component="file-tree-v2"]')
|
|
await expect(tree.getByRole("treeitem", { name: "action.yml" })).toBeVisible()
|
|
const rows = await tree.locator('[data-type="item"]').count()
|
|
expect(rows).toBeGreaterThan(0)
|
|
expect(rows).toBeLessThanOrEqual(60)
|
|
}
|
|
|
|
function sideContentOffset(page: Page, direction: "ltr" | "rtl") {
|
|
return page.evaluate((direction) => {
|
|
const frame = document.querySelector('[data-slot="session-side-panel-presence"]')!.getBoundingClientRect()
|
|
const content = document.querySelector('[data-slot="session-side-panel-content"]')!.getBoundingClientRect()
|
|
|
|
return direction === "rtl" ? Math.abs(frame.right - content.right) : Math.abs(frame.left - content.left)
|
|
}, direction)
|
|
}
|
|
|
|
test("the new tab view lists recently closed tabs, expands to the rest, and keeps them across a reload", async ({
|
|
page,
|
|
}) => {
|
|
await page.setViewportSize({ width: 1440, height: 900 })
|
|
const directory = "C:/OpenCode/RecentlyClosed"
|
|
const key = `local\u0000${base64Encode(directory)}/ses_recentlyclosed`
|
|
|
|
// Twelve files closed earlier, newest first, as the app stores them beside the strip.
|
|
const closed = Array.from({ length: 12 }, (_, index) => ({
|
|
key: `file://src/closed-${String(index).padStart(2, "0")}.ts`,
|
|
title: `closed-${String(index).padStart(2, "0")}.ts`,
|
|
file: `src/closed-${String(index).padStart(2, "0")}.ts`,
|
|
closed: 1_000 - index,
|
|
}))
|
|
|
|
await openSession(page, {
|
|
name: "RecentlyClosed",
|
|
fileContent: (path) => ({ type: "text", content: `contents:${path}` }),
|
|
seed: {
|
|
panes: { ses_recentlyclosed: { review: true } },
|
|
storage: {
|
|
"opencode.global.dat:layout": {
|
|
sessionTabs: { [key]: { all: ["file://README.md"], active: "file://README.md" } },
|
|
sessionView: { [key]: { scroll: {}, closed } },
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
const panel = page.locator("#review-panel")
|
|
const recent = panel.getByRole("region", { name: "Recently closed", exact: true })
|
|
const rows = recent.locator('[data-slot="side-recently-closed-row"]')
|
|
const toggle = page.getByRole("button", { name: "Toggle review", exact: true })
|
|
|
|
// The latest five, then all of them once expanded.
|
|
await panel.getByRole("button", { name: "Add tab", exact: true }).click()
|
|
await expect(rows).toHaveCount(5)
|
|
await expect(rows.first()).toContainText("closed-00.ts")
|
|
const more = recent.getByRole("button", { name: "Show more", exact: true })
|
|
await more.focus()
|
|
await more.press("Enter")
|
|
await expect(rows).toHaveCount(12)
|
|
await expect(rows.filter({ hasText: "closed-05.ts" })).toBeFocused()
|
|
await expect(recent.getByRole("button", { name: "Show more", exact: true })).toHaveCount(0)
|
|
await expect(recent.getByRole("button", { name: "Show less", exact: true })).toHaveCount(0)
|
|
|
|
// Closing the last tab keeps the region open on the New tab beside it, which lists that tab first.
|
|
const readme = panel.getByRole("tab", { name: "README.md" })
|
|
await readme.click()
|
|
await expect(panel.getByRole("tab", { name: "New tab", exact: true })).toHaveAttribute("aria-selected", "false")
|
|
await readme.locator("..").getByRole("button", { name: "Close tab" }).click()
|
|
await expect(toggle).toHaveAttribute("aria-expanded", "true")
|
|
await expect(panel.getByRole("tab", { name: "New tab", exact: true })).toHaveAttribute("aria-selected", "true")
|
|
await expect(rows.first()).toContainText("README.md")
|
|
|
|
// The list survives a reload, and reopening a row brings its tab back and takes it off the list.
|
|
await page.reload()
|
|
await expect(rows.first()).toContainText("README.md")
|
|
await rows.first().click()
|
|
await expect(panel.getByRole("tab", { name: "README.md" })).toHaveAttribute("aria-selected", "true")
|
|
await panel.getByRole("button", { name: "Add tab", exact: true }).click()
|
|
await expect(rows.first()).toContainText("closed-00.ts")
|
|
await expect(recent).not.toContainText("README.md")
|
|
})
|
|
|
|
test("Mod+F finds in Markdown and HTML previews with the code view's find bar", async ({ page }) => {
|
|
await page.setViewportSize({ width: 1440, height: 900 })
|
|
const directory = "C:/OpenCode/PreviewFind"
|
|
const key = `local\u0000${base64Encode(directory)}/ses_previewfind`
|
|
|
|
const files = new Map([
|
|
["notes.md", "# Needle notes\n\nOne needle here.\n\nAnother **needle** there."],
|
|
["diagram.mmd", "flowchart TD\n A[First needle] --> B[Last needle]"],
|
|
[
|
|
"page.html",
|
|
"<!-- note -->\n<!doctype html><title>Page</title><p>First needle</p><p style='margin-top:2000px'>Last needle</p>",
|
|
],
|
|
])
|
|
|
|
await openSession(page, {
|
|
name: "PreviewFind",
|
|
fileList: () => [],
|
|
fileContent: (path) => ({ type: "text", content: files.get(path.split("/").at(-1) ?? "") ?? "" }),
|
|
seed: {
|
|
panes: { ses_previewfind: { review: true } },
|
|
storage: {
|
|
"opencode.global.dat:layout": {
|
|
sessionTabs: {
|
|
[key]: { all: ["file://notes.md", "file://diagram.mmd", "file://page.html"], active: "file://notes.md" },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
const side = page.locator('[data-pane-content="side"]')
|
|
const find = page.getByRole("textbox", { name: "Find" })
|
|
const mod = await page.evaluate(() => (/(Mac|iPod|iPhone|iPad)/.test(navigator.platform) ? "Meta" : "Control"))
|
|
await side.getByText("One needle here.").click()
|
|
await page.keyboard.press(`${mod}+f`)
|
|
await expect(find).toBeFocused()
|
|
await find.fill("needle")
|
|
await expect(page.getByText("1/3", { exact: true })).toBeVisible()
|
|
await find.press("Enter")
|
|
await expect(page.getByText("2/3", { exact: true })).toBeVisible()
|
|
await find.press("Shift+Enter")
|
|
await find.press("Shift+Enter")
|
|
await expect(page.getByText("3/3", { exact: true })).toBeVisible()
|
|
await find.press("Escape")
|
|
await expect(find).toHaveCount(0)
|
|
|
|
// A closed side panel keeps its preview mounted out of sight, so Mod+F opens no bar there.
|
|
const toggle = page.getByRole("button", { name: "Toggle review" })
|
|
await toggle.click()
|
|
await expect(side).toBeHidden()
|
|
await page.keyboard.press(`${mod}+f`)
|
|
await expect(find).toHaveCount(0)
|
|
await toggle.click()
|
|
|
|
// Mermaid keeps its source in a hidden code block; only the drawn labels count.
|
|
await side.getByRole("tab", { name: "diagram.mmd", exact: true }).click()
|
|
await side.locator("svg").getByText("First needle").click()
|
|
await page.keyboard.press(`${mod}+f`)
|
|
await expect(find).toBeFocused()
|
|
await find.fill("needle")
|
|
await expect(page.getByText("1/2", { exact: true })).toBeVisible()
|
|
await find.press("Escape")
|
|
await expect(find).toHaveCount(0)
|
|
|
|
// The HTML runs in a sandboxed frame; Mod+F pressed inside it still opens the bar.
|
|
await side.getByRole("tab", { name: "page.html", exact: true }).click()
|
|
const frame = side.frameLocator('iframe[data-file-find="frame"]')
|
|
await frame.getByText("First needle").click()
|
|
// The find script goes after the doctype, even behind a comment, so the page keeps standards mode.
|
|
expect(await frame.locator("html").evaluate(() => document.compatMode)).toBe("CSS1Compat")
|
|
await page.keyboard.press(`${mod}+f`)
|
|
await expect(find).toBeFocused()
|
|
await find.fill("needle")
|
|
await expect(page.getByText("1/2", { exact: true })).toBeVisible()
|
|
await find.press("Enter")
|
|
await expect(page.getByText("2/2", { exact: true })).toBeVisible()
|
|
await expect(frame.getByText("Last needle")).toBeInViewport()
|
|
await find.press("Escape")
|
|
await expect(find).toHaveCount(0)
|
|
})
|