Repository navigation
test: migrate pages handler validation tests to mocks - #2758
dhananjaypai08 wants to merge 1 commit into
Conversation
d137a5e to
1e9a508
Compare
1e9a508 to
aac76f8
Compare
OrKoN
left a comment
There was a problem hiding this comment.
Thanks, let's make the following changes:
-
In
tests/tools/pages.test.ts(the--no-javascript-evaluationtests fornewPageandnavigatePage), rebase onmainand pass{javascriptEvaluation: false}directly tocreateHandlerMocks({javascriptEvaluation: false})instead of parsing CLI flags. Commit #2861 replacedparseArgumentswithConfigParseronmain, causing a rebase conflict, and passing the option directly tocreateHandlerMocksavoids manual argument parsing altogether. -
In
tests/tools/pages.test.ts, destructureargsdirectly fromcreateHandlerMocks()across the migratedlist_pages,newPage, andnavigatePagetests instead of repeatedly callingcreateMockParsedArguments().createHandlerMocks()already initializes and returnsargswith default mock options, making the extracreateMockParsedArguments()invocations redundant.
Refs #2639
Summary
list_pageshandler test and thenew_page/navigate_pageURL validation tests intests/tools/pages.test.tsontocreateHandlerMocks().list_pagesresponse flags (setIncludePages,setListThirdPartyDeveloperTools,setListWebMcpTools) and that rejected URLs never callcontext.newPageorpage.pptrPage.goto.chrome://newtab/, focus, isolated contexts).Test plan
npm run test tests/tools/pages.test.ts -- --test-name-pattern='list pages$|javascript URL|javascript, data, or vbscript|does not parse|chrome: and chrome-untrusted|chrome-extension: URLs unless'PUPPETEER_EXECUTABLE_PATHpointed at a nonexistent binarynpm run test tests/tools/pages.test.tsnpm run format