open.gitbook.com e2e test

This commit is contained in:
taranvohra
2024-10-11 15:44:09 +05:30
parent f9a075eed1
commit 66f9526594
+27
View File
@@ -3,6 +3,7 @@ import {
CustomizationHeaderPreset,
CustomizationIconsStyle,
CustomizationLocale,
PublishedSiteContentLookup,
SiteCustomizationSettings,
} from '@gitbook/api';
import { test, expect, Page } from '@playwright/test';
@@ -763,6 +764,32 @@ const testCases: TestsCase[] = [
},
],
},
{
name: 'open.gitbook.com',
baseUrl: 'https://open.gitbook.com/',
tests: [
{
name: 'GitBook Docs',
url: await (async () => {
const res = await fetch(
`https://api.gitbook.com/v1/urls/published?url=https://docs.gitbook.com`,
);
if (!res.ok) {
throw new Error('Failed to get published URL');
}
const published = await res.json<PublishedSiteContentLookup>();
if (!('site' in published)) {
throw new Error('Expected site for published URL');
}
return `~site/${published.site}?token=${published.apiToken}`;
})(),
run: waitForCookiesDialog,
},
],
},
];
for (const testCase of testCases) {