Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: [main]
branches: [main, debug/clipboard-flake-matrix]
pull_request:

# A new push to the same PR supersedes the run in flight; main is never cancelled.
Expand Down Expand Up @@ -64,7 +64,8 @@ jobs:
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
# DEBUG (throwaway): six copies of shard 3 to catch the clipboard flake
copy: [1, 2, 3, 4, 5, 6]
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
Expand All @@ -87,7 +88,7 @@ jobs:
echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns >/dev/null
# `bun run test`, not `bun test`: the suite is vitest, and `bun test`
# would run Bun's own runner against the same files
- run: bun run test -- --shard=${{ matrix.shard }}/${{ strategy.job-total }}
- run: bun run test -- --shard=3/4

# One status that stands for every shard, so a required check or a merge
# queue names "tests" rather than each "test (N)"; renumbering the matrix
Expand Down
11 changes: 10 additions & 1 deletion tests/canvasClipboardBrowser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,16 @@ describe.skipIf(!findBrowserPath() || !CLIPBOARD_IS_RELIABLE)('canvas clipboard
await chord('c')
await chord('v')
await expect.poll(() => count('section, p')).toBe(4)
expect(await page.evaluate(() => window.canvasClipboardHarness.picked())).toHaveLength(2)
const picked = await page.evaluate(() => window.canvasClipboardHarness.picked())
if (picked.length !== 2) {
/* DEBUG (throwaway) */
const log = await page.evaluate(() => (window as unknown as { __pickLog: unknown[] }).__pickLog)
const later = await new Promise((r) => setTimeout(r, 500)).then(() =>
page.evaluate(() => window.canvasClipboardHarness.picked()),
)
console.log('PICKLOG ' + JSON.stringify({ picked, later, log }, null, 1))
}
expect(picked).toHaveLength(2)
})

it('copies through the element menu and pastes with the keyboard', async () => {
Expand Down
14 changes: 14 additions & 0 deletions tests/fixtures/canvasClipboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@
import { clearHistory, undo } from '/src/lib/history.ts'
import '/src/styles.css'

/* DEBUG (throwaway): every change to the picked elements, with who made it */
window.__pickLog = []
useStore.subscribe((state, prev) => {
const now = JSON.stringify(pickedSelectors(state))
const before = JSON.stringify(pickedSelectors(prev))
if (now === before) return
window.__pickLog.push({
t: Math.round(performance.now()),
from: before,
to: now,
html: state.canvas?.frames[0]?.html.length,
stack: (new Error().stack || '').split('\n').slice(2, 14).join(' | '),
})
})
window.canvasClipboardHarness = {
seed: (frames, role = 'edit') => {
clearHistory()
Expand Down
Loading