Commit 050e8436 authored by Ramya Authappan's avatar Ramya Authappan
Browse files

Merge branch 'qa-update-merge-request-page' into 'master'

Update merge request page object and rebase test

Closes gitlab-org/quality/staging#3

See merge request gitlab-org/gitlab-ce!24375
......@@ -50,17 +50,17 @@ class Show < Page::Base
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 @@ def merge_immediately
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 @@ def has_label?(label)
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 @@ def go_to_diffs_tab
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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment