summaryrefslogtreecommitdiff
path: root/qa/qa/page/file
diff options
context:
space:
mode:
authorJennifer Louie <jlouie@gitlab.com>2019-07-02 08:05:31 +0000
committerSanad Liaquat <sliaquat@gitlab.com>2019-07-02 08:05:31 +0000
commit700853a178f7a512408c08ff7da9737e68b783ce (patch)
treee65590a730157c5c4be7eb9e5df69f4ecfc0e498 /qa/qa/page/file
parent3fd4c77ee4777464af74acd0c9dda319e1d29a44 (diff)
downloadgitlab-ce-700853a178f7a512408c08ff7da9737e68b783ce.tar.gz
QA: transfer project spec
Diffstat (limited to 'qa/qa/page/file')
-rw-r--r--qa/qa/page/file/edit.rb13
-rw-r--r--qa/qa/page/file/form.rb27
-rw-r--r--qa/qa/page/file/shared/commit_button.rb21
-rw-r--r--qa/qa/page/file/shared/editor.rb33
-rw-r--r--qa/qa/page/file/show.rb2
5 files changed, 71 insertions, 25 deletions
diff --git a/qa/qa/page/file/edit.rb b/qa/qa/page/file/edit.rb
new file mode 100644
index 00000000000..3a4a1837b1c
--- /dev/null
+++ b/qa/qa/page/file/edit.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module File
+ class Edit < Page::Base
+ include Shared::CommitMessage
+ include Shared::CommitButton
+ include Shared::Editor
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/file/form.rb b/qa/qa/page/file/form.rb
index e42de7d65c5..a6251f185f9 100644
--- a/qa/qa/page/file/form.rb
+++ b/qa/qa/page/file/form.rb
@@ -6,14 +6,11 @@ module QA
class Form < Page::Base
include Shared::CommitMessage
include Page::Component::DropdownFilter
+ include Shared::CommitButton
+ include Shared::Editor
view 'app/views/projects/blob/_editor.html.haml' do
element :file_name, "text_field_tag 'file_name'" # rubocop:disable QA/ElementWithPattern
- element :editor, '#editor' # rubocop:disable QA/ElementWithPattern
- end
-
- view 'app/views/projects/_commit_button.html.haml' do
- element :commit_changes, "button_tag 'Commit changes'" # rubocop:disable QA/ElementWithPattern
end
view 'app/views/projects/blob/_template_selectors.html.haml' do
@@ -28,20 +25,6 @@ module QA
fill_in 'file_name', with: name
end
- def add_content(content)
- text_area.set content
- end
-
- def remove_content
- text_area.send_keys([:command, 'a'], :backspace)
- end
-
- def commit_changes
- click_on 'Commit changes'
-
- finished_loading?
- end
-
def select_template(template_type, template)
click_element :template_type_dropdown
click_link template_type
@@ -60,12 +43,6 @@ module QA
end
filter_and_select template
end
-
- private
-
- def text_area
- find('#editor>textarea', visible: false)
- end
end
end
end
diff --git a/qa/qa/page/file/shared/commit_button.rb b/qa/qa/page/file/shared/commit_button.rb
new file mode 100644
index 00000000000..d8e751dd7b6
--- /dev/null
+++ b/qa/qa/page/file/shared/commit_button.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module File
+ module Shared
+ module CommitButton
+ def self.included(base)
+ base.view 'app/views/projects/_commit_button.html.haml' do
+ element :commit_button
+ end
+ end
+
+ def commit_changes
+ click_element(:commit_button)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/file/shared/editor.rb b/qa/qa/page/file/shared/editor.rb
new file mode 100644
index 00000000000..448c09cfbca
--- /dev/null
+++ b/qa/qa/page/file/shared/editor.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module File
+ module Shared
+ module Editor
+ def self.included(base)
+ base.view 'app/views/projects/blob/_editor.html.haml' do
+ element :editor
+ end
+ end
+
+ def add_content(content)
+ text_area.set content
+ end
+
+ def remove_content
+ text_area.send_keys([:command, 'a'], :backspace)
+ end
+
+ private
+
+ def text_area
+ within_element :editor do
+ find('textarea', visible: false)
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/file/show.rb b/qa/qa/page/file/show.rb
index eaf88c6e69e..92f9181f99d 100644
--- a/qa/qa/page/file/show.rb
+++ b/qa/qa/page/file/show.rb
@@ -5,6 +5,8 @@ module QA
module File
class Show < Page::Base
include Shared::CommitMessage
+ include Project::SubMenus::Settings
+ include Project::SubMenus::Common
view 'app/helpers/blob_helper.rb' do
element :edit_button, "_('Edit')" # rubocop:disable QA/ElementWithPattern