Skip to content

Commit 8364ee9

Browse files
authored
Fix Argos flakies (#2999)
1 parent 07f6e2d commit 8364ee9

File tree

6 files changed

+66
-66
lines changed

6 files changed

+66
-66
lines changed

bun.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@
102102
"usehooks-ts": "^3.1.0",
103103
},
104104
"devDependencies": {
105-
"@argos-ci/playwright": "^3.10.0",
105+
"@argos-ci/playwright": "^4.1.0",
106106
"@cloudflare/next-on-pages": "1.13.7",
107107
"@cloudflare/workers-types": "^4.20241230.0",
108-
"@playwright/test": "^1.49.1",
108+
"@playwright/test": "^1.51.1",
109109
"@types/js-cookie": "^3.0.6",
110110
"@types/jsontoxml": "^1.0.5",
111111
"@types/jsonwebtoken": "^9.0.6",
@@ -268,15 +268,15 @@
268268

269269
"@alloc/quick-lru": ["@alloc/quick-lru@5.2.0", "", {}, "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw=="],
270270

271-
"@argos-ci/api-client": ["@argos-ci/api-client@0.7.2", "", { "dependencies": { "debug": "^4.4.0", "openapi-fetch": "0.13.4" } }, "sha512-ojKOhb4CXugJcHNzGH4Gp7G6gqqBEbhO2B5FNfU/ieBCDsYY+urE0hQ5L7+4TfmMoKb/xVpvtu2mQdEpMt4JVg=="],
271+
"@argos-ci/api-client": ["@argos-ci/api-client@0.8.0", "", { "dependencies": { "debug": "^4.4.0", "openapi-fetch": "0.13.4" } }, "sha512-UHa1vAf8gwHVpkqM/RaSryrFe1juqWH6dHpPeMtT4e/ZMB9hNYwYFinaGq/KRWe88JEi2WeAu776YdoeUSZQkQ=="],
272272

273-
"@argos-ci/browser": ["@argos-ci/browser@2.2.2", "", {}, "sha512-pxoUKAVA/3whUKZU1BV93vI4JBYD6utKOd8yfMdZk70kRBL+ZEY+wIPDgQCXiDk02/od64xTn3YiD+N20V45RA=="],
273+
"@argos-ci/browser": ["@argos-ci/browser@3.0.1", "", {}, "sha512-dqRXWCllulbKlqzwNE2bjbCtNqxVnUUrYpI1iIJQCMvyStmPdGHOYD7BoQQQ2uNPT2pCHeDyysrxc5T3mDyScg=="],
274274

275-
"@argos-ci/core": ["@argos-ci/core@3.0.0", "", { "dependencies": { "@argos-ci/api-client": "0.7.2", "@argos-ci/util": "2.2.2", "axios": "^1.7.9", "convict": "^6.2.4", "debug": "^4.4.0", "fast-glob": "^3.3.3", "sharp": "^0.33.5", "tmp": "^0.2.3" } }, "sha512-00xNAPwE8O7sKCgn9oeiKGE0cyZYuC3ouCxN+DBAMqZLIG+8zoUZUuB+ZJsKwjMHA9un/bzFX9l8z2Z8rgkQ7w=="],
275+
"@argos-ci/core": ["@argos-ci/core@3.1.0", "", { "dependencies": { "@argos-ci/api-client": "0.8.0", "@argos-ci/util": "2.3.0", "axios": "^1.7.9", "convict": "^6.2.4", "debug": "^4.4.0", "fast-glob": "^3.3.3", "sharp": "^0.33.5", "tmp": "^0.2.3" } }, "sha512-bo/pNKk6P0pz4NRdymgU1letwQrRbMPTeFyMsUEW8fhKNdesSFnFIWZBFGsGkkh05uw75PBjl2ZN4PvQ2TxSog=="],
276276

277-
"@argos-ci/playwright": ["@argos-ci/playwright@3.10.0", "", { "dependencies": { "@argos-ci/browser": "2.2.2", "@argos-ci/core": "3.0.0", "@argos-ci/util": "2.2.2", "chalk": "^5.4.1", "debug": "^4.4.0" } }, "sha512-kL83M8+KJ+A3bVbAWwPUMZNVlzP1FZMi3E5Y8Er4LnpqAutkbmL+YNeSamgX61WjOS8Zq3tIwf9923/rWvEkiQ=="],
277+
"@argos-ci/playwright": ["@argos-ci/playwright@4.1.0", "", { "dependencies": { "@argos-ci/browser": "3.0.1", "@argos-ci/core": "3.1.0", "@argos-ci/util": "2.3.0", "chalk": "^5.4.1", "debug": "^4.4.0" } }, "sha512-7/6/fRQvs/ZObZG76qNVHRyv5nK21oBLxzzd8T1OmJMC/+UmV9omiuOO3x75H5kc5e3vlKsCc0hClFCqtbye7A=="],
278278

279-
"@argos-ci/util": ["@argos-ci/util@2.2.2", "", {}, "sha512-MpKAz/3dMNjsUO49sEMYfw+qZFUrEeji8EmSbr0rgL8bw+Q7hIYNesRtEIQnFPub0FgX1/AV3sRZ9yqWTgGgUw=="],
279+
"@argos-ci/util": ["@argos-ci/util@2.3.0", "", {}, "sha512-tkxnCpaj7yN9nCFzo9MX0FJ5YjUepEOGYfdvF8COQqp+EdY1qubOPpc4Z0l1B60BlC8YtjQv/oRxHSh1XzxWFg=="],
280280

281281
"@ast-grep/napi": ["@ast-grep/napi@0.34.3", "", { "optionalDependencies": { "@ast-grep/napi-darwin-arm64": "0.34.3", "@ast-grep/napi-darwin-x64": "0.34.3", "@ast-grep/napi-linux-arm64-gnu": "0.34.3", "@ast-grep/napi-linux-arm64-musl": "0.34.3", "@ast-grep/napi-linux-x64-gnu": "0.34.3", "@ast-grep/napi-linux-x64-musl": "0.34.3", "@ast-grep/napi-win32-arm64-msvc": "0.34.3", "@ast-grep/napi-win32-ia32-msvc": "0.34.3", "@ast-grep/napi-win32-x64-msvc": "0.34.3" } }, "sha512-2yrnMrUw3NVm9hf+YKO+BOY3Aci/qau2vDo0lGtA7qGMma18XPUIOTdzm601k5gPHo4MfxPPZLoe9QdTUviANg=="],
282282

@@ -776,7 +776,7 @@
776776

777777
"@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="],
778778

779-
"@playwright/test": ["@playwright/test@1.49.1", "", { "dependencies": { "playwright": "1.49.1" }, "bin": { "playwright": "cli.js" } }, "sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g=="],
779+
"@playwright/test": ["@playwright/test@1.51.1", "", { "dependencies": { "playwright": "1.51.1" }, "bin": { "playwright": "cli.js" } }, "sha512-nM+kEaTSAoVlXmMPH10017vn3FSiFqr/bh4fKg9vmAdMfd9SDqRZNvPSiAHADc/itWak+qPvMPZQOPwCBW7k7Q=="],
780780

781781
"@popperjs/core": ["@popperjs/core@2.11.8", "", {}, "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A=="],
782782

@@ -2378,9 +2378,9 @@
23782378

23792379
"pkg-types": ["pkg-types@1.3.1", "", { "dependencies": { "confbox": "^0.1.8", "mlly": "^1.7.4", "pathe": "^2.0.1" } }, "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ=="],
23802380

2381-
"playwright": ["playwright@1.49.1", "", { "dependencies": { "playwright-core": "1.49.1" }, "optionalDependencies": { "fsevents": "2.3.2" }, "bin": { "playwright": "cli.js" } }, "sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA=="],
2381+
"playwright": ["playwright@1.51.1", "", { "dependencies": { "playwright-core": "1.51.1" }, "optionalDependencies": { "fsevents": "2.3.2" }, "bin": { "playwright": "cli.js" } }, "sha512-kkx+MB2KQRkyxjYPc3a0wLZZoDczmppyGJIvQ43l+aZihkaVvmu/21kiyaHeHjiFxjxNNFnUncKmcGIyOojsaw=="],
23822382

2383-
"playwright-core": ["playwright-core@1.49.1", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg=="],
2383+
"playwright-core": ["playwright-core@1.51.1", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-/crRMj8+j/Nq5s8QcvegseuyeZPxpQCZb6HNk3Sos3BlZyAknRjoyJPFWkpNn8v0+P3WiwqFF8P+zQo4eqiNuw=="],
23842384

23852385
"postcss": ["postcss@8.4.47", "", { "dependencies": { "nanoid": "^3.3.7", "picocolors": "^1.1.0", "source-map-js": "^1.2.1" } }, "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ=="],
23862386

packages/gitbook/e2e/customers.spec.ts

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1-
import { type TestsCase, runTestCases } from './util';
1+
import { type TestsCase, runTestCases, waitForCookiesDialog } from './util';
22

33
/** A list of test cases to run on the customers' docs sites. */
44
const testCases: TestsCase[] = [
55
{
66
name: 'Snyk',
77
contentBaseURL: 'https://docs.snyk.io',
88
tests: [
9-
{ name: 'Home', url: '/' },
10-
{ name: 'OpenAPI', url: '/snyk-api/reference/apps' },
9+
{ name: 'Home', url: '/', run: waitForCookiesDialog },
10+
{ name: 'OpenAPI', url: '/snyk-api/reference/apps', run: waitForCookiesDialog },
1111
],
1212
},
1313
{
1414
name: 'Nexthink',
1515
contentBaseURL: 'https://docs.nexthink.com',
16-
tests: [{ name: 'Home', url: '/', screenshot: { waitForTOCScrolling: false } }],
16+
tests: [
17+
{
18+
name: 'Home',
19+
url: '/',
20+
screenshot: { waitForTOCScrolling: false },
21+
run: waitForCookiesDialog,
22+
},
23+
],
1724
},
1825
{
1926
name: 'asiksupport-stg.dto.kemkes.go.id',
@@ -33,7 +40,7 @@ const testCases: TestsCase[] = [
3340
{
3441
name: 'docs.dify.ai',
3542
contentBaseURL: 'https://docs.dify.ai',
36-
tests: [{ name: 'Home', url: '/' }],
43+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
3744
},
3845
{
3946
name: 'seeddao.gitbook.io',
@@ -63,27 +70,27 @@ const testCases: TestsCase[] = [
6370
{
6471
name: 'docs.portainer.io',
6572
contentBaseURL: 'https://docs.portainer.io',
66-
tests: [{ name: 'Home', url: '/' }],
73+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
6774
},
6875
{
6976
name: 'docs.chirptoken.io',
7077
contentBaseURL: 'https://docs.chirptoken.io',
71-
tests: [{ name: 'Home', url: '/' }],
78+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
7279
},
7380
{
7481
name: 'docs.dexscreener.com',
7582
contentBaseURL: 'https://docs.dexscreener.com',
76-
tests: [{ name: 'Home', url: '/' }],
83+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
7784
},
7885
{
7986
name: 'docs.pancakeswap.finance',
8087
contentBaseURL: 'https://docs.pancakeswap.finance',
81-
tests: [{ name: 'Home', url: '/' }],
88+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
8289
},
8390
{
8491
name: 'book.character.ai',
8592
contentBaseURL: 'https://book.character.ai',
86-
tests: [{ name: 'Home', url: '/' }],
93+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
8794
},
8895
{
8996
name: 'docs.tradeonnova.io',
@@ -103,7 +110,7 @@ const testCases: TestsCase[] = [
103110
{
104111
name: 'docs.keeper.io',
105112
contentBaseURL: 'https://docs.keeper.io',
106-
tests: [{ name: 'Home', url: '/' }],
113+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
107114
},
108115
{
109116
name: 'adiblar.gitbook.io',
@@ -138,12 +145,12 @@ const testCases: TestsCase[] = [
138145
{
139146
name: 'meshnet.nordvpn.com',
140147
contentBaseURL: 'https://meshnet.nordvpn.com',
141-
tests: [{ name: 'Home', url: '/' }],
148+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
142149
},
143150
{
144151
name: 'manual.bubble.io',
145152
contentBaseURL: 'https://manual.bubble.io',
146-
tests: [{ name: 'Home', url: '/' }],
153+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
147154
},
148155
{
149156
name: 'docs.tickettool.xyz',
@@ -158,12 +165,12 @@ const testCases: TestsCase[] = [
158165
{
159166
name: 'docs.cherry-ai.com',
160167
contentBaseURL: 'https://docs.cherry-ai.com',
161-
tests: [{ name: 'Home', url: '/' }],
168+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
162169
},
163170
{
164171
name: 'docs.snyk.io',
165172
contentBaseURL: 'https://docs.snyk.io',
166-
tests: [{ name: 'Home', url: '/' }],
173+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
167174
},
168175
{
169176
name: 'docs.realapp.link',
@@ -188,7 +195,14 @@ const testCases: TestsCase[] = [
188195
{
189196
name: 'docs.umbraco.com',
190197
contentBaseURL: 'https://docs.umbraco.com',
191-
tests: [{ name: 'Home', url: '/welcome', screenshot: { waitForTOCScrolling: false } }],
198+
tests: [
199+
{
200+
name: 'Home',
201+
url: '/welcome',
202+
run: waitForCookiesDialog,
203+
screenshot: { waitForTOCScrolling: false },
204+
},
205+
],
192206
},
193207
{
194208
name: 'sosovalue-white-paper.gitbook.io',
@@ -198,12 +212,12 @@ const testCases: TestsCase[] = [
198212
{
199213
name: 'docs.revrobotics.com',
200214
contentBaseURL: 'https://docs.revrobotics.com',
201-
tests: [{ name: 'Home', url: '/' }],
215+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
202216
},
203217
{
204218
name: 'chartschool.stockcharts.com',
205219
contentBaseURL: 'https://chartschool.stockcharts.com',
206-
tests: [{ name: 'Home', url: '/' }],
220+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
207221
},
208222
{
209223
name: 'docs.soniclabs.com',
@@ -218,7 +232,7 @@ const testCases: TestsCase[] = [
218232
{
219233
name: 'docs.thousandeyes.com',
220234
contentBaseURL: 'https://docs.thousandeyes.com',
221-
tests: [{ name: 'Home', url: '/' }],
235+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
222236
},
223237
{
224238
name: 'docs.raydium.io',
@@ -228,7 +242,7 @@ const testCases: TestsCase[] = [
228242
{
229243
name: 'docs.fluentbit.io',
230244
contentBaseURL: 'https://docs.fluentbit.io',
231-
tests: [{ name: 'Home', url: '/' }],
245+
tests: [{ name: 'Home', url: '/', run: waitForCookiesDialog }],
232246
},
233247
];
234248

packages/gitbook/e2e/util.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,8 @@ export const headerLinks: CustomizationHeaderItem[] = [
133133
];
134134

135135
export async function waitForCookiesDialog(page: Page) {
136-
const dialog = page.getByRole('dialog', { name: 'Cookies' });
137-
const accept = dialog.getByRole('button', { name: 'Accept' });
138-
const reject = dialog.getByRole('button', { name: 'Reject' });
139-
await expect(accept).toBeVisible();
140-
await expect(reject).toBeVisible();
136+
const dialog = page.getByTestId('cookies-dialog');
137+
await expect(dialog).toBeVisible();
141138
}
142139

143140
/**
@@ -190,14 +187,20 @@ export function runTestCases(testCases: TestsCase[]) {
190187
await argosScreenshot(page, `${testCase.name} - ${testEntry.name}`, {
191188
viewports: ['macbook-16', 'macbook-13', 'ipad-2', 'iphone-x'],
192189
argosCSS: `
193-
/* Hide Intercom */
194-
.intercom-lightweight-app {
195-
display: none !important;
190+
/* Hide Intercom */
191+
.intercom-lightweight-app {
192+
display: none !important;
193+
}
194+
195+
/* Switch image rendering to pixelated */
196+
img {
197+
image-rendering: pixelated;
196198
}
197199
`,
198200
threshold: screenshotOptions?.threshold ?? undefined,
199201
fullPage: testEntry.fullPage ?? false,
200-
beforeScreenshot: async () => {
202+
beforeScreenshot: async ({ runStabilization }) => {
203+
await runStabilization();
201204
await waitForIcons(page);
202205
if (screenshotOptions?.waitForTOCScrolling !== false) {
203206
await waitForTOCScrolling(page);

packages/gitbook/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@
6767
"jwt-decode": "^4.0.0"
6868
},
6969
"devDependencies": {
70-
"@argos-ci/playwright": "^3.10.0",
70+
"@argos-ci/playwright": "^4.1.0",
7171
"@cloudflare/next-on-pages": "1.13.7",
7272
"vercel": "^39.3.0",
7373
"@cloudflare/workers-types": "^4.20241230.0",
74-
"@playwright/test": "^1.49.1",
74+
"@playwright/test": "^1.51.1",
7575
"@types/js-cookie": "^3.0.6",
7676
"@types/jsontoxml": "^1.0.5",
7777
"@types/jsonwebtoken": "^9.0.6",

packages/gitbook/src/components/Header/HeaderMobileMenu.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,11 @@ export function HeaderMobileMenu(props: Partial<React.ButtonHTMLAttributes<HTMLB
4747
aria-label={tString(language, 'table_of_contents_button_label')}
4848
onClick={toggleNavigation}
4949
className={tcls(
50-
'flex',
51-
'flex-row',
52-
'items-center',
53-
'py-1',
54-
'px-2',
55-
'rounded',
56-
'straight-corners:rounded-sm',
50+
'flex flex-row items-center rounded straight-corners:rounded-sm px-2 py-1',
5751
props.className
5852
)}
5953
>
60-
<Icon icon="bars" className={tcls('size-4', 'text-inherit')} />
54+
<Icon icon="bars" className="size-4 text-inherit" />
6155
</button>
6256
);
6357
}

packages/gitbook/src/components/Search/SearchButton.tsx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export function SearchButton(props: { children?: React.ReactNode; style?: ClassV
9999
);
100100
}
101101

102-
const Shortcut = () => {
102+
function Shortcut() {
103103
const [operatingSystem, setOperatingSystem] = useState<string | null>(null);
104104

105105
useEffect(() => {
@@ -117,20 +117,7 @@ const Shortcut = () => {
117117

118118
return operatingSystem ? (
119119
<div
120-
className={tcls(
121-
'shortcut',
122-
'hidden',
123-
'md:flex',
124-
'gap-0.5',
125-
'-mr-1',
126-
'justify-end',
127-
'text-xs',
128-
'text-tint',
129-
'contrast-more:text-tint-strong',
130-
'whitespace-nowrap',
131-
`[font-feature-settings:"calt",_"case"]`,
132-
'animate-fadeIn'
133-
)}
120+
className={`shortcut -mr-1 hidden animate-fadeIn justify-end gap-0.5 whitespace-nowrap text-tint text-xs [font-feature-settings:"calt",_"case"] contrast-more:text-tint-strong md:flex`}
134121
>
135122
<kbd
136123
className={`flex h-5 min-w-5 items-center justify-center rounded border border-tint-subtle theme-bold:border-header-link/5 bg-tint-base theme-bold:bg-header-background px-1 ${operatingSystem === 'mac' ? 'text-sm' : ''}`}
@@ -141,5 +128,7 @@ const Shortcut = () => {
141128
K
142129
</kbd>
143130
</div>
144-
) : null;
145-
};
131+
) : (
132+
<span aria-busy />
133+
);
134+
}

0 commit comments

Comments
 (0)