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 existing version of phantomjs for JS specs #275

Merged
merged 1 commit into from Dec 19, 2016
Merged

Conversation

@fofr
Copy link
Contributor

@fofr fofr commented Dec 16, 2016

Don’t download and install phantomjs

For reference:
searls/jasmine-rails#154

Don’t download and install phantomjs

For reference:
searls/jasmine-rails#154
@tijmenb tijmenb merged commit c3e18fb into master Dec 19, 2016
1 check passed
1 check passed
default Build #1062 succeeded on Jenkins
Details
@tijmenb tijmenb deleted the use-own-phantom branch Dec 19, 2016
fofr referenced this pull request in alphagov/government-frontend Apr 10, 2017
In order to write integration tests that can test for hidden elements (aka use `visible: true` and `visible: false`) we need to upgrade from RackTest to Poltergeist.
RackTest will ignore CSS and Javascript, and does not know how to test hidden elements.

This will be used to test the effect of print stylesheets being developed for this Trello card: https://trello.com/c/88zaXS8J/47-create-print-styles-for-official-documents

After adding Poltergeist, memory caching in Capybara was turned on by default. This meant that some tests were ocassionally failing when they were visiting the same path. In our case, if `government_navigation_test.rb` ran before `phase_label_test.rb`, then the second test would fail. The first test would visit `"/government/case-studies/get-britain-building-carlisle-park"` and cache it. Consequently, the second test would fail with an error that wouldn't obviously indicate caching is the problem.

```

.F

Failure:
PhaseLabelTest#test_Alpha_phase_label_is_displayed_for_a_Case_Study_in_phase_'alpha' [/var/govuk/government-frontend/test/integration/phase_label_test.rb:12]:
Expected false to be truthy.

bin/rails test test/integration/phase_label_test.rb:4

Finished in 3.388734s, 0.5902 runs/s, 0.5902 assertions/s.
```

Due to it taking a while to figure the cause, caching in Capybara has been turned off by default. This is how it's being done:

```

class Minitest::Test
  def teardown
    Capybara.current_session.driver.clear_memory_cache
  end
end
```

Caching can be turned on for specific tests if necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.