Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use baseUrl instead of hardcoding port into specs #134

Closed
cblgh opened this issue Oct 2, 2018 · 3 comments
Closed

Use baseUrl instead of hardcoding port into specs #134

cblgh opened this issue Oct 2, 2018 · 3 comments
Assignees
Milestone

Comments

@cblgh
Copy link

cblgh commented Oct 2, 2018

👋

i'm doing research on frontend testing for the company i work for and i came across Cypress.

i tried to run the kitchen sink testing suite to see it in action, but since it relies on port 8080 being free it broke due to a pre-existing webserver.

as a first-timer to the project i was uncertain if there was a port i could set anywhere to have it listen to another webserver, but after some digging it turns out you've just hardcoded the request URLs in the specs.

my suggestion would be

  • remove the hardcoded paths in the specs
  • set "baseUrl": "http://127.0.0.1:8080/" in cypress.json
  • add a note to this project's readme that baseUrl should match the url from npm run start's output
Starting up http-server, serving app
Available on:
  http://127.0.0.1:8080    <--- (this was http://127.0.0.1:8083 in my case)

~cblgh

cblgh pushed a commit to cblgh/cypress-example-kitchensink that referenced this issue Oct 2, 2018
@cblgh
Copy link
Author

cblgh commented Oct 2, 2018

i went ahead and made a pr #135 with the suggestions above, feel free to do close/merge/whatever!

@jennifer-shehane jennifer-shehane added this to the Sprint 5 milestone Oct 2, 2018
@jennifer-shehane
Copy link
Member

jennifer-shehane commented Oct 2, 2018

@cblgh Thanks for the suggestion! This isn't the first time we have gotten it.

This repo serves 2 purposes which makes this change a little bit more work.

  1. It's a great repo to fork and get running yourself to play around with (as you have done).
  2. It serves as the scaffolding for the example project that Cypress seeds in every new project.

The suggestion you made works great for #1, but requires some changes to accommodate #2.

For #2, we do not include a cypress.json file in new projects. We also replace all of the urls with https://example.cypress.io so that they don't require any server to be running, so just including the baseUrl in the cypress.json file is not a solution.

We do already have a script written that transforms the localhost url to example.cypress.io url, so it is likely possible that we could also update the script to handle the url's missing the localhost url (since it's included in the cypress.json).

The cypress repo is open source, so if you could update the conversion script to handle this, we'd be glad to merge the changes in - otherwise, this is a low priority issue on our side that we likely will not have time to spend on.

@cblgh
Copy link
Author

cblgh commented Oct 2, 2018

alright, in that case i'll go ahead and close it :)

@cblgh cblgh closed this as completed Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants