summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2019-01-14 16:58:51 -0500
committerMark Lapierre <mlapierre@gitlab.com>2019-01-17 10:13:52 -0500
commit1720cbc8949e83ac4af835013cc58d5f84724b2c (patch)
treed00f69d362eff217f86f3ba10706dbc46fdd210d /qa
parent43f1a6b2907a212749c81d53d4928cfd675fee02 (diff)
downloadgitlab-ce-1720cbc8949e83ac4af835013cc58d5f84724b2c.tar.gz
Update merge request page object and rebase test
Use logged methods from Page::Base. Raise errors if rebase! and merge! don't leave the UI in the expected state.
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/page/merge_request/show.rb28
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb8
2 files changed, 20 insertions, 16 deletions
diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb
index 4f21ed602d9..3823afb9b9f 100644
--- a/qa/qa/page/merge_request/show.rb
+++ b/qa/qa/page/merge_request/show.rb
@@ -50,17 +50,17 @@ module QA
end
def fast_forward_possible?
- !has_text?('Fast-forward merge is not possible')
+ has_no_text?('Fast-forward merge is not possible')
end
def has_merge_button?
refresh
- has_css?(element_selector_css(:merge_button))
+ has_element?(:merge_button)
end
def has_merge_options?
- has_css?(element_selector_css(:merge_moment_dropdown))
+ has_element?(:merge_moment_dropdown)
end
def merge_immediately
@@ -75,19 +75,21 @@ module QA
def rebase!
# The rebase button is disabled on load
wait do
- has_css?(element_selector_css(:mr_rebase_button))
+ has_element?(:mr_rebase_button)
end
# The rebase button is enabled via JS
wait(reload: false) do
- !first(element_selector_css(:mr_rebase_button)).disabled?
+ !find_element(:mr_rebase_button).disabled?
end
click_element :mr_rebase_button
- wait(reload: false) do
+ success = wait(reload: false) do
has_text?('Fast-forward merge without a merge commit')
end
+
+ raise "Rebase did not appear to be successful" unless success
end
def has_assignee?(username)
@@ -106,30 +108,32 @@ module QA
def merge!
# The merge button is disabled on load
wait do
- has_css?(element_selector_css(:merge_button))
+ has_element?(:merge_button)
end
# The merge button is enabled via JS
wait(reload: false) do
- !first(element_selector_css(:merge_button)).disabled?
+ !find_element(:merge_button).disabled?
end
merge_immediately
- wait(reload: false) do
+ success = wait(reload: false) do
has_text?('The changes were merged into')
end
+
+ raise "Merge did not appear to be successful" unless success
end
def mark_to_squash
# The squash checkbox is disabled on load
wait do
- has_css?(element_selector_css(:squash_checkbox))
+ has_element?(:squash_checkbox)
end
# The squash checkbox is enabled via JS
wait(reload: false) do
- !first(element_selector_css(:squash_checkbox)).disabled?
+ !find_element(:squash_checkbox).disabled?
end
click_element :squash_checkbox
@@ -145,7 +149,7 @@ module QA
def add_comment_to_diff(text)
wait(time: 5) do
- page.has_text?("No newline at end of file")
+ has_text?("No newline at end of file")
end
all_elements(:new_diff_line).first.hover
click_element :diff_comment
diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb
index e2d639fd150..e70d9343fb6 100644
--- a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb
@@ -5,15 +5,15 @@ module QA
describe 'Merge request rebasing' do
it 'user rebases source branch of merge request' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
- Page::Main::Login.act { sign_in_using_credentials }
+ Page::Main::Login.perform(&:sign_in_using_credentials)
project = Resource::Project.fabricate! do |project|
project.name = "only-fast-forward"
end
project.visit!
- Page::Project::Menu.act { go_to_settings }
- Page::Project::Settings::MergeRequest.act { enable_ff_only }
+ Page::Project::Menu.perform(&:go_to_settings)
+ Page::Project::Settings::MergeRequest.perform(&:enable_ff_only)
merge_request = Resource::MergeRequest.fabricate! do |merge_request|
merge_request.project = project
@@ -38,7 +38,7 @@ module QA
merge_request.rebase!
expect(merge_request).to have_merge_button
- expect(merge_request.fast_forward_possible?).to be_truthy
+ expect(merge_request).to be_fast_forward_possible
end
end
end