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:
cypress.config-admin.ts
, where I have the baseUrl for the admin page (as inwww.mypage.admin.com
). I pass the --config-file tag in thepackage.json
file for headless tests.cypress.config-user.ts
where I have the baseUrl for the user page (www.mypage.com
). I pass the --config-file tag in thepackage.json
file for headless tests.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
Post a Comment