@@ -15,7 +15,7 @@ import { getContentTestURL } from '../tests/utils';
15
15
16
16
interface Test {
17
17
name : string ;
18
- url : string ; // URL to visit for testing
18
+ url : string | ( ( ) => Promise < string > ) ; // URL to visit for testing
19
19
run ?: ( page : Page ) => Promise < unknown > ; // The test to run
20
20
fullPage ?: boolean ; // Whether the test should be fullscreened during testing
21
21
screenshot ?: false ; // Should a screenshot be stored
@@ -770,7 +770,7 @@ const testCases: TestsCase[] = [
770
770
tests : [
771
771
{
772
772
name : 'GitBook Docs' ,
773
- url : await ( async ( ) => {
773
+ url : async ( ) => {
774
774
const res = await fetch (
775
775
`https://api.gitbook.com/v1/urls/published?url=https://docs.gitbook.com` ,
776
776
) ;
@@ -785,7 +785,7 @@ const testCases: TestsCase[] = [
785
785
}
786
786
787
787
return `~site/${ published . site } ?token=${ published . apiToken } ` ;
788
- } ) ( ) ,
788
+ } ,
789
789
run : waitForCookiesDialog ,
790
790
} ,
791
791
] ,
@@ -797,7 +797,9 @@ for (const testCase of testCases) {
797
797
for ( const testEntry of testCase . tests ) {
798
798
const testFn = testEntry . only ? test . only : test ;
799
799
testFn ( testEntry . name , async ( { page, baseURL } ) => {
800
- const contentUrl = new URL ( testEntry . url , testCase . baseUrl ) ;
800
+ const testEntryUrl =
801
+ typeof testEntry . url === 'string' ? testEntry . url : await testEntry . url ( ) ;
802
+ const contentUrl = new URL ( testEntryUrl , testCase . baseUrl ) ;
801
803
const url = getContentTestURL ( contentUrl . toString ( ) , baseURL ) ;
802
804
await page . goto ( url ) ;
803
805
if ( testEntry . run ) {
0 commit comments