bahmutov / bahmutov/cy-api

Test fails when baseUrl in cypress.json in not included

Open
#59 8 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
210
Forks
26
PR merge metrics
No merged PRs in 30d

Description

I use config files to switch between environment URL's. I have multiple URL's I need to initiate with as well on my different test suites. Hence, I am not using a specific `baseUrl`. However, if `baseUrl` is not present in `cypress.json`, my tests fail. I had to include this variable with an actual value (e.g. https://loginsite.com) but will never use it.
I understand it is not best practice, but switching between environments would require me with one environment 'http' and another having 'https' and multiple other reasons. Example:

> "baseUrls":
> {
> "protocol": "https://",
> "domain": "test.com",
> "subDomain": "login"
> }

![2020-03-28_0-35-43](https://user-images.githubusercontent.com/36245304/77762183-3d567f80-708d-11ea-916e-86023192aa54.png)

This is just a minor issue but I would like a cleaner code and not include parameters/variables that are not being used.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with a Cypress configuration that omits baseUrl, then compare it with the reported cypress.json setup and the project’s environment-specific config files. Confirm that tests can switch between the described HTTP and HTTPS URLs without requiring an unused baseUrl; the issue is done when the failing configuration runs successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cypress, typescript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.