playwright-community / jest-playwright

Running tests using Jest & Playwright
MIT License
531 stars 75 forks source link

Provides the method for getting the `baseURL` #785

Closed aha-oretama closed 2 years ago

aha-oretama commented 2 years ago

Is your feature request related to a problem? Please describe. New baseURL option in browser.newContext([options]) and browser.newPage([options]) was introduced in Playwright v1.13.

We often need to get the baseURL, and try to get it from somewhere such as browserContext. But I couldn't find the proper method or property to get the baseURL.

Describe the solution you'd like

I'm glad if the jest-playwright provides the method for getting the baseURL. How about defining baseURL as global variable like these?

https://github.com/playwright-community/jest-playwright/blob/6054b72f5ee937b9673683c806b02d91e2c8e379/src/PlaywrightEnvironment.ts#L259-L260

Additional context

I've already asked playwright repository. https://github.com/microsoft/playwright/issues/9439

mxschmitt commented 2 years ago

jest-playwright is in maintenance mode, we recommend switching to the official test-runner: https://playwright.dev/docs/intro

In the official test-runner you can get it via the baseURL fixture.