From 395bf26a4b2485a87ed8da43d92a274cd9decb0b Mon Sep 17 00:00:00 2001 From: benjamin wil Date: Thu, 25 Aug 2022 08:54:24 -0700 Subject: [PATCH] Test localization for some views In #1853, it was reported that some views are errorring out due to missing translations. These tests exercise the translations for the reported views. --- test/integration/test_localization.rb | 61 +++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 test/integration/test_localization.rb diff --git a/test/integration/test_localization.rb b/test/integration/test_localization.rb new file mode 100644 index 00000000..814ef8ed --- /dev/null +++ b/test/integration/test_localization.rb @@ -0,0 +1,61 @@ +require_relative '../capybara_helper' + +context 'Localized frontend' do + include Capybara::DSL + + setup do + @path = cloned_testpath "examples/lotr.git" + @wiki = Gollum::Wiki.new(@path) + + Precious::App.set :gollum_path, @path + Precious::App.set :wiki_options, {mathjax: true} + + Capybara.app = Precious::App + end + + test 'can visit search results page' do + visit '/gollum/search' + + fill_in('Search', with: 'something-to-return-no-results') + .native + .send_keys(:return) + + assert_includes page.text, + 'Search results for something-to-return-no-results' + assert_includes page.text, + 'There are no results for your search something-to-return-no-results.' + + click_on 'Back to Top' + + visit '/gollum/search' + + fill_in('Search', with: 'Bilbo').native.send_keys(:return) + + assert_includes page.text, 'Search results for Bilbo' + + click_on 'Show all hits on this page' + click_on 'Bilbo-Baggins.md' + + assert page.current_path, '/Bilbo-Baggins.md' + end + + test 'can visit overview page' do + visit "/gollum/overview" + + assert_includes page.text, 'Overview of master' + assert_includes page.text, 'Home' + + click_on 'Back to Top' + click_on 'Bilbo-Baggins.md' + + assert page.current_path, '/Bilbo-Baggins.md' + end + + teardown do + @path = nil + @wiki = nil + + Capybara.reset_sessions! + Capybara.use_default_driver + end +end