- Choose one of the following tracks:
- Skim/Read through the associated links
- Attempt to hook up and implement unit or feature js tests in your IdeaBox or this sample idea-bin project
- Fork this gist
- Respond with:
- Your experience implementing
- Were you successful?
- Links to commits on Github or copy and pasted code snippits of a test
I tried to feature test my idea box using capybara and selenium, and then I tried webkit and poltergeist too. At first I tried testing a user can see the index of ideas, but that wasn't successful. The ideas weren't showing on the page. I thought this might have something to do with using factory girl and my database being different for JS tests. So i switched to a test for user creating an idea. That still didn't work. Ultimately it seems like my ajax calls just are not firing in my tests, I used wait for ajax detailed by thoughtbot, and confirmed it was running with byebug, but still nothing happened in the firefox window that popped up.
Yes and no, I never figured out how to get AJAX working in the test, but wednesday I rewrote my app, originally it was wiping the screen and refetching through ajax on every change the user made. I rewrote it to keep the state of the app in JS on the front end and only fetch data on the first page load. This allowed me to use the feature testing without relying on the ajax request for that initital load. Still annoyed I couldn't get AJAX working though.