Set Playwright project options
Learn how to configure Playwright project options via the BrowserStack SDK
The BrowserStack SDK simplifies the configuration and management of your Playwright test projects. It enables you to efficiently set up your testing environment and streamline your workflows.
In this topic, you learn how to set the Playwright project name and base URL via the BrowserStack SDK.
Set name via SDK
A Playwright project is a distinct set of configurations under which tests are executed. A project has a name that’s used to identify the project in test results and logs, making it easier to distinguish between different configurations or browser setups you might be using. If you don’t provide a name, Playwright assigns one automatically.
To set project names via the BrowserStack SDK, use the name
attribute under the playwrightConfigOptions
section in the browserstack.yml
file as shown here:
In the sample, we have three Playwright projects defined, windows, osX, and samsung, each with its own set of test configurations, and these names help you identify your projects in test results and logs.
To run tests on specific platforms, in the command for running Playwright tests with the SDK, specify the project argument and set it to the required project names, separated by comma:
If you have additional configuration defined in playwright.config.js
that you want to use for your test run, set -–config=playwright.config.js
in your package.json
file, or add it before the project
argument in the test run command.
If you want your tests run for a single project, specify its name as the value of the project argument.
The name
attribute is distinct from the project
attribute, which is a BrowserStack capability. The capability used to filter projects on the Automate dashboard. To learn more about the project
capability, see Name and organize your tests.
Set baseURL via SDK
The baseURL
parameter in Playwright is used to configure the base (root) URL for all your tests. When you navigate to a relative URL in a test, it’s resolved against your baseURL
. In the absense of baseURL
, you must use the complete URL in your test scripts. In a Playwright test project, the base URL is set as a configuration option within the use object.
To set baseURL
for a Playwright project via the BrowserStack SDK, nest it under the use
section within playwrightConfigOptions
in the browserstack.yml
file as shown here:
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
- RESOURCES
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!