Skip to content

WIP: Find why travis fails on delete journal through edit & restore the test

Story in Trello

The test in journals_test.rb:

  test 'can_delete_a_journal_through_edit' do
    Journal.with_deleted.map(&:really_destroy!)
    create :journal, journalable: @volunteer
    visit volunteer_path(@volunteer)

    click_button 'Journal'
    within '#journalBlock' do
      click_link 'Edit'
    end
    page.find('a', text: 'Delete').click
    assert page.has_text? 'Journal was successfully deleted.'
    click_button 'Journal'
    refute page.has_link? @journal_volunteer.user.full_name
    refute page.has_text? @journal_volunteer.body
  end

Test result locally:

$ rt -v -n '/can_delete_a_journal_through_edit/' test/system/journals_test.rb
Run options: -v -n /can_delete_a_journal_through_edit/ --seed 12702
...
JournalsTest#test_can_delete_a_journal_through_edit = 8.10 s = .
...
Finished in 8.101300s, 0.1234 runs/s, 0.3703 assertions/s.
1 runs, 3 assertions, 0 failures, 0 errors, 0 skips

error output on travis.ci:

[Screenshot]: tmp/screenshots/failures_test_can_delete_a_journal_through_edit.png
E
Error:
JournalsTest#test_can_delete_a_journal_through_edit:
Capybara::ElementNotFound: Unable to find visible css "a" with text "Delete"
    test/system/journals_test.rb:45:in `block in <class:JournalsTest>'
bin/rails test test/system/journals_test.rb:36

with this changed test setup:

  test 'can_delete_a_journal_through_edit' do
    Journal.with_deleted.map(&:really_destroy!)
    create :journal, journalable: @volunteer
    visit volunteer_path(@volunteer)

    click_button 'Journal'
    within '#journalBlock' do
      page.find('a', text: 'Edit').click
    end
    page.find('a', text: 'Delete').click
    assert page.has_text? 'Journal was successfully deleted.'
    click_button 'Journal'
    refute page.has_link? @journal_volunteer.user.full_name
    refute page.has_text? @journal_volunteer.body
  end

Local result:

JournalsTest#test_can_delete_a_journal_through_edit = 8.07 s = .

Finished in 8.074810s, 0.1238 runs/s, 0.3715 assertions/s.
1 runs, 3 assertions, 0 failures, 0 errors, 0 skips

travis result:

[Screenshot]: tmp/screenshots/failures_test_can_delete_a_journal_through_edit.png
E

Error:
JournalsTest#test_can_delete_a_journal_through_edit:
Capybara::ElementNotFound: Unable to find visible css "a" with text "Delete"
    test/system/journals_test.rb:45:in `block in <class:JournalsTest>'


bin/rails test test/system/journals_test.rb:36

Merge request reports