Skip to content

Enhancement : Replace hardcoded URLs in Playwright tests with baseURL configuration #1827

@aaradhychinche-alt

Description

@aaradhychinche-alt

Description

Problem

Some Playwright tests in the repository use hardcoded URLs such as:

http://localhost:8080/signin

Using absolute URLs makes the tests dependent on a specific environment and port. This can cause problems when running tests in different environments such as:

  • CI pipelines
  • staging deployments
  • local environments using different ports

Because of this, the tests are less flexible and harder to reuse.


Proposed Solution

Instead of hardcoding the full URL, Playwright’s baseURL configuration can be used.

Before

await page.goto("http://localhost:8080/signin")

After

await page.goto("/signin")

Then define the base URL in playwright.config.js:

use: {
  baseURL: process.env.BASE_URL || "http://localhost:8080"
}

Benefits

  • Tests become environment-agnostic
  • Easier integration with CI
  • More maintainable Playwright tests
  • Allows running tests against staging or other environments easily

Next Steps

If this approach looks good, I would be happy to open a PR to update the Playwright tests and configure baseURL in the Playwright configuration.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions