diff --git a/spec/support/common_actions/verifications.rb b/spec/support/common_actions/verifications.rb index d9c4b2c68..b6e65fae4 100644 --- a/spec/support/common_actions/verifications.rb +++ b/spec/support/common_actions/verifications.rb @@ -55,4 +55,13 @@ module Verifications within_frame(0) { find("body").set(with) } end end + + def fill_in_markdown_editor(label, with:) + click_link "Launch text editor" + fill_in label, with: with + + within(".fullscreen") do + click_link "Close text editor" + end + end end diff --git a/spec/system/admin/legislation/draft_versions_spec.rb b/spec/system/admin/legislation/draft_versions_spec.rb index e6c12238d..5ac47be22 100644 --- a/spec/system/admin/legislation/draft_versions_spec.rb +++ b/spec/system/admin/legislation/draft_versions_spec.rb @@ -83,14 +83,7 @@ describe "Admin legislation draft versions" do click_link "Version 1" fill_in "Version title", with: "Version 1b" - - click_link "Launch text editor" - - fill_in "Text", with: "# Version 1 body\r\n\r\nParagraph\r\n\r\n>Quote" - - within(".fullscreen") do - click_link "Close text editor" - end + fill_in_markdown_editor "Text", with: "# Version 1 body\r\n\r\nParagraph\r\n\r\n>Quote" click_button "Save changes"