How are routes in acceptance tests declared?


(Alan Tan) #1

Hi all!

I’m currently working on the following PR:
https://github.com/discourse/discourse/pull/3607/files

However, I’m having trouble figuring out how routes are defined in acceptance tests. For instance visit('search') results in a not found page. I had a look at How to use fixtures or pretender in an Integration test but still couldn’t figure it out. Any help would be appreciated here :smile:


(Robin Ward) #2

This is really odd. I’m looking at it right now and will hopefully be able to post a solution soon.


(Robin Ward) #3

It looks like a search filter was missing and preventing the route from working in acceptance mode. I just committed a simple full page search acceptance test you can work from:

https://github.com/discourse/discourse/commit/f647174c956b71a3f1e3f4218e82cb320e24a0e1


(Alan Tan) #4

@eviltrout Thank you :yellow_heart: :blue_heart: :purple_heart: :green_heart: :heart:

To clarify further, does it mean that Discourse’s acceptance tests doesn’t start the entire app like how it is done for integration tests as specified in the guides?


(Robin Ward) #5

@tgxworld yes acceptance tests is just another word for integration tests as far as ember is concerned. It does load up quite a bit of the application though, but it is useful for testing how it works.


(Alan Tan) #6

Ah ok. Coming from a Rails Capybara kind of integration tests context, I would think of acceptance/integration tests as tests that would go interact with the UI and hit the backend api. In this case, it seems like the acceptance tests will always return a standard response from the fixtures and not filter the topics based on the search term./

I’m not sure how I would test the PR above because the error happens at the web server when we have a malformed URI.

Thanks in advanced!


(Robin Ward) #7

In this case you should test it on the server side only.