-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
🚀 Feature Request
Allow setting the basePath in addition to the baseURL, to make the function page.goto() navigate always from the base path.
Example
I need to test multiple copies of the website in parallel:
http://localhost:3000/feature1/http://localhost:3000/feature2/http://localhost:3000/feature3/
There is an ability to set the baseURL with the initial path in the playwright.config.ts with the slash (/) at the end, like this:
use: {
/**
* Examples:
* - baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
* - baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in
* `http://localhost:3000/foo/bar.html`
* - baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in
* `http://localhost:3000/bar.html`
*/
baseURL: `http://localhost:3000/feature2/`But this doesn't work as expected, because it also requires modifying all tests to use relative paths in all the goto() calls.
I don't want to modify all my tests to use relative paths like page.goto('./account/settings') or page.goto('account/settings') instead of the standard page.goto('/account/settings').
Much better would be to add a new parameter to the use configuration object that declares the base prefix, like this:
use: {
baseURL: `http://localhost:3000`
basePrefix: `/feature2`
}What do you think about this idea? Or, if someone have better ideas on how to resolve this, please share!
Motivation
Pretty often, the test environment runs multiple copies of the website with different features, which makes it possible to test them in parallel. Usually, they are divided by a path prefix, like this:
http://localhost:3000/feature1/http://localhost:3000/feature2/http://localhost:3000/feature3/
For now, Payload doesn't provide the ability to set the base path prefix, which will be applied to all page.goto() calls. The feature request is to add this ability.