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

Support for ember projects with a rootURL containing a subdirectory #180

Open
jordanbyron opened this issue Oct 10, 2019 · 3 comments
Open
Labels

Comments

@jordanbyron
Copy link

Hi Ya'll!

Unless I am mistaken, it doesn't appear this library supports ember projects hosted from within a subdirectory: rootURL: "/my-ember-app/" for example.

mockServer and visit all assume the ember project is being hosted at the bare root and as a result requests are missing the ember app.

I've poked around the code and see a few places I think would need to be changed to respect the host app's rootURL configuration. Let me know if this is something you plan on supporting or think would be easy to add support for.

Excellent work on the project. I was really excited to get this up and running and the documentation is stellar!

@ryanto
Copy link
Member

ryanto commented Oct 10, 2019

Hey @jordanbyron! Glad to hear you're liking the addon.

I think this is something we would be interested in supporting, I have two quick questions.

  1. What's the work around today? If the rootUrl = "/my-ember-app", Are you able to use visit('/my-ember-app/page1')? Or does visit not work with any URL?

  2. How does rootUrl work with Ember's acceptance tests?

Thanks!

@jordanbyron
Copy link
Author

jordanbyron commented Oct 10, 2019

Hey @ryanto,

What's the work around today?

Right now I don't have one.

If the rootUrl = "/my-ember-app", Are you able to use visit('/my-ember-app/page1')? Or does visit not work with any URL?

It does not work with fastboot tests, even if we prepend our sub directory to the visit string, as you did in your example. It appears all of the requests from fastboot-testing are hitting the server directly at the bare root url, not the sub directory, so they are missing the ember server entirely. Here is an example from our rails log which lives at the root:

Started GET "/__cleanup-mocks"
Started POST "/__fastboot-testing"

Obviously rails does not know how to respond to those requests, and they should instead be hitting /${config.rootURL}/__fastboot-testing.

The end result in our ember tests being:

Ember CLI FastBoot Testing: We were unable to render PATH. Is your test suite blocking or intercepting HTTP requests?

How does rootUrl work with Ember's acceptance tests?

Excellent question. In our acceptance tests we don't have to specify the rootURL when we call visit. I'm not sure what is happening under the hood, but regardless of what we have set for rootURL it seems to work as expected.

It may be worth pointing out that depending on our environment we do have different values in our config for rootURL, which is used by ember in the index.html file among other places, and EmberRouter#rootURL. I don't think those differences should matter as they are just a side effect for how our ember app is deployed, but I wanted to point them out just in case.

Hopefully that helps clarify what we are seeing. I'm happy to answer any more questions or spin up an example app if that would help illustrate what we are seeing.

@ryanto
Copy link
Member

ryanto commented Nov 12, 2019

Hey @jordanbyron

Sorry - this totally fell off my radar!

Thanks so much for doing all the research and writing all this up, it's super helpful!

I won't have time in the next few months to implement this, but this should be something fastboot-testing supports out of the box!

I think the best bet is for us to copy the same API that acceptance testing follows. Switching between acceptance tests and fastboot tests shouldn't require knowledge of inner workings, in fact I think visit should pretty much be copy & pasteable :) So let's do what they're doing.

Thanks again for writing all this up, really appreciate it!

@ryanto ryanto added bug and removed enhancement labels Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants