From e22e26c31381d18d6ef1e1c2f631717f18a48feb Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 3 Sep 2024 08:58:33 -0700 Subject: [PATCH 01/12] Trying to figure CI tests out --- spec/features/in_document_search_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/features/in_document_search_spec.rb b/spec/features/in_document_search_spec.rb index f4e7994..14cefdb 100644 --- a/spec/features/in_document_search_spec.rb +++ b/spec/features/in_document_search_spec.rb @@ -37,6 +37,7 @@ # sidebar is open page.find('.mirador-companion-area-left') # input is populated with the search term + # Checking if this passes normally. page.find('input[value="justice"]') # buttons are present expect(page.find('h3')).to have_text 'Search' From 6f51d4cfafceaf4bd9e1727ffb5e4454efa57ea9 Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 3 Sep 2024 09:05:00 -0700 Subject: [PATCH 02/12] Timing issue? --- spec/features/in_document_search_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/features/in_document_search_spec.rb b/spec/features/in_document_search_spec.rb index 14cefdb..16f1dce 100644 --- a/spec/features/in_document_search_spec.rb +++ b/spec/features/in_document_search_spec.rb @@ -38,6 +38,7 @@ page.find('.mirador-companion-area-left') # input is populated with the search term # Checking if this passes normally. + sleep 2 page.find('input[value="justice"]') # buttons are present expect(page.find('h3')).to have_text 'Search' From 9fde182f15c9a487f9fbef34219b42757ebd2890 Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 3 Sep 2024 09:12:44 -0700 Subject: [PATCH 03/12] Longer sleep? Takes ages locally. --- spec/features/in_document_search_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/features/in_document_search_spec.rb b/spec/features/in_document_search_spec.rb index 16f1dce..72b2806 100644 --- a/spec/features/in_document_search_spec.rb +++ b/spec/features/in_document_search_spec.rb @@ -32,13 +32,14 @@ click_on 'Search for "justice" in document text' end + # Viewer is taking a long time to load? + sleep 10 + # iframe containing sul-embed/mirador viewer within_frame do # sidebar is open page.find('.mirador-companion-area-left') # input is populated with the search term - # Checking if this passes normally. - sleep 2 page.find('input[value="justice"]') # buttons are present expect(page.find('h3')).to have_text 'Search' From 083b7e67b9eb608a50bab7946d94dfa5e7983dc3 Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 3 Sep 2024 09:34:41 -0700 Subject: [PATCH 04/12] The position of the link changed? --- spec/features/in_document_search_spec.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/spec/features/in_document_search_spec.rb b/spec/features/in_document_search_spec.rb index 72b2806..6787668 100644 --- a/spec/features/in_document_search_spec.rb +++ b/spec/features/in_document_search_spec.rb @@ -28,12 +28,7 @@ # search results page visit "/nuremberg?search_field=all_fields&q=justice" - within first('article') do - click_on 'Search for "justice" in document text' - end - - # Viewer is taking a long time to load? - sleep 10 + click_on 'Search for "justice" in document text', match: :first # iframe containing sul-embed/mirador viewer within_frame do From 195d96a44e522950cb4272bd0cb399aaec2458ba Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 3 Sep 2024 09:42:25 -0700 Subject: [PATCH 05/12] Really seems like this should work... --- spec/features/in_document_search_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/features/in_document_search_spec.rb b/spec/features/in_document_search_spec.rb index 6787668..a04bb7b 100644 --- a/spec/features/in_document_search_spec.rb +++ b/spec/features/in_document_search_spec.rb @@ -28,8 +28,9 @@ # search results page visit "/nuremberg?search_field=all_fields&q=justice" + sleep 5 click_on 'Search for "justice" in document text', match: :first - + sleep 5 # iframe containing sul-embed/mirador viewer within_frame do # sidebar is open From 137f4d3aee6bc77132e0b8ff5636c7c936714115 Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 3 Sep 2024 09:53:11 -0700 Subject: [PATCH 06/12] Wrong iframe? --- spec/features/in_document_search_spec.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/features/in_document_search_spec.rb b/spec/features/in_document_search_spec.rb index a04bb7b..c1d196b 100644 --- a/spec/features/in_document_search_spec.rb +++ b/spec/features/in_document_search_spec.rb @@ -28,11 +28,10 @@ # search results page visit "/nuremberg?search_field=all_fields&q=justice" - sleep 5 click_on 'Search for "justice" in document text', match: :first - sleep 5 + # iframe containing sul-embed/mirador viewer - within_frame do + within_frame(find('iframe[title="Image viewer"]')) do # sidebar is open page.find('.mirador-companion-area-left') # input is populated with the search term From cf6bf229164818e05089c52e3e81520f7ad7e4e2 Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 3 Sep 2024 10:09:46 -0700 Subject: [PATCH 07/12] Does it pass without this? --- spec/features/in_document_search_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/in_document_search_spec.rb b/spec/features/in_document_search_spec.rb index c1d196b..3461a87 100644 --- a/spec/features/in_document_search_spec.rb +++ b/spec/features/in_document_search_spec.rb @@ -35,7 +35,7 @@ # sidebar is open page.find('.mirador-companion-area-left') # input is populated with the search term - page.find('input[value="justice"]') + # page.find('input[value="justice"]') # buttons are present expect(page.find('h3')).to have_text 'Search' expect(page.find('h3')).to have_text 'clear' From e19aede300aceb8eb4d0717c5063222f10891600 Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 3 Sep 2024 10:35:26 -0700 Subject: [PATCH 08/12] Out of view? --- spec/features/in_document_search_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/features/in_document_search_spec.rb b/spec/features/in_document_search_spec.rb index 3461a87..40ea91f 100644 --- a/spec/features/in_document_search_spec.rb +++ b/spec/features/in_document_search_spec.rb @@ -31,11 +31,13 @@ click_on 'Search for "justice" in document text', match: :first # iframe containing sul-embed/mirador viewer - within_frame(find('iframe[title="Image viewer"]')) do + iframe = find('iframe[title="Image viewer"]') + iframe.scroll_to(:center) + within_frame(iframe) do # sidebar is open page.find('.mirador-companion-area-left') # input is populated with the search term - # page.find('input[value="justice"]') + page.find('input[value="justice"]') # buttons are present expect(page.find('h3')).to have_text 'Search' expect(page.find('h3')).to have_text 'clear' From 2112a165561bae60abb240aaf912e907f38bb164 Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 3 Sep 2024 10:40:46 -0700 Subject: [PATCH 09/12] Visibility issue? --- spec/features/in_document_search_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/features/in_document_search_spec.rb b/spec/features/in_document_search_spec.rb index 40ea91f..702e588 100644 --- a/spec/features/in_document_search_spec.rb +++ b/spec/features/in_document_search_spec.rb @@ -37,10 +37,10 @@ # sidebar is open page.find('.mirador-companion-area-left') # input is populated with the search term - page.find('input[value="justice"]') + page.find('input[value="justice"]', visible: :all) # buttons are present - expect(page.find('h3')).to have_text 'Search' - expect(page.find('h3')).to have_text 'clear' + expect(page.find('h3', visible: :all)).to have_text 'Search' + expect(page.find('h3', visible: :all)).to have_text 'clear' end end end From 8cd90aa82ce6aa5fa7900d384ba24d24afd4f2af Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 3 Sep 2024 11:01:20 -0700 Subject: [PATCH 10/12] Still seems like visibility --- spec/features/in_document_search_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/features/in_document_search_spec.rb b/spec/features/in_document_search_spec.rb index 702e588..47b92f3 100644 --- a/spec/features/in_document_search_spec.rb +++ b/spec/features/in_document_search_spec.rb @@ -39,8 +39,10 @@ # input is populated with the search term page.find('input[value="justice"]', visible: :all) # buttons are present - expect(page.find('h3', visible: :all)).to have_text 'Search' - expect(page.find('h3', visible: :all)).to have_text 'clear' + # expect(page.find('h3', visible: :all)).to have_text 'Search' + expect(page).to have_css('h3', text: 'Search', visible: :all) + # expect(page.find('h3', visible: :all)).to have_text 'clear' + expect(page).to have_css('h3', text: 'clear', visible: :all) end end end From 1fb03bc3edc9497ca0a0109339c3eb0f2ac6aad5 Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 3 Sep 2024 11:15:05 -0700 Subject: [PATCH 11/12] What if we use the spotlight settings --- spec/features/in_document_search_spec.rb | 8 +++----- spec/support/capybara.rb | 7 +++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/spec/features/in_document_search_spec.rb b/spec/features/in_document_search_spec.rb index 47b92f3..40ea91f 100644 --- a/spec/features/in_document_search_spec.rb +++ b/spec/features/in_document_search_spec.rb @@ -37,12 +37,10 @@ # sidebar is open page.find('.mirador-companion-area-left') # input is populated with the search term - page.find('input[value="justice"]', visible: :all) + page.find('input[value="justice"]') # buttons are present - # expect(page.find('h3', visible: :all)).to have_text 'Search' - expect(page).to have_css('h3', text: 'Search', visible: :all) - # expect(page.find('h3', visible: :all)).to have_text 'clear' - expect(page).to have_css('h3', text: 'clear', visible: :all) + expect(page.find('h3')).to have_text 'Search' + expect(page.find('h3')).to have_text 'clear' end end end diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index a1bc812..6f9afb5 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -1,5 +1,12 @@ # frozen_string_literal: true +Capybara.register_driver :selenium_chrome_headless do |app| + browser_options = Selenium::WebDriver::Chrome::Options.new + browser_options.add_argument('--window-size=1920,1080') + browser_options.add_argument('--headless') + Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options) +end + Capybara.javascript_driver = :selenium_chrome_headless # The new headless chrome needs more default time. From f03a551a191e689b01b73e0b3cfbdf944973a955 Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 3 Sep 2024 11:19:43 -0700 Subject: [PATCH 12/12] Try the original tests --- spec/features/in_document_search_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/features/in_document_search_spec.rb b/spec/features/in_document_search_spec.rb index 40ea91f..f4e7994 100644 --- a/spec/features/in_document_search_spec.rb +++ b/spec/features/in_document_search_spec.rb @@ -28,12 +28,12 @@ # search results page visit "/nuremberg?search_field=all_fields&q=justice" - click_on 'Search for "justice" in document text', match: :first + within first('article') do + click_on 'Search for "justice" in document text' + end # iframe containing sul-embed/mirador viewer - iframe = find('iframe[title="Image viewer"]') - iframe.scroll_to(:center) - within_frame(iframe) do + within_frame do # sidebar is open page.find('.mirador-companion-area-left') # input is populated with the search term