webdriverio/webdriverio

[🐛 Bug]: Wildcards '*' and '**' in browser.mock do not work in Firefox

Open

#13 807 ouverte le 28 oct. 2024

Voir sur GitHub
 (4 commentaires) (0 réactions) (0 assignés)JavaScript (6 029 stars) (1 793 forks)batch import
Bug 🐛help wanted

Description

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.2.1

Node.js Version

20.18.0

Mode

WDIO Testrunner

Which capabilities are you using?

Firefox 131, Windows and Linux

What happened?

* and ** do not work in browser.mock when running on Firefox. For example, browser.mock('**') matches every request if the test is running on Google Chrome, and matches nothing on Firefox. Similarly, browser.mock('**/path') does not seem to match /path. However, if the pattern does not have wildcards, browser.mock seems to work correctly in both browsers.

What is your expected behavior?

The behavior of browser.mock should be consistent across browsers. ** should properly glob-match any pattern of characters for requests intercepted in Firefox.

How to reproduce the bug.

Minimal reproduction project: https://github.com/FluffyJay1/wdio-mock-wildcard

Alternatively, create a test with this code:

  const mock = await browser.mock('**');
  await browser.url('https://google.com');
  await expect(mock).toBeRequested();

and observe the test fails in Firefox.

Relevant log output

[0-0] PASSED in chrome
[1-0] Error in "should catch any rqeuest"
Error: Expect mock to be called

Expected: ">= 1"
Received: 0


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

### Is there an existing issue for this?

- [X] I have searched the existing issues

Guide contributeur