What are you trying to achieve?
I set up a simple end to end test on the Spring Initializr webpage to see if MockRequest works. I am using the Puppeteer helper
What do you get instead?
I get an exception when running the test
SPRING INITIALZER TEST --
× Spring Initializr Test in 4889ms
-- FAILURES:
1) SPRING INITIALZER TEST
Spring Initializr Test:
Cannot read properties of undefined (reading 'all')
at CdpPage.apply (D:\...\node_modules\@codeceptjs\mock-request\node_modules\@pollyjs\adapter-puppeteer\src\index.js:228:34)
at PuppeteerCodeceptJSAdapter._callListenersWith (D:\...\node_modules\@codeceptjs\mock-request\node_modules\@pollyjs\adapter-puppeteer\src\index.js:245:12)
at PuppeteerCodeceptJSAdapter.attachToPageEvents (D:\...\node_modules\@codeceptjs\mock-request\node_modules\@pollyjs\adapter-puppeteer\src\index.js:143:10)
Scenario Steps:
- I.startMocking() at Test.<anonymous> (.\login_test.ts:27:5)
- I.amOnPage("https://start.spring.io/") at Test.<anonymous> (.\login_test.ts:25:5)
Provide test source code if related
Scenario('Spring Initializr Test',async({ I })=>{I.startMocking();I.amOnPage("https://start.spring.io/");I.click("Gradle - Kotlin");I.click("Java");I.click("3.2.3");I.click("#generate-project");I.stopMocking();})Details
- CodeceptJS version: 3.5.14
- NodeJS Version: 20.10.0
- Operating System: Windows 11
- puppeteer version: 22.3.0
- Configuration file:
export constconfig: CodeceptJS.MainConfig={tests: './*_test.ts',output: './output',helpers: {Puppeteer: {url: "/",show: true,waitForNavigation: "networkidle0"},MockRequestHelper: {require: '@codeceptjs/mock-request',mode: 'record'}},include: {I: './steps_file'},plugins: {tryTo: {enabled: true},stepTimeout: {enabled: true,overrideStepLimits: true,noTimeoutSteps: ['scroll*',// ignore all scroll steps/Cookie/,// ignore all steps with a Cookie in it (by regexp)]}},name: 'vas'}
What are you trying to achieve?
I set up a simple end to end test on the Spring Initializr webpage to see if MockRequest works. I am using the Puppeteer helper
What do you get instead?
I get an exception when running the test
Details