def select_member_of_collection(collection)
      find('#s2id_member_of_collection_ids').click
      find('.select2-input').set(collection.title.first)
      # Crude way of waiting for the AJAX response
      select2_results = []
      time_elapsed = 0
      while select2_results.empty? && time_elapsed < 30
        begin_time = Time.now.to_f
        doc = Nokogiri::XML.parse(page.body)
        select2_results = doc.xpath('//html:li[contains(@class,"select2-result")]', html: 'http://www.w3.org/1999/xhtml')
        end_time = Time.now.to_f
        time_elapsed += end_time - begin_time
      end
      expect(page).to have_css('.select2-result')
      within ".select2-result" do
        find("span", text: collection.title.first).click
      end
    end
def select_member_of_collection(collection)
      find('#s2id_member_of_collection_ids').click
      find('.select2-input').set(collection.title.first)
      # Crude way of waiting for the AJAX response
      select2_results = []
      time_elapsed = 0
      while select2_results.empty? && time_elapsed < 30
        begin_time = Time.now.to_f
        doc = Nokogiri::XML.parse(page.body)
        select2_results = doc.xpath('//html:li[contains(@class,"select2-result")]', html: 'http://www.w3.org/1999/xhtml')
        end_time = Time.now.to_f
        time_elapsed += end_time - begin_time
      end
      expect(page).to have_css('.select2-result')
      within ".select2-result" do
        find("span", text: collection.title.first).click
      end
    end
For use with javascript collection selector that allows for searching for an existing collection from add to collection modal.
 Does not save the selection.  The calling test is expected to click Save and validate the collection membership was added to the work.
 @param [Collection] collection to select