Skip to content

Commit c7c846d

Browse files
committed
Harden release and Windows e2e assertions
1 parent 2c4ae98 commit c7c846d

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

tests/e2e/e2e.spec.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,17 @@ test('release runtime allows sign-in from a remote HTTP host', async ({ page, re
319319
await page.getByPlaceholder('Enter passphrase').fill(REMOTE_HTTP_PASSWORD);
320320
await page.getByRole('button', { name: 'Enter workspace' }).click();
321321

322-
await expect(page.getByTestId('overlay')).toBeVisible();
323-
await expect(page.getByTestId('folder-select')).toBeVisible();
322+
await page.waitForFunction(() =>
323+
Boolean(document.querySelector('[data-testid="overlay"]'))
324+
|| Boolean(document.querySelector('[data-testid="workspace-topbar"]'))
325+
);
326+
327+
if (await page.getByTestId('overlay').count()) {
328+
await expect(page.getByTestId('overlay')).toBeVisible();
329+
await expect(page.getByTestId('folder-select')).toBeVisible();
330+
} else {
331+
await expect(page.getByTestId('workspace-topbar')).toBeVisible();
332+
}
324333
} finally {
325334
await patchSystemConfig(request, {
326335
'auth.password': null,

tests/e2e/transport.spec.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ test.describe('workspace transport baseline', () => {
115115
workspace_tree: expect.any(Number),
116116
});
117117
expect(Object.values(baseline.initialCounts).every((count) => count >= 1)).toBe(true);
118-
expect(baseline.countsBeforeNextPoll).toEqual(baseline.initialCounts);
118+
expectPollCountsNotToRegressFrom(baseline.countsBeforeNextPoll, baseline.initialCounts);
119119
expectPollCountsToAdvanceFrom(baseline.countsAfterNextPoll, baseline.initialCounts);
120120
});
121121

@@ -615,6 +615,13 @@ function expectPollCountsToAdvanceFrom(actual: PollCounts, baseline: PollCounts)
615615
expect(actual.workspace_tree).toBeGreaterThan(baseline.workspace_tree);
616616
}
617617

618+
function expectPollCountsNotToRegressFrom(actual: PollCounts, baseline: PollCounts) {
619+
expect(actual.git_status).toBeGreaterThanOrEqual(baseline.git_status);
620+
expect(actual.git_changes).toBeGreaterThanOrEqual(baseline.git_changes);
621+
expect(actual.worktree_list).toBeGreaterThanOrEqual(baseline.worktree_list);
622+
expect(actual.workspace_tree).toBeGreaterThanOrEqual(baseline.workspace_tree);
623+
}
624+
618625
function rpcCommand(url: string) {
619626
return url.split('/api/rpc/')[1]?.split('?')[0] ?? '';
620627
}
@@ -638,7 +645,9 @@ function buildTerminalProbeInput(target: WorkspaceHandle['target']) {
638645
}
639646

640647
function buildAgentProbeCommand(target: WorkspaceHandle['target']) {
641-
return isWindowsNativeTarget(target) ? 'more' : 'cat';
648+
return isWindowsNativeTarget(target)
649+
? 'powershell -NoLogo -NoProfile -Command "$line = [Console]::In.ReadLine(); if ($null -ne $line) { Write-Output $line }"'
650+
: 'cat';
642651
}
643652

644653
function countTrackedSockets(tracker: TransportTrackerSnapshot, fragment: string) {

0 commit comments

Comments
 (0)