From fac5c0e7ddf487b620aa338f439a63931bddbfa2 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 14 Dec 2018 11:49:58 -0600 Subject: [PATCH] Resolve transient failure in Help page spec Sometimes due to a slow request to load the version check image, the placeholder image data was still being seen, resulting in this failure: expected "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" to end with "/version-check-url" Now we check the `data-src` attribute, which allows us to remove the `:js` metadata. This commit also removes a redundant test, which was just ensuring that the selector we were already using in the other test is visible. If this test were failing, the other one would always fail too, so it was pointless. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/55372 --- spec/features/help_pages_spec.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/spec/features/help_pages_spec.rb b/spec/features/help_pages_spec.rb index 8572a13055c..e24b1f4349d 100644 --- a/spec/features/help_pages_spec.rb +++ b/spec/features/help_pages_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Help Pages' do @@ -52,7 +54,7 @@ describe 'Help Pages' do end end - context 'in a production environment with version check enabled', :js do + context 'in a production environment with version check enabled' do before do stub_application_setting(version_check_enabled: true) @@ -64,12 +66,9 @@ describe 'Help Pages' do end it 'has a version check image' do - expect(find('.js-version-status-badge', visible: false)['src']).to end_with('/version-check-url') - end - - it 'hides the version check image if the image request fails' do - # We use '--load-images=yes' with poltergeist so the image fails to load - expect(page).to have_selector('.js-version-status-badge', visible: false) + # Check `data-src` due to lazy image loading + expect(find('.js-version-status-badge', visible: false)['data-src']) + .to end_with('/version-check-url') end end