Search code examples
testingautomated-testsgoogle-chrome-devtoolse2e-testingtestcafe

Compare Network logs with const using Testcafe


I'm trying to see if request is triggered when I scroll down the page. I cannot use RequestURL because of timestamp. I know that there is RequestLogger.

What I'm trying to do is:

  • create const which contains part of request URL, get specific log
  • from Network tab in Dev-Tool in Chrome (maybe filter them) compare
  • log with const to see if it contains the same pattern.

And if they begin with the same pattern pass the test


Solution

  • Ok guys. Here is a workaround:

    const logger = RequestLogger(new RegExp(`somestring`));
    

    Then I use

    await t.expect(logger.requests.length).eql(1);