From af570a97e3e51d8795a528564fa93fa14182aa2a Mon Sep 17 00:00:00 2001 From: benjamin wil Date: Sun, 14 Aug 2022 14:33:27 -0700 Subject: [PATCH] Test the help panel's "Emoji" section This test is passing. I wrote it so I can safely change this panel in a subsequent commit. --- test/integration/test_editor.rb | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 test/integration/test_editor.rb diff --git a/test/integration/test_editor.rb b/test/integration/test_editor.rb new file mode 100644 index 00000000..a85561f9 --- /dev/null +++ b/test/integration/test_editor.rb @@ -0,0 +1,52 @@ +require_relative "../capybara_helper" + +context "editor interface" 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, {} + + Capybara.app = Precious::App + end + + teardown do + @path = nil + @wiki = nil + + Capybara.reset_sessions! + Capybara.use_default_driver + end + + test "editor renders help panel" do + visit "/create/new-article" + + in_editor_toolbar do + click_on "Help" + end + + help_widget = find "#gollum-editor-help" + + within help_widget do + click_on "Miscellaneous" + click_on "Emoji" + + assert_includes page.text, + "See the EmojiOne demo for all available emoji. To include one, " \ + "wrap the emoji name in colons and use underscores instead of " \ + "spaces (e.g. :heart: or :point_up:)." + end + + end + + def in_editor_toolbar &block + return unless block_given? + + within "#gollum-editor-function-bar" do + yield + end + end +end