diff --git a/spec/features/collection_drafts/forms/data_centers_form_spec.rb b/spec/features/collection_drafts/forms/data_centers_form_spec.rb index 1d41ce3a5..00082826e 100644 --- a/spec/features/collection_drafts/forms/data_centers_form_spec.rb +++ b/spec/features/collection_drafts/forms/data_centers_form_spec.rb @@ -27,7 +27,7 @@ within '#draft_data_centers_1' do select 'Originator', from: 'Role' - add_data_center('ESA/ED') + add_data_center_with_retry('ESA/ED') add_contact_information(type: 'data_center', single: false, button_type: 'Data Center') end diff --git a/spec/features/collection_drafts/forms/saving_data_centers_data_contacts_spec.rb b/spec/features/collection_drafts/forms/saving_data_centers_data_contacts_spec.rb index 6a31955e2..5fa7a27f0 100644 --- a/spec/features/collection_drafts/forms/saving_data_centers_data_contacts_spec.rb +++ b/spec/features/collection_drafts/forms/saving_data_centers_data_contacts_spec.rb @@ -66,7 +66,7 @@ within '.multiple.data-centers > .multiple-item-1' do select 'Originator', from: 'Role' - add_data_center('ESA/ED') + add_data_center_with_retry('ESA/ED') end within '.nav-top' do diff --git a/spec/features/collection_drafts/forms/validation_spec.rb b/spec/features/collection_drafts/forms/validation_spec.rb index ac0c80194..800af7f4f 100644 --- a/spec/features/collection_drafts/forms/validation_spec.rb +++ b/spec/features/collection_drafts/forms/validation_spec.rb @@ -290,6 +290,12 @@ fill_in 'draft_temporal_extents_0_single_date_times_0', with: '2015-07-01T00:00:00Z' end + # Bamboo spontaneously started failling this test with the apparent + # cause being that 'done' was not being clicked. Clicking something + # outside of the datepicker widget allows the done click to be + # processed correctly. Previously, it looks like the click for done + # was only exiting the single date time field. + find('#draft_temporal_extents_0_precision_of_seconds').click within '.nav-top' do click_on 'Done' end diff --git a/spec/support/draft_helpers.rb b/spec/support/draft_helpers.rb index bdf313501..41f3d8d05 100644 --- a/spec/support/draft_helpers.rb +++ b/spec/support/draft_helpers.rb @@ -48,6 +48,21 @@ def add_data_center(value) end end + # Bamboo started failing some tests where it seemed that the select2 was not + # opening properly. This is notably slower, so it should only be used when + # necessary. + def add_data_center_with_retry(value) + ActiveSupport::Notifications.instrument 'mmt.performance', activity: 'Helpers::DraftHelpers#add_data_center_with_retry' do + find('.select2-container .select2-selection').click + begin + find(:xpath, '//body').find('.select2-dropdown li.select2-results__option', text: value) + rescue Capybara::ElementNotFound + find('.select2-container .select2-selection').click + end + find(:xpath, '//body').find('.select2-dropdown li.select2-results__option', text: value).click + end + end + def add_person ActiveSupport::Notifications.instrument 'mmt.performance', activity: 'Helpers::DraftHelpers#add_person' do fill_in 'First Name', with: 'First Name'