Skip to content

Commit cf9bb5d

Browse files
committed
Add more table tests
1 parent f4c9bcd commit cf9bb5d

File tree

1 file changed

+92
-2
lines changed

1 file changed

+92
-2
lines changed

packages/gitbook/e2e/pages.spec.ts

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ const testCases: TestsCase[] = [
9393
name: 'AI Search',
9494
url: '?q=What+is+GitBook%3F&ask=true',
9595
run: async (page) => {
96-
await page.waitForSelector('[data-test="search-ask-answer"]');
96+
await page.waitForSelector('[data-test="search-input"]');
97+
await page.waitForSelector('[data-test="search-ask-answer"]', {
98+
timeout: 45000,
99+
});
97100
},
98101
screenshot: false,
99102
},
@@ -262,7 +265,10 @@ const testCases: TestsCase[] = [
262265
name: 'AI Search',
263266
url: '?q=What+is+GitBook%3F&ask=true',
264267
run: async (page) => {
265-
await page.waitForSelector('[data-test="search-ask-answer"]');
268+
await page.waitForSelector('[data-test="search-input"]');
269+
await page.waitForSelector('[data-test="search-ask-answer"]', {
270+
timeout: 45000,
271+
});
266272
},
267273
screenshot: false,
268274
},
@@ -1018,6 +1024,90 @@ const testCases: TestsCase[] = [
10181024
},
10191025
],
10201026
},
1027+
{
1028+
name: 'Tables',
1029+
baseUrl: 'https://gitbook.gitbook.io/test-gitbook-open/',
1030+
tests: [
1031+
{
1032+
name: 'Default table',
1033+
url: 'blocks/tables',
1034+
run: waitForCookiesDialog,
1035+
fullPage: true,
1036+
},
1037+
{
1038+
name: 'Table with straight corners',
1039+
url:
1040+
'blocks/tables' +
1041+
getCustomizationURL({
1042+
styling: {
1043+
corners: CustomizationCorners.Straight,
1044+
},
1045+
}),
1046+
run: waitForCookiesDialog,
1047+
fullPage: true,
1048+
},
1049+
{
1050+
name: 'Table with primary color',
1051+
url:
1052+
'blocks/tables' +
1053+
getCustomizationURL({
1054+
styling: {
1055+
tint: { color: { light: '#346DDB', dark: '#346DDB' } },
1056+
},
1057+
}),
1058+
run: waitForCookiesDialog,
1059+
fullPage: true,
1060+
},
1061+
// Test dark mode for each variant
1062+
...allThemeModes.flatMap((theme) => [
1063+
{
1064+
name: `Table in ${theme} mode`,
1065+
url:
1066+
'blocks/tables' +
1067+
getCustomizationURL({
1068+
themes: {
1069+
default: theme,
1070+
toggeable: false,
1071+
},
1072+
}),
1073+
run: waitForCookiesDialog,
1074+
fullPage: true,
1075+
},
1076+
{
1077+
name: `Table with straight corners in ${theme} mode`,
1078+
url:
1079+
'blocks/tables' +
1080+
getCustomizationURL({
1081+
styling: {
1082+
corners: CustomizationCorners.Straight,
1083+
},
1084+
themes: {
1085+
default: theme,
1086+
toggeable: false,
1087+
},
1088+
}),
1089+
run: waitForCookiesDialog,
1090+
fullPage: true,
1091+
},
1092+
{
1093+
name: `Table with primary color in ${theme} mode`,
1094+
url:
1095+
'blocks/tables' +
1096+
getCustomizationURL({
1097+
styling: {
1098+
tint: { color: { light: '#346DDB', dark: '#346DDB' } },
1099+
},
1100+
themes: {
1101+
default: theme,
1102+
toggeable: false,
1103+
},
1104+
}),
1105+
run: waitForCookiesDialog,
1106+
fullPage: true,
1107+
},
1108+
]),
1109+
],
1110+
},
10211111
];
10221112

10231113
for (const testCase of testCases) {

0 commit comments

Comments
 (0)