Merge pull request #7478 from opf/version_board_spec

Improve testing on version_board_spec

[ci skip]
pull/7479/head
Oliver Günther 5 years ago committed by GitHub
commit 39a66f7b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      modules/boards/spec/features/action_boards/version_board_spec.rb
  2. 10
      spec/support/rspec_retry.rb

@ -214,9 +214,23 @@ describe 'Version action board', type: :feature, js: true do
visit settings_project_path(project, tab: 'versions')
expect(page).to have_content 'Completely new version'
expect(page).to have_content 'Closed version'
board_page.visit!
board_page.add_list option: closed_version.name
board_page.expect_list 'Open version'
board_page.expect_list 'A second version'
board_page.expect_list 'Completely new version'
board_page.expect_card('Open version', 'Foo')
queries = board_page.board(reload: true).contained_queries
closed = queries.find_by(name: 'Closed version')
expect(closed).to be_nil
retry_block(screenshot: true) do
board_page.add_list option: closed_version.name
end
board_page.expect_list 'Closed version'
expect(page).to have_selector('.version-board-header.-closed')

@ -35,12 +35,20 @@ end
##
# Helper to pass options to retriable while logging
# failures
def retry_block(args: {}, &block)
def retry_block(args: {}, screenshot: false, &block)
log_errors = Proc.new do |exception, try, elapsed_time, next_interval|
$stderr.puts <<-EOS.strip_heredoc
#{exception.class}: '#{exception.message}'
#{try} tries in #{elapsed_time} seconds and #{next_interval} seconds until the next try.
EOS
if screenshot
begin
Capybara::Screenshot.screenshot_and_save_page
rescue StandardError => e
$stderr.puts "Failed to take screenshot in retry_block: #{e} #{e.message}"
end
end
end
Retriable.retriable(args.merge(on_retry: log_errors), &block)

Loading…
Cancel
Save