Skip to content

Commit 9c9aad1

Browse files
committed
Update internal.spec.ts
1 parent feb67f7 commit 9c9aad1

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

packages/gitbook/e2e/internal.spec.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,9 +1983,9 @@ const testCases: TestsCase[] = [
19831983
await expect(page.locator('#gitbook-widget-window')).toBeVisible();
19841984
const iframe = page.frameLocator('#gitbook-widget-iframe');
19851985
await iframe.getByTestId('embed-tab-docs').click(); // Switch to docs tab
1986-
await expect(iframe.getByTestId('embed-docs-page')).toBeVisible({
1987-
timeout: 20000,
1988-
});
1986+
const docsPage = iframe.getByTestId('embed-docs-page');
1987+
await docsPage.waitFor({ state: 'visible', timeout: 10000 });
1988+
await expect(docsPage).toBeVisible({ timeout: 10000 });
19891989

19901990
await iframe.getByTestId('embed-tab-assistant').click(); // Switch to assistant tab
19911991
await expect(iframe.getByTestId('ai-chat')).toBeVisible();
@@ -2003,9 +2003,9 @@ const testCases: TestsCase[] = [
20032003
});
20042004
await expect(page.locator('#gitbook-widget-window')).toBeVisible();
20052005
const iframe = page.frameLocator('#gitbook-widget-iframe');
2006-
await expect(iframe.getByTestId('embed-docs-page')).toBeVisible({
2007-
timeout: 20000,
2008-
});
2006+
const docsPage = iframe.getByTestId('embed-docs-page');
2007+
await docsPage.waitFor({ state: 'visible', timeout: 10000 });
2008+
await expect(docsPage).toBeVisible({ timeout: 10000 });
20092009
await expect(iframe.owner()).toHaveAttribute(
20102010
'src',
20112011
expect.stringContaining('getting-started/quickstart')
@@ -2129,7 +2129,9 @@ const testCases: TestsCase[] = [
21292129

21302130
await expect(actions.nth(0)).toHaveAccessibleName('Open internal link');
21312131
await actions.nth(0).click();
2132-
await expect(iframe.getByTestId('embed-docs-page')).toBeVisible();
2132+
const docsPage = iframe.getByTestId('embed-docs-page');
2133+
await docsPage.waitFor({ state: 'visible', timeout: 10000 });
2134+
await expect(docsPage).toBeVisible({ timeout: 10000 });
21332135
await expect(iframe.owner()).toHaveAttribute(
21342136
'src',
21352137
expect.stringContaining('getting-started/quickstart')
@@ -2218,9 +2220,9 @@ const testCases: TestsCase[] = [
22182220
run: async (page) => {
22192221
await expect(page.locator('#gitbook-widget-window')).toBeVisible();
22202222
const iframe = page.frameLocator('#gitbook-widget-iframe');
2221-
await expect(iframe.getByTestId('embed-docs-page')).toBeVisible({
2222-
timeout: 20000,
2223-
});
2223+
const docsPage = iframe.getByTestId('embed-docs-page');
2224+
await docsPage.waitFor({ state: 'visible', timeout: 10000 });
2225+
await expect(docsPage).toBeVisible({ timeout: 10000 });
22242226
},
22252227
},
22262228
{
@@ -2229,9 +2231,9 @@ const testCases: TestsCase[] = [
22292231
run: async (page) => {
22302232
await expect(page.locator('#gitbook-widget-window')).toBeVisible();
22312233
const iframe = page.frameLocator('#gitbook-widget-iframe');
2232-
await expect(iframe.getByTestId('embed-docs-page')).toBeVisible({
2233-
timeout: 20000,
2234-
});
2234+
const docsPage = iframe.getByTestId('embed-docs-page');
2235+
await docsPage.waitFor({ state: 'visible', timeout: 10000 });
2236+
await expect(docsPage).toBeVisible({ timeout: 10000 });
22352237
const tocButton = iframe.getByTestId('toc-button');
22362238
await expect(tocButton).toBeVisible();
22372239
await tocButton.click();
@@ -2244,9 +2246,9 @@ const testCases: TestsCase[] = [
22442246
run: async (page) => {
22452247
await expect(page.locator('#gitbook-widget-window')).toBeVisible();
22462248
const iframe = page.frameLocator('#gitbook-widget-iframe');
2247-
await expect(iframe.getByTestId('embed-docs-page')).toBeVisible({
2248-
timeout: 20000,
2249-
});
2249+
const docsPage = iframe.getByTestId('embed-docs-page');
2250+
await docsPage.waitFor({ state: 'visible', timeout: 10000 });
2251+
await expect(docsPage).toBeVisible({ timeout: 10000 });
22502252
const openInNewTabButton = iframe.getByTestId(
22512253
'embed-docs-page-open-in-new-tab'
22522254
);

0 commit comments

Comments
 (0)