From 49b9d8aef95dc1b0fe7ca8db9f5fab9ac35edfa5 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 3 Sep 2016 20:51:18 -0700 Subject: Fix randomly failing specs in expand_collapse_diff_spec: ``` Failure/Error: namespace.human_name + ' / ' + name ActionView::Template::Error: undefined method `+' for nil:NilClass # ./app/models/project.rb:807:in `name_with_namespace' # ./app/views/layouts/project.html.haml:1:in `_app_views_layouts_project_html_haml___2918737809244135908_70160161538920 ' # ./app/controllers/projects/commit_controller.rb:23:in `show' # ./lib/gitlab/request_profiler/middleware.rb:15:in `call' # ./lib/gitlab/middleware/go.rb:16:in `call' # ./lib/gitlab/middleware/static.rb:9:in `call' # ------------------ # --- Caused by: --- # NoMethodError: # undefined method `+' for nil:NilClass # ./app/models/project.rb:807:in `name_with_namespace' ``` Capybara's `click_link` method doesn't actually wait for the page to reload. When the `expand_all_diffs` parameter is used, we need to search for unique elements that appear to ensure that the page has actually reloaded. Closes #21841 --- spec/features/expand_collapse_diffs_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/features/expand_collapse_diffs_spec.rb b/spec/features/expand_collapse_diffs_spec.rb index 688f68d3cff..8863554ee91 100644 --- a/spec/features/expand_collapse_diffs_spec.rb +++ b/spec/features/expand_collapse_diffs_spec.rb @@ -211,6 +211,13 @@ feature 'Expand and collapse diffs', js: true, feature: true do context 'expanding all diffs' do before do click_link('Expand all') + + # Wait for elements to appear to ensure full page reload + expect(page).to have_content('This diff was suppressed by a .gitattributes entry') + expect(page).to have_content('This diff could not be displayed because it is too large.') + expect(page).to have_content('too_large_image.jpg') + find('.note-textarea') + wait_for_ajax execute_script('window.ajaxUris = []; $(document).ajaxSend(function(event, xhr, settings) { ajaxUris.push(settings.url) });') end -- cgit v1.2.1