citizenlabsgr / adopt-a-drain

Deploy an Adopt-a-Drain program for the Grand River watershed.
https://lgrow-staging.herokuapp.com
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

Implement Javascript testing framework #154

Open softwaresteph opened 5 years ago

softwaresteph commented 5 years ago

Problem

Had a tutoring session with Sam Bleckley and this was our conclusion:

Solution

Add a javascript testing framework that can do both unit tests and integration tests.

Once implemented, create these tests

  1. When the "Adopt" button is clicked in the info window, make sure the drain name adds to the sidebar
  2. When the "Abandon" button is clicked in the info window, make sure the drain name removes from the sidebar.
  3. Click a drain (info window opens), sign out. Make sure the info window changes.
  4. Click a drain (info window opens), sign in. Make sure the info window changes.
  5. Do the test above twice. I had a bug where it failed the second time.
  6. Click a drain (info window opens), sign up for a new account. Make sure the info window changes.
Wilfongjt commented 5 years ago

Someone pick a favorite javascript testing framework.

Ross-Hunter commented 5 years ago

If you want JS unit testing then we can use whatever JS testing framework is cool these days. I've never had much luck with JS unit testing.

The tests you are describing should be covered using Capybara/Feature/Integration tests -> https://semaphoreci.com/community/tutorials/integration-testing-ruby-on-rails-with-minitest-and-capybara

There are lots of different ways to configure these types, so it will require investigating how to hook everything up for MiniTest and Rails 4, because a lot of the information out there is for RSpec and/or Rails 5 which has System Tests baked in.