blob: c01d179770c80e0bc76cb5b44b1e2e9270316115 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# frozen_string_literal: true
# These helpers help you interact within the Editor Lite (single-file editor, snippets, etc.).
#
module Spec
module Support
module Helpers
module Features
module SnippetSpecHelpers
include ActionView::Helpers::JavaScriptHelper
include Spec::Support::Helpers::Features::EditorLiteSpecHelpers
def snippet_get_first_blob_path
page.find_field(snippet_blob_path_field, match: :first).value
end
def snippet_get_first_blob_value
page.find(snippet_blob_content_selector, match: :first)
end
def snippet_description_value
page.find_field(snippet_description_field).value
end
def snippet_fill_in_form(title:, content:, description: '')
# fill_in snippet_title_field, with: title
# editor_set_value(content)
fill_in snippet_title_field, with: title
if description
# Click placeholder first to expand full description field
description_field.click
fill_in snippet_description_field, with: description
end
page.within('.file-editor') do
el = find('.inputarea')
el.send_keys content
end
end
private
def description_field
find('.js-description-input').find('input,textarea')
end
end
end
end
end
end
|