Skip to content

Commit 5d21fbf

Browse files
committed
Run 33 browser tests no CI job named, in the WebKit job split into three shards
1 parent 248a0a1 commit 5d21fbf

5 files changed

Lines changed: 92 additions & 49 deletions

File tree

‎.github/ci-budgets.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"API spec": 3,
88
"native types": 3,
99
"app (real browser)": 8,
10-
"app (real browser, WebKit)": 12,
10+
"app (real browser, WebKit) (shard N of N)": 15,
1111
"app (real browser, desktop setup window)": 12,
1212
"tests (shard N of N)": 7,
1313
"tests": 2,

‎.github/workflows/ci.yml‎

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,19 @@ jobs:
590590
# app. So on that runner the list runs two files at a time, each test gets 15 seconds by default
591591
# instead of 5, and the job has an hour. A test's own timeout and every bound a test asserts stay
592592
# as they are. On the larger runners nothing changes: eight workers, 5 seconds, 30 minutes.
593+
#
594+
# In shards, one runner each, as the suite is: one job took 16 to 17 minutes before the browser tests
595+
# no job had ever named were added, and every file is still named here once. `bun test --shard`
596+
# deals the sorted list out in turn. A run is as long as its slowest shard, and a shard as long as
597+
# its slowest file: artifacts-screens, about 11 minutes.
593598
app-browser-webkit:
594-
name: app (real browser, WebKit)
599+
name: app (real browser, WebKit) (shard ${{ matrix.shard }} of ${{ strategy.job-total }})
595600
needs: changes
601+
strategy:
602+
# Every shard runs to the end, so one red run names every failing test, as the suite's do.
603+
fail-fast: false
604+
matrix:
605+
shard: [1, 2, 3]
596606
# On a pull request, only when the app, what it imports or its tests change (scripts/ci-changes.ts,
597607
# app_browser_webkit). A merge group and main run it every time.
598608
if: needs.changes.outputs.app_browser_webkit == 'true'
@@ -607,6 +617,7 @@ jobs:
607617
PLAYWRIGHT_IMAGE: mcr.microsoft.com/playwright:v1.62.1-noble@sha256:dcc5531e97840b9b5e794f2814476b21571c5124a3fca2267d73041f56e7580e
608618
TEST_WORKERS: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository && '2' || '8' }}
609619
TEST_TIMEOUT_MS: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository && '15000' || '5000' }}
620+
TEST_SHARD: ${{ matrix.shard }}/${{ strategy.job-total }}
610621
steps:
611622
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
612623
with:
@@ -619,22 +630,41 @@ jobs:
619630
- run: |
620631
# One file per line, sorted: pull requests that each add a file then merge cleanly.
621632
files=(
633+
app/tests/access-requests-layout.test.tsx
622634
app/tests/add-custom-mcp-card-layout.test.tsx
623635
app/tests/admin-notion-one-press-layout.test.tsx
636+
app/tests/admin-path-layout.test.tsx
637+
app/tests/admin-request-notify-layout.test.tsx
638+
app/tests/another-account-layout.test.tsx
624639
app/tests/app-frame-skeleton-still.test.tsx
625640
app/tests/approval-answered-layout.test.tsx
626641
app/tests/approval-left-carry-on-browser.test.tsx
642+
app/tests/artifact-bridge-browser.test.ts
643+
app/tests/artifact-collab-browser.test.tsx
644+
app/tests/artifact-error-notice-layout.test.tsx
645+
app/tests/artifact-events-socket.test.ts
646+
app/tests/artifact-kinds-browser.test.tsx
647+
app/tests/artifact-sharing-screens-layout.test.tsx
627648
app/tests/artifact-sign-in-refusal-browser.test.tsx
649+
app/tests/artifact-tool-cards-browser.test.tsx
650+
app/tests/artifacts-kit.test.ts
651+
app/tests/artifacts-screens.test.tsx
652+
app/tests/board-row-layout.test.tsx
653+
app/tests/bot-file-links-browser.test.tsx
628654
app/tests/bot-long-instructions-layout.test.tsx
629655
app/tests/bot-screen-sharp.test.tsx
630656
app/tests/bots-panel-start-conversation.test.tsx
631657
app/tests/browse-apps-pages.test.tsx
658+
app/tests/browse-steps-layout.test.tsx
632659
app/tests/chunk-recovery.test.tsx
660+
app/tests/command-card-layout.test.tsx
633661
app/tests/composer-dictation-language.test.tsx
634662
app/tests/composer-keeps-draft-browser.test.tsx
635663
app/tests/composer-touch-return.test.tsx
636664
app/tests/computer-panel-phone-layout.test.tsx
637665
app/tests/computer-starting-browser.test.tsx
666+
app/tests/connected-bot-mistakes-layout.test.tsx
667+
app/tests/conversation-access-ended.test.tsx
638668
app/tests/conversation-kept-browser.test.tsx
639669
app/tests/conversation-reopen-end.test.tsx
640670
app/tests/conversation-reply-toolbar-layout.test.tsx
@@ -651,7 +681,9 @@ jobs:
651681
app/tests/move-to-cloud-settings.test.tsx
652682
app/tests/moved-apps-reconnect.test.tsx
653683
app/tests/moved-elsewhere.test.tsx
684+
app/tests/name-the-admins-layout.test.tsx
654685
app/tests/new-conversation-picked-model.test.tsx
686+
app/tests/offline-conversation-layout.test.tsx
655687
app/tests/one-press-connect-layout.test.tsx
656688
app/tests/organization-held-actions.test.tsx
657689
app/tests/organization-held-recovery.test.tsx
@@ -663,14 +695,21 @@ jobs:
663695
app/tests/organization-unavailable-chat.test.tsx
664696
app/tests/organization-unavailable-pages.test.tsx
665697
app/tests/people-lists.test.tsx
698+
app/tests/plan-notices-layout.test.tsx
699+
app/tests/queue-send-now-layout.test.tsx
666700
app/tests/rejoin-fresh-token-browser.test.tsx
667701
app/tests/renderer-crash.test.ts
668702
app/tests/roster-working.test.tsx
703+
app/tests/routine-run-now-layout.test.tsx
704+
app/tests/run-ended-unheard-layout.test.tsx
669705
app/tests/section-strip-routines.test.tsx
706+
app/tests/select-scrolls-layout.test.tsx
670707
app/tests/service-terms.test.tsx
671708
app/tests/settings-tool-cards-admin-layout.test.tsx
672709
app/tests/settings-tool-cards-core.test.tsx
673710
app/tests/settings-tool-cards-personal.test.tsx
711+
app/tests/sidebar-current-row.test.tsx
712+
app/tests/sidebar-window-buttons.test.tsx
674713
app/tests/sidebar-zoom-drag.test.tsx
675714
app/tests/sign-in-reconnect-layout.test.tsx
676715
app/tests/sign-in-returns-there.test.tsx
@@ -679,21 +718,27 @@ jobs:
679718
app/tests/step-rows-layout.test.tsx
680719
app/tests/stopped-command-layout.test.tsx
681720
app/tests/stopped-turn-dismiss-browser.test.tsx
721+
app/tests/strip-version-layout.test.tsx
682722
app/tests/table-export-browser.test.tsx
683723
app/tests/team-connections-directory-layout.test.tsx
684724
app/tests/too-many-follow-ups.test.tsx
725+
app/tests/trusted-types-build.test.ts
726+
app/tests/trusted-types.test.ts
685727
app/tests/web-push-browser.test.tsx
686728
app/tests/what-if-handle-browser.test.tsx
729+
app/tests/work-folded-layout.test.tsx
730+
app/tests/workspace-snapshots-layout.test.tsx
687731
)
688732
docker run --rm --ipc=host \
689733
--volume "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" --workdir "$GITHUB_WORKSPACE" \
690734
--volume "$(command -v bun):/usr/local/bin/bun:ro" \
691735
--env OPENBOT_APP_BROWSER=1 --env OPENBOT_APP_ENGINES=chromium,webkit \
692736
"$PLAYWRIGHT_IMAGE" \
693-
bun test --parallel="$TEST_WORKERS" --timeout="$TEST_TIMEOUT_MS" "${files[@]}"
737+
bun test --parallel="$TEST_WORKERS" --timeout="$TEST_TIMEOUT_MS" --shard="$TEST_SHARD" "${files[@]}"
694738
# Connect your AI's sign-in code, copied with one press and read back from WebKit's clipboard.
695-
# Only that test: the rest of the file runs in Chromium in the job above.
696-
- run: |
739+
# Only that test: the rest of the file runs in Chromium in the job above. Once, on the first shard.
740+
- if: matrix.shard == 1
741+
run: |
697742
docker run --rm --ipc=host \
698743
--volume "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" --workdir "$GITHUB_WORKSPACE" \
699744
--volume "$(command -v bun):/usr/local/bin/bun:ro" \

‎app/tests/run-ended-unheard-layout.test.tsx‎

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -622,16 +622,33 @@ async function shoot(page: Page, name: string) {
622622
* commands" (#2432). Which one depends on the turn, and the steps are inside either way.
623623
*/
624624
async function openTo(page: Page, said: string) {
625-
// The lines around the step, never the step's own line, which the test opens itself.
626-
const closed = page.locator("details:not([open])", {
627-
has: page.locator("details", { has: page.getByText(said) }),
628-
});
629625
await page
630626
.getByText(said)
631627
.first()
632628
.waitFor({ state: "attached", timeout: 15_000 });
633-
for (let tries = 0; tries < 4 && (await closed.count()) > 0; tries += 1)
634-
await closed.first().locator(":scope > summary").click();
629+
// The closed lines around the first place `said` is drawn, outermost first, never the line whose
630+
// own summary it is in (the step's own, which the test opens itself), marked to be clicked.
631+
const count = await page.evaluate((said) => {
632+
const walker = document.createTreeWalker(
633+
document.body,
634+
NodeFilter.SHOW_TEXT,
635+
);
636+
let found: Element | null = null;
637+
while (!found && walker.nextNode())
638+
if (walker.currentNode.textContent?.includes(said))
639+
found = walker.currentNode.parentElement;
640+
const own = found?.closest("summary")?.parentElement ?? null;
641+
const around: HTMLDetailsElement[] = [];
642+
for (let at = found?.parentElement ?? null; at; at = at.parentElement)
643+
if (at instanceof HTMLDetailsElement && at !== own && !at.open)
644+
around.unshift(at);
645+
around.forEach((line, index) => {
646+
line.dataset.openFirst = String(index);
647+
});
648+
return around.length;
649+
}, said);
650+
for (let index = 0; index < count; index += 1)
651+
await page.locator(`details[data-open-first="${index}"] > summary`).click();
635652
}
636653

637654
describe.skipIf(!asked)("a run whose end never reached this browser", () => {
@@ -703,10 +720,15 @@ describe.skipIf(!asked)("a run whose end never reached this browser", () => {
703720
expect(
704721
await page.getByRole("button", { name: "Carry on" }).count(),
705722
).toBe(0);
706-
// The command the phone never ran reads as not run, never as blocked.
707-
expect(await page.getByText("Didn't run a command").count()).toBe(
708-
1,
709-
);
723+
// The command the phone never ran reads as not run, never as blocked: as one row of a run
724+
// of steps it is named by what was tried, "Run a command", never "Ran", with "Didn't
725+
// work" beside it (`commandStepWords`, terminal-block.tsx).
726+
expect(
727+
await page
728+
.locator("summary", { hasText: /^Run a command(?!, not done)/ })
729+
.filter({ hasText: "Didn't work" })
730+
.count(),
731+
).toBe(1);
710732
expect(await page.getByText(/Blocked/).count()).toBe(0);
711733
expect(
712734
await page.evaluate(

‎scripts/ci-changes.test.ts‎

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,40 +1205,8 @@ describe("the rules name the jobs the workflows run", () => {
12051205
// this list as each is made to pass and named. A name left here once its file is named, or
12061206
// gone, fails too, so the list only shrinks.
12071207
const NOT_YET_IN_CI = [
1208-
"app/tests/access-requests-layout.test.tsx",
1209-
"app/tests/admin-path-layout.test.tsx",
1210-
"app/tests/admin-request-notify-layout.test.tsx",
1211-
"app/tests/another-account-layout.test.tsx",
1212-
"app/tests/artifact-bridge-browser.test.ts",
1213-
"app/tests/artifact-collab-browser.test.tsx",
1214-
"app/tests/artifact-error-notice-layout.test.tsx",
1215-
"app/tests/artifact-events-socket.test.ts",
1216-
"app/tests/artifact-kinds-browser.test.tsx",
1208+
// Loads the built print page the export worker serves: it waits for a build step in its job.
12171209
"app/tests/artifact-print-browser.test.ts",
1218-
"app/tests/artifact-sharing-screens-layout.test.tsx",
1219-
"app/tests/artifact-tool-cards-browser.test.tsx",
1220-
"app/tests/artifacts-kit.test.ts",
1221-
"app/tests/artifacts-screens.test.tsx",
1222-
"app/tests/board-row-layout.test.tsx",
1223-
"app/tests/bot-file-links-browser.test.tsx",
1224-
"app/tests/browse-steps-layout.test.tsx",
1225-
"app/tests/command-card-layout.test.tsx",
1226-
"app/tests/connected-bot-mistakes-layout.test.tsx",
1227-
"app/tests/conversation-access-ended.test.tsx",
1228-
"app/tests/name-the-admins-layout.test.tsx",
1229-
"app/tests/offline-conversation-layout.test.tsx",
1230-
"app/tests/plan-notices-layout.test.tsx",
1231-
"app/tests/queue-send-now-layout.test.tsx",
1232-
"app/tests/routine-run-now-layout.test.tsx",
1233-
"app/tests/run-ended-unheard-layout.test.tsx",
1234-
"app/tests/select-scrolls-layout.test.tsx",
1235-
"app/tests/sidebar-current-row.test.tsx",
1236-
"app/tests/sidebar-window-buttons.test.tsx",
1237-
"app/tests/strip-version-layout.test.tsx",
1238-
"app/tests/trusted-types-build.test.ts",
1239-
"app/tests/trusted-types.test.ts",
1240-
"app/tests/work-folded-layout.test.tsx",
1241-
"app/tests/workspace-snapshots-layout.test.tsx",
12421210
];
12431211
const ci = readFileSync(join(ROOT, ".github/workflows/ci.yml"), "utf8");
12441212
const browserTests = ["app/tests", "extension/tests"].flatMap((dir) =>

‎scripts/ci-changes.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export const MAX_ANCESTORS = 50;
5858
/** The number of shards ci.yml's `test` job runs the suite in. */
5959
export const SHARDS = 5;
6060

61+
/** The number of shards ci.yml's `app-browser-webkit` job runs its list in. */
62+
export const WEBKIT_SHARDS = 3;
63+
6164
const matcher = (...patterns: string[]) => {
6265
const globs = patterns.map((pattern) => new Bun.Glob(pattern));
6366
return (path: string) => globs.some((glob) => glob.match(path));
@@ -246,7 +249,12 @@ export const CI_RULES: Rule[] = [
246249
// the packages the app imports and its own tests, and no server: a pull request runs it when one
247250
// of those changes. A merge group and main run it every time.
248251
output: "app_browser_webkit",
249-
checks: ["app (real browser, WebKit)"],
252+
// Every shard, as the suite's: the list passed only once all of them did.
253+
checks: Array.from(
254+
{ length: WEBKIT_SHARDS },
255+
(_, index) =>
256+
`app (real browser, WebKit) (shard ${index + 1} of ${WEBKIT_SHARDS})`,
257+
),
250258
reads: (path) => (isCode(path) && appInputs(path)) || ciInputs(path),
251259
},
252260
{

0 commit comments

Comments
 (0)