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

feat(playwright): use target as baseURL by default #2493

Conversation

bernardobridge
Copy link
Contributor

@bernardobridge bernardobridge commented Feb 15, 2024

Description

target will now be used as Playwright's baseURL by default. This change makes artillery-engine-playwright more consistent with Playwright (which allows the baseURL config option), and simplifies the job of reusing a Playwright test as an Artillery test, as you can simply set the target as the baseURL option from your Playwright tests, and keep the test scripts the same.

Testing

  • Tested existing test scripts from examples - they work as normal with the full URL, and work when we pass just the path (e.g. await page.goto('/docs')).

Note: I'll change some of the examples to leverage this when a new CLI version contains the change.

Pre-merge checklist

  • Does this require an update to the docs? Yes
  • Does this require a changelog entry? Yes

@bernardobridge bernardobridge requested a review from a team February 15, 2024 16:00
@hassy
Copy link
Member

hassy commented Feb 16, 2024

lgtm!

@bernardobridge bernardobridge merged commit 347c371 into main Feb 16, 2024
15 checks passed
@bernardobridge bernardobridge deleted the bernardobridge/art-1624-allow-usage-of-baseurl-in-playwright-tests branch February 16, 2024 13:45
@flazouh
Copy link

flazouh commented Mar 12, 2024

I'm having trouble configuring this, this is my yaml:

config:
  engines:
    playwright: {
      contextOptions: {
        baseURL: "http://localhost:3000"
      }
    }
  processor: "./main.ts"
scenarios:
  - engine: playwright
    testFunction: "main"

Because it says

Error: No target specified and no environment chosen

What's the point of this PR if I have to repeat the target if it's already set in the baseURL ?

@hassy
Copy link
Member

hassy commented Mar 12, 2024

@alexandredepape the point is that you need to set target which will be passed into Playwright config as the baseURL. You don't need to set it via contextOptions.

@flazouh
Copy link

flazouh commented Mar 12, 2024

Got it, thanks 👌

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

Successfully merging this pull request may close these issues.

3 participants