How do I call my baseUrl when I have multiple configuration files in Cypress?

I have a Cypress framework where I'm testing a user page (where they can interact with the page, download files, update their profile, etc.), and an admin page for that user page (separate login, and can actually, as an admin, modify what's in the user page). For that reason, I have three configuration files:

  1. cypress.config-admin.ts, where I have the baseUrl for the admin page (as in www.mypage.admin.com). I pass the --config-file tag in the package.json file for headless tests.
  2. cypress.config-user.ts where I have the baseUrl for the user page (www.mypage.com). I pass the --config-file tag in the package.json file for headless tests.
  3. cypress-config.ts, which I use to run the tests manually via Cypress dashboard.

There are times where I need to use both URLs in the same test case (do something as an admin, verify as a user).

My issue is, when I use Cypress.config().baseUrl, it only brings up the values on cypress.config.ts. I've tried multiple things, but I haven't found a way to call the baseUrl on the admin or user config files.

https://docs.cypress.io/api/cypress-api/config seems to suggest I can pass the name of the configuration file, but I haven't been able to make that work =/

Any ideas?



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation