File tree Expand file tree Collapse file tree 5 files changed +47
-9
lines changed
Expand file tree Collapse file tree 5 files changed +47
-9
lines changed Original file line number Diff line number Diff line change @@ -182,9 +182,9 @@ jobs:
182182 SITE_BASE_URL : ${{ needs.deploy-v2-cloudflare.outputs.deployment-url }}/url/
183183 ARGOS_TOKEN : ${{ secrets.ARGOS_TOKEN }}
184184 ARGOS_BUILD_NAME : ' customers-v2'
185- pagespeed -testing-v2 :
185+ browserless -testing-v2 :
186186 runs-on : ubuntu-latest
187- name : PageSpeed Testing v1
187+ name : Browserless Testing
188188 needs : deploy-v2-vercel
189189 steps :
190190 - name : Checkout
@@ -195,8 +195,8 @@ jobs:
195195 run : bun install --frozen-lockfile
196196 env :
197197 PUPPETEER_SKIP_DOWNLOAD : 1
198- - name : Run pagespeed tests
199- run : bun ./packages/gitbook/tests/pagespeed-testing.ts
198+ - name : Run integration tests
199+ run : cd ./packages/gitbook && bun e2e-browserless
200200 env :
201201 BASE_URL : ${{needs.deploy-v2-vercel.outputs.deployment-url}}
202202 PAGESPEED_API_KEY : ${{ secrets.PAGESPEED_API_KEY }}
Original file line number Diff line number Diff line change 116116 "e2e" : " playwright test e2e/internal.spec.ts e2e/pdf.spec.ts --project=chromium" ,
117117 "e2e-customers" : " playwright test e2e/customers.spec.ts --project=chromium" ,
118118 "unit" : " bun test {src,packages} --preload ./tests/preload-bun.ts" ,
119+ "e2e-browserless" : " bun test ./tests/" ,
119120 "typecheck" : " tsc --noEmit"
120121 },
121122 "browserslist" : [
Original file line number Diff line number Diff line change 1+ import { expect , it } from 'bun:test' ;
2+ import { Client } from '@modelcontextprotocol/sdk/client' ;
3+ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js' ;
4+ import { getContentTestURL } from './utils' ;
5+
6+ it ( 'should expose a MCP server' , async ( ) => {
7+ const client = new Client ( {
8+ name : 'test' ,
9+ version : '1.0.0' ,
10+ } ) ;
11+
12+ await client . connect (
13+ new StreamableHTTPClientTransport (
14+ new URL ( getContentTestURL ( 'https://gitbook.com/docs/~gitbook/mcp' ) )
15+ )
16+ ) ;
17+
18+ const tools = await client . listTools ( ) ;
19+ expect ( tools . tools [ 0 ] ?. name ) . toBe ( 'searchDocumentation' ) ;
20+
21+ const response = await client . callTool ( {
22+ name : 'searchDocumentation' ,
23+ arguments : {
24+ query : 'git' ,
25+ } ,
26+ } ) ;
27+
28+ // @ts -expect-error - response.content is of type unknown
29+ expect ( response . content [ 0 ] ?. text ) . toContain ( 'Title:' ) ;
30+ } ) ;
Original file line number Diff line number Diff line change 1+ import { it } from 'bun:test' ;
12import psi from 'psi' ;
23
34import { getContentTestURL } from './utils' ;
@@ -25,10 +26,16 @@ const tests: Array<Test> = [
2526] ;
2627
2728for ( const test of tests ) {
28- const url = getContentTestURL ( test . url ) ;
29- await psi . output ( url , {
30- strategy : test . strategy ,
31- threshold : test . threshold ,
32- key : process . env . PAGESPEED_API_KEY ,
29+ if ( ! process . env . PAGESPEED_API_KEY && ! process . env . CI ) {
30+ continue ;
31+ }
32+
33+ it ( `${ test . url } - ${ test . strategy } ` , async ( ) => {
34+ const url = getContentTestURL ( test . url ) ;
35+ await psi . output ( url , {
36+ strategy : test . strategy ,
37+ threshold : test . threshold ,
38+ key : process . env . PAGESPEED_API_KEY ,
39+ } ) ;
3340 } ) ;
3441}
You can’t perform that action at this time.
0 commit comments