Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: this._resolveReqs is not a function #14

Open
ptsurko opened this issue Apr 25, 2019 · 1 comment
Open

TypeError: this._resolveReqs is not a function #14

ptsurko opened this issue Apr 25, 2019 · 1 comment

Comments

@ptsurko
Copy link

ptsurko commented Apr 25, 2019

Getting following exception:

TypeError: this._resolveReqs is not a function

      at Object._onReqsCompleted (../node_modules/puppeteer-request-mocker/lib/mocker.js:138:36)
      at interceptedResponse.text.then.catch.then (../node_modules/puppeteer-request-mocker/lib/handleResponse.js:97:18)

Page just make fetch POST to resource and renders list of posts

My test:

const mocker = require('puppeteer-request-mocker');
const { PendingXHR } = require('pending-xhr-puppeteer');

describe('app', () => {
  it('should display My Blog logo', async () => {
    page = await browser.newPage();
    const pendingXHR = new PendingXHR(page);

    await page.goto('http://localhost:3000', {waitUntil: 'domcontentloaded'})
    await mocker.start({
      page,
      mockList: ['https://jsonplaceholder.typicode.com/posts'],
    });
    
    await pendingXHR.waitForAllXhrFinished();
    await page.waitForSelector('section');

    const sectionCount = await page.evaluate(() => document.querySelectorAll('section').length);
    console.log('sectionCount: ', sectionCount);
    await expect(sectionCount).toBe(100);
    await expect(page).toMatch('My Blog');

    await mocker.stop();
  })
});
@Diokuz
Copy link
Owner

Diokuz commented Dec 27, 2019

Hey, I just got the same Error, finally)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants