summaryrefslogtreecommitdiff
path: root/qa/qa/page
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/page')
-rw-r--r--qa/qa/page/file/form.rb40
-rw-r--r--qa/qa/page/file/shared/commit_message.rb19
-rw-r--r--qa/qa/page/file/show.rb30
-rw-r--r--qa/qa/page/main/oauth.rb2
-rw-r--r--qa/qa/page/project/settings/protected_branches.rb17
-rw-r--r--qa/qa/page/project/show.rb8
-rw-r--r--qa/qa/page/view.rb4
7 files changed, 100 insertions, 20 deletions
diff --git a/qa/qa/page/file/form.rb b/qa/qa/page/file/form.rb
new file mode 100644
index 00000000000..f6e502f500b
--- /dev/null
+++ b/qa/qa/page/file/form.rb
@@ -0,0 +1,40 @@
+module QA
+ module Page
+ module File
+ class Form < Page::Base
+ include Shared::CommitMessage
+
+ view 'app/views/projects/blob/_editor.html.haml' do
+ element :file_name, "text_field_tag 'file_name'"
+ element :editor, '#editor'
+ end
+
+ view 'app/views/projects/_commit_button.html.haml' do
+ element :commit_changes, "button_tag 'Commit changes'"
+ end
+
+ def add_name(name)
+ 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'
+ end
+
+ private
+
+ def text_area
+ find('#editor>textarea', visible: false)
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/file/shared/commit_message.rb b/qa/qa/page/file/shared/commit_message.rb
new file mode 100644
index 00000000000..5af1a55e2ef
--- /dev/null
+++ b/qa/qa/page/file/shared/commit_message.rb
@@ -0,0 +1,19 @@
+module QA
+ module Page
+ module File
+ module Shared
+ module CommitMessage
+ def self.included(base)
+ base.view 'app/views/shared/_commit_message_container.html.haml' do
+ element :commit_message, "text_area_tag 'commit_message'"
+ end
+ end
+
+ def add_commit_message(message)
+ fill_in 'commit_message', with: message
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/file/show.rb b/qa/qa/page/file/show.rb
new file mode 100644
index 00000000000..99f5924b67f
--- /dev/null
+++ b/qa/qa/page/file/show.rb
@@ -0,0 +1,30 @@
+module QA
+ module Page
+ module File
+ class Show < Page::Base
+ include Shared::CommitMessage
+
+ view 'app/helpers/blob_helper.rb' do
+ element :edit_button, "_('Edit')"
+ element :delete_button, /label:\s+"Delete"/
+ end
+
+ view 'app/views/projects/blob/_remove.html.haml' do
+ element :delete_file_button, "button_tag 'Delete file'"
+ end
+
+ def click_edit
+ click_on 'Edit'
+ end
+
+ def click_delete
+ click_on 'Delete'
+ end
+
+ def click_delete_file
+ click_on 'Delete file'
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/main/oauth.rb b/qa/qa/page/main/oauth.rb
index 6f548148363..618f114e058 100644
--- a/qa/qa/page/main/oauth.rb
+++ b/qa/qa/page/main/oauth.rb
@@ -3,7 +3,7 @@ module QA
module Main
class OAuth < Page::Base
view 'app/views/doorkeeper/authorizations/new.html.haml' do
- element :authorization_button, 'submit_tag "Authorize"'
+ element :authorization_button, 'submit_tag _("Authorize")'
end
def needs_authorization?
diff --git a/qa/qa/page/project/settings/protected_branches.rb b/qa/qa/page/project/settings/protected_branches.rb
index e572ae12132..76591a4e3fe 100644
--- a/qa/qa/page/project/settings/protected_branches.rb
+++ b/qa/qa/page/project/settings/protected_branches.rb
@@ -16,7 +16,6 @@ module QA
end
view 'app/views/projects/protected_branches/_update_protected_branch.html.haml' do
- element :allowed_to_push
element :allowed_to_merge
end
@@ -24,10 +23,6 @@ module QA
element :protected_branches_list
end
- view 'app/views/projects/protected_branches/shared/_protected_branch.html.haml' do
- element :protected_branch_name
- end
-
def select_branch(branch_name)
click_element :protected_branch_select
@@ -62,18 +57,6 @@ module QA
click_on 'Protect'
end
- def last_branch_name
- within_element(:protected_branches_list) do
- all('.qa-protected-branch-name').last
- end
- end
-
- def last_push_allowance
- within_element(:protected_branches_list) do
- all('.qa-allowed-to-push').last
- end
- end
-
private
def click_allow(action, text)
diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb
index 88861d5772d..1d3dad4cda0 100644
--- a/qa/qa/page/project/show.rb
+++ b/qa/qa/page/project/show.rb
@@ -31,10 +31,18 @@ module QA
element :tree_holder, '.tree-holder'
end
+ view 'app/presenters/project_presenter.rb' do
+ element :new_file_button, "label: _('New file'),"
+ end
+
def project_name
find('.qa-project-name').text
end
+ def go_to_new_file!
+ click_on 'New file'
+ end
+
def switch_to_branch(branch_name)
find_element(:branches_select).click
diff --git a/qa/qa/page/view.rb b/qa/qa/page/view.rb
index 6635e1ce039..b2a2da4dbf3 100644
--- a/qa/qa/page/view.rb
+++ b/qa/qa/page/view.rb
@@ -9,7 +9,7 @@ module QA
end
def pathname
- @pathname ||= Pathname.new(File.join(__dir__, '../../../', @path))
+ @pathname ||= Pathname.new(::File.join(__dir__, '../../../', @path))
.cleanpath.expand_path
end
@@ -23,7 +23,7 @@ module QA
# elements' existence.
#
@missing ||= @elements.dup.tap do |elements|
- File.foreach(pathname.to_s) do |line|
+ ::File.foreach(pathname.to_s) do |line|
elements.reject! { |element| element.matches?(line) }
end
end