-
Notifications
You must be signed in to change notification settings - Fork 506
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
Issues with playwright engine and target url as baseURL #2583
Comments
Hey @servohatred Could you share a sample yaml and test script so I can test it out? I'd like to have a look if there's something we can do for our upcoming Monday release. Thanks! |
Sorry about the delay, I was trying to replicate the issue in another repo: add-to-cart.api.spec.ts
add-to-cart.yaml
|
Hey @servohatred 👋 Thanks for being thorough, it was very helpful to have an example to test against! From what I can tell, in the scenario you share, the issue is that you didn't add the protocol to your If I make that change in the scenario you shared, then everything runs for me. I am a bit confused as to why it suddenly stopped working for you after 2.0.6 though - I'd be curious to see how you were setting your base URL dynamically. Let me know if that works for you! 🙇♂️ |
That just worked, looks like something related to playwright. Thank you for all your help ! |
Great! Glad it worked. 👍🏼 |
Version info:
We got this update on 2.0.6 and suddenly all my playwright tests stopped working
Playwright’s baseURL is now set from target (#2493) - Documentation
The reason : there are some cases where we use a dynamic base urls for tests (in my case we use one for the apis and a different one for the app in multiple environments). It should be selected depending on the environment or application but you cannot do that in the yaml file(In my case is a ts file with a method). A terrible solution is to create a script to expose the BASE URL to the next script (artillery) something via env vars , like
BASE_URL=$(tsnode setmybaseurl.ts) && BASE_URL=$BASE_URL artillery run my.yml
so it would be ready for the yaml to use it , this does not work for me because I wont be able to combine API with UI methods. After the change we are forced to use a BASE_URL because if we dont pass one in the context options is going to use the target (and this is mandatory). In my case . It was required to not use any base url so I can set up the whole url manually in my page.goto() and my page.request.post() since both use different urls (both api and page methods are required for my tests and according to pw docs they use the BASE_URL by default if it's assigned).if I try to navigate to any page or post something I will always get this error:
If I pass the whole URL to my page.goto is not going to override the BASE URL , is going to append the full url to the base url and it's going to end up as an invalid url.
I think, that forcing people to have a target URL is fine for the http engine since you are using only APIS and it's required, but for playwright is a limitation since you are not going to be able to use both, API and UI methods.
PS: A good solution would be to allow people to override the target url with a blank URL but that does not work in the current version:
For some reason if I pass a baseURL:"" in the context options is not overriding the target which is a dummy url that used to be ignored by the playwright engine in <2.0.6
The text was updated successfully, but these errors were encountered: