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

Headers in default Playwright config values are not being reflected in Artillery performance tests #2593

Open
sruthii38 opened this issue Mar 22, 2024 · 2 comments

Comments

@sruthii38
Copy link

I have default headers that are configured in playwright.config.ts and it worked when running playwright test. When I call the same playwright test through artillery, it is not working.

This default config is specific to header.
I tried specifying config in different sections

config:
engines:
playwright:
contextOptions:
extraHTTPHeaders:
User-Agent: '****'
I have also tried setting at artillery default as well

config:
http:
defaults:
headers:
User-Agent: "*****"
None of these options worked.

Can you suggest a way to make this work?

@bernardobridge
Copy link
Contributor

Hi @sruthii38, the extraHTTPHeaders option should work (but not the config.http option).

Can you please share your config + scenario using Github Code Blocks? Without the proper formatting it's difficult to say what might be wrong.

@sruthii38 sruthii38 changed the title Utilizing default Playwright config values through Artillery Headers in default Playwright config values are not being reflected in Artillery performance tests Mar 26, 2024
@sruthii38
Copy link
Author

sruthii38 commented Mar 26, 2024

@bernardobridge Hi, the extraHTTPHeaders is working for initial URL load but the user on our website will get redirected by generating 302 status and authorize through headers but the default headers specified in Playwright are not being picked by artillery(Spec file in playwright is doing expected). So here are two problems

  1. The headers that Playwright passes from Playwright.config.ts to spec file execution are not being entirely honored by artillery(Spec file passes on Playwright test spec.js)

  2. The user have to specify the same headers in Playwright again in Artillery yml file as extraHTTPHeaders but still the test fails because Artillery is not carrying the extraHTTPHeaders to redirect Urls and the tests are failing.

To give you more context on the issue I found, the header that is not getting passed to redirect URL is "User-Agent". I can see it is still being the default on redirect URL when extraHTTPHeaders is passing a custom value. On the other hand Playwright spec file is passing the right header(User-Agent) for the entire test and passing the test. But Artillery run is failing. If I add userAgent header to extraHTTPHeaders along with User-Agent like below, the website is getting both headers while User-Agent is still default and userAgent is the custom value but we only need User-Agent for authorization.

playwright:
userAgent: '***'

yml:
extraHTTPHeaders:
User-Agent: ''
userAgent: '
'

Can you please help me if there is a work around for this scenario

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants