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

Wait for response matchers not working #230

Closed
mkorpela opened this issue Aug 9, 2020 · 7 comments
Closed

Wait for response matchers not working #230

mkorpela opened this issue Aug 9, 2020 · 7 comments
Labels
bug Something isn't working priority: high
Milestone

Comments

@mkorpela
Copy link
Member

mkorpela commented Aug 9, 2020

Describe the bug
I want this to return the result of route search. So ${r} should be that result. And matcher should work as a JS regexp.

To Reproduce

*** Settings ***
Library  Browser
Suite Setup  New Browser   headless=${False}

*** Test Cases ***
Graphhopper
   New Page    https://graphhopper.com/maps/
   wait until network is idle  timeout=5s
   type text  //*[@id="0_Input"]  Turku
   type text  //*[@id="1_Input"]  Helsinki
   wait until network is idle  timeout=5s
   ${p}=   promise to  wait for response  matcher=/.*\/api\/1.*/  timeout=5s
   Click   \#searchButton
   ${r}=  wait for  ${p}
@mkorpela mkorpela added the bug Something isn't working label Aug 9, 2020
@mkorpela mkorpela added this to the v1.5.0 milestone Oct 12, 2020
@mkorpela mkorpela modified the milestones: v1.5.0, v1.6.0 Oct 13, 2020
@aaltat aaltat modified the milestones: v1.6.0, v1.7.0 Oct 20, 2020
@mkorpela
Copy link
Member Author

This now works after #432

*** Settings ***
Library  Browser
Suite Setup  New Browser   headless=${False}

*** Test Cases ***
Graphhopper
   New Page    https://graphhopper.com/maps/
   wait until network is idle  timeout=5s
   type text  //*[@id="0_Input"]  Turku
   type text  //*[@id="1_Input"]  Helsinki
   wait until network is idle  timeout=5s
   ${p}=   promise to  wait for response  matcher=/api/1/  timeout=5s
   Click   \#searchButton
   ${r}=  wait for  ${p}

@mkorpela mkorpela changed the title Wait for request and response matchers (regexp at least) do not seem to work Wait response matchers not working Oct 21, 2020
@mkorpela mkorpela changed the title Wait response matchers not working Wait for response matchers not working Oct 21, 2020
@mkorpela
Copy link
Member Author

Fixed after #437

@vincenzo-gasparo
Copy link
Contributor

vincenzo-gasparo commented Dec 14, 2020

Hi, I need to match a response with this uri: /api/table/customers?id=1234. I'm able to match it with matcher=/api/table/customers and matcher=id=1234 but matcher=/api/table/customers?id=1234 gives me TimeoutError: Timeout while waiting for event "response".
Is there a problem with special characters like ? or am I missing something? Thanks

(I can match it with page.waitForResponse(/\/api\/table\/customers\?id=1234/) in typescript playwright)

@mkorpela
Copy link
Member Author

The system uses regex matching so ?and = might be problems and might need to be escaped with \\. As Robot Framework uses \ as a escape char that actually might not require two of those. Hope this helps you to solve the problem!

@vincenzo-gasparo
Copy link
Contributor

Ok I tried \\ to escape ? and it didn't work, but \\\\? works, I don't know if it's the expected behavior but at least I solved the problem!

@mkorpela
Copy link
Member Author

That is a lot of escaping, thanks for letting us know!

@aaltat
Copy link
Member

aaltat commented Dec 14, 2020

Is it because the we need double escape, one for Robot Framework side and another in Python side? If yes, it might be good idea to find way to support Python raw-strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: high
Projects
None yet
Development

No branches or pull requests

3 participants