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

[Bug]: waitForResponse is not merging URL when using predicate #30181

Closed
msmith1114 opened this issue Mar 29, 2024 · 1 comment
Closed

[Bug]: waitForResponse is not merging URL when using predicate #30181

msmith1114 opened this issue Mar 29, 2024 · 1 comment

Comments

@msmith1114
Copy link

Version

1.42.1

Steps to reproduce

When using page.waitForResponse with a predicate such as below:

const responsePromise = page.waitForResponse(response =>
      response.url() === 'https://some.url.com/settings/1000' && response.status() === 200
    );

It seems to be working just fine. However if I do this:

const responsePromise = page.waitForResponse(response =>
      response.url() === '/settings/1000' && response.status() === 200
    );

and my baseUrl is set to: https://some.url.com/ It will not work. Maybe this is intended? Since breaking out the response.url is expecting the entire url? FWIW It does work if I do response.url() === (baseUrl + '/settings/1000') for example.

Expected behavior

I would expect that the response.url should be merged similar to if you use it without a predicate

Actual behavior

response.url does not merge baseUrl when used with a predicate

Additional context

No response

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (24) x64 12th Gen Intel(R) Core(TM) i7-12800HX
    Memory: 20.17 GB / 31.70 GB
  Binaries:
    Node: 18.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.15.5 - ~\AppData\Roaming\npm\pnpm.CMD
  npmPackages:
    @playwright/test: ^1.42.1 => 1.42.1
@pavelfeldman
Copy link
Member

response.url() returns a string, it will always contain absolute URL - it can't contain a different value based on the baseURL setting - everything will fall apart then.

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