Open Sumit-Soman opened 5 years ago
Stacktrace for same
Protocol error (Network.getResponseBody): No resource with given identifier found
at Promise (node_modules/puppeteer/lib/Connection.js:183:56)
at CDPSession.send (node_modules/puppeteer/lib/Connection.js:182:12)
at _contentPromise._bodyLoadedPromise.then (node_modules/puppeteer/lib/NetworkManager.js:597:45)
-- ASYNC --
at Response.<anonymous> (node_modules/puppeteer/lib/helper.js:108:27)
at Page.p.on (node_modules/mockeer/src/helpers/recorder.js:35:37)
at NetworkManager.Page._networkManager.on.event (node_modules/puppeteer/lib/Page.js:129:75)
at NetworkManager._onResponseReceived (node_modules/puppeteer/lib/NetworkManager.js:248:10)
Above issue comes when we try to runs specs in parallel.
I am trying the use the same puppeteer instance in TestEnvironment.js
Works fine if all we initialise and close the browser at spec level.
Hi @Sumit-Soman ,
Probably we need to modify Mockeer for the functionality you expect. I will try to put some time and ix this but feel free to raise a PR if you want to fix it yourself
Thanks for the response.
Will try to solve this.
Currently I am trying to mock the text as well.
Will love it if you could help or guide me solve it through mockeer. When we record the whole page, it's a huge Json. Is there a way to mock component only instead of whole dom
Sure, Let's work on this together.
Do you have your entire setup somewhere committed?
Re huge json, Mockeer does not mock DOM object, only the http requests that go out of the browser. Something I would like to do in the next interations of this library is to introduce post-processors. Basically Whitelisting/Blacklisting request through callback functions. That would help with reducing JSON file size
Great!
Can't commit code as it's company proprietary.
Will try to fork out a poc framework and share it with you and we can collaborate on the same.
Package.json "jest-html-reporter": "^2.5.0", "jest-screenshot": "^0.2.2", "mockeer": "0.0.4", "puppeteer": "^1.13.0",
When running multiple tests getting below error "Protocol error (Network.getResponseBody): No resource with given identifier found"
Error only comes when we are trying to mock images using mockeer. Here is my TestEnvironment.js code
async setup() { await super.setup(); await console.log(chalk.green('Starting Puppeteer')); this.global.BROWSER = await puppeteer.launch({ headless: true, timeout: 0, ignoreHTTPSErrors: true, }); this.global.PAGE = await this.global.BROWSER.newPage(); await mockeer(this.global.BROWSER, {fixtureName: 'test', fixturesDir: 'images_log', replaceImage: true}); }
at the spec level i am taking screenshot and comparing.
Kindly advice