[Question] How to run Polly Codeceptjs
See original GitHub issueHi all! I am trying to run codeceptjs (webdriverio) with polly, I am getting error with:
[Polly] [adapter:fetch] fetch global not found.
My code is:
const {
Polly
} = require('@pollyjs/core');
const FetchAdapter = require('@pollyjs/adapter-fetch')
const XHRAdapter = require('@pollyjs/adapter-xhr')
const RESTPersister = require('@pollyjs/persister-rest')
Polly.register(FetchAdapter);
Polly.register(XHRAdapter);
Polly.register(RESTPersister);
Before(async (I) => {
// try {
I.amOnPage("/");
const polly = new Polly('Simple Example', {
adapters: ['fetch'], // Hook into `fetch`
persister: 'local-storage', // Read/write to/from local-storage
logging: true // Log requests to console
});
await I.login();
I have one more question if I want to record the rest and change it like I want to change only one attribute in response how can I do it? If its not possible how I reuse the mocks ? where they will be saved ?
thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:11
Top Results From Across the Web
Polly | CodeceptJS
Polly. Extends MockRequest. This helper works the same as MockRequest helper. It has been included for backwards compatibility reasons.
Read more >Getting Started - CodeceptJS
Interactive shell started Press ENTER to resume test Use JavaScript syntax to try steps in action - Press ENTER to run the next...
Read more >Releases - CodeceptJS
Use it to perform run multiple times and detect flaky tests ... use Polly & Puppeteer helpers I.mockRequest('GET', '/api/users', 200); I.mockRequest('POST', ...
Read more >Quickstart - CodeceptJS
To start a new project initialize CodeceptJS to create main config file: codecept.conf.js . npx codeceptjs init. Answer questions, agree on defaults: ...
Read more >Testing with Puppeteer - CodeceptJS
If you already have CodeceptJS project, just install puppeteer package and enable a helper it in config. ... You will be asked for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@vitaly87 that may likely do the trick. I cannot say for certain since I do not know the testing framework you’re using.
Finally I get it working , I download the pollyjs via cdn and did polly.server . All of this was done from excude script from chrome. You can’t do it out of chrome scope .