20850: Fix test selector
[arvados.git] / apps / workbench / test / integration / search_box_test.rb
index 14d28d2adc7ac7b79436ede9b32bb32ac4c92371..51d615fe2d3383007bee3f7c7c0b441ef36c5e65 100644 (file)
@@ -1,3 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 require 'integration_helper'
 
 class SearchBoxTest < ActionDispatch::IntegrationTest
@@ -11,8 +15,8 @@ class SearchBoxTest < ActionDispatch::IntegrationTest
       aproject_uuid = api_fixture('groups')['aproject']['uuid']
       # let's search for aproject by uuid
       within('.navbar-fixed-top') do
-        page.has_field?('search')
-        page.find_field('search').set aproject_uuid
+        page.has_field?('search this site')
+        page.find_field('search this site').set aproject_uuid
         page.find('.glyphicon-search').click
       end
 
@@ -25,7 +29,7 @@ class SearchBoxTest < ActionDispatch::IntegrationTest
       within('.navbar-fixed-top') do
         search_for = String.new user['uuid']
         search_for[0]='1'
-        page.find_field('search').set search_for
+        page.find_field('search this site').set search_for
         page.find('.glyphicon-search').click
       end
 
@@ -61,7 +65,7 @@ class SearchBoxTest < ActionDispatch::IntegrationTest
 
       within('.navbar-fixed-top') do
         # search again for the anonymously accessible project
-        page.find_field('search').set publicly_accessible_project['name'][0,10]
+        page.find_field('search this site').set publicly_accessible_project['name'][0,10]
         page.find('.glyphicon-search').click
       end
 
@@ -70,7 +74,7 @@ class SearchBoxTest < ActionDispatch::IntegrationTest
         assert page.has_text?('Search'), 'No text - Search'
         assert page.has_text?('Cancel'), 'No text - Cancel'
         assert_selector('div', text: publicly_accessible_project['name'])
-        find(:xpath, '//div[./span[contains(.,publicly_accessible_project["uuid"])]]').click
+        find("div[data-object-uuid=#{publicly_accessible_project["uuid"]}]").click
 
         click_button 'Show'
       end
@@ -80,7 +84,7 @@ class SearchBoxTest < ActionDispatch::IntegrationTest
       assert page.has_text?(publicly_accessible_project['description']), 'No text - publicly accessible project description'
     else
       within('.navbar-fixed-top') do
-        page.has_no_field?('search')
+        page.has_no_field?('search this site')
       end
     end
   end