Commit aabc4876 authored by Ramya Authappan's avatar Ramya Authappan

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
parents 000a67f4 1720cbc8
...@@ -50,17 +50,17 @@ module QA ...@@ -50,17 +50,17 @@ module QA
end end
def fast_forward_possible? def fast_forward_possible?
!has_text?('Fast-forward merge is not possible') has_no_text?('Fast-forward merge is not possible')
end end
def has_merge_button? def has_merge_button?
refresh refresh
has_css?(element_selector_css(:merge_button)) has_element?(:merge_button)
end end
def has_merge_options? def has_merge_options?
has_css?(element_selector_css(:merge_moment_dropdown)) has_element?(:merge_moment_dropdown)
end end
def merge_immediately def merge_immediately
...@@ -75,19 +75,21 @@ module QA ...@@ -75,19 +75,21 @@ module QA
def rebase! def rebase!
# The rebase button is disabled on load # The rebase button is disabled on load
wait do wait do
has_css?(element_selector_css(:mr_rebase_button)) has_element?(:mr_rebase_button)
end end
# The rebase button is enabled via JS # The rebase button is enabled via JS
wait(reload: false) do wait(reload: false) do
!first(element_selector_css(:mr_rebase_button)).disabled? !find_element(:mr_rebase_button).disabled?
end end
click_element :mr_rebase_button click_element :mr_rebase_button
wait(reload: false) do success = wait(reload: false) do
has_text?('Fast-forward merge without a merge commit') has_text?('Fast-forward merge without a merge commit')
end end
raise "Rebase did not appear to be successful" unless success
end end
def has_assignee?(username) def has_assignee?(username)
...@@ -106,30 +108,32 @@ module QA ...@@ -106,30 +108,32 @@ module QA
def merge! def merge!
# The merge button is disabled on load # The merge button is disabled on load
wait do wait do
has_css?(element_selector_css(:merge_button)) has_element?(:merge_button)
end end
# The merge button is enabled via JS # The merge button is enabled via JS
wait(reload: false) do wait(reload: false) do
!first(element_selector_css(:merge_button)).disabled? !find_element(:merge_button).disabled?
end end
merge_immediately merge_immediately
wait(reload: false) do success = wait(reload: false) do
has_text?('The changes were merged into') has_text?('The changes were merged into')
end end
raise "Merge did not appear to be successful" unless success
end end
def mark_to_squash def mark_to_squash
# The squash checkbox is disabled on load # The squash checkbox is disabled on load
wait do wait do
has_css?(element_selector_css(:squash_checkbox)) has_element?(:squash_checkbox)
end end
# The squash checkbox is enabled via JS # The squash checkbox is enabled via JS
wait(reload: false) do wait(reload: false) do
!first(element_selector_css(:squash_checkbox)).disabled? !find_element(:squash_checkbox).disabled?
end end
click_element :squash_checkbox click_element :squash_checkbox
...@@ -145,7 +149,7 @@ module QA ...@@ -145,7 +149,7 @@ module QA
def add_comment_to_diff(text) def add_comment_to_diff(text)
wait(time: 5) do wait(time: 5) do
page.has_text?("No newline at end of file") has_text?("No newline at end of file")
end end
all_elements(:new_diff_line).first.hover all_elements(:new_diff_line).first.hover
click_element :diff_comment click_element :diff_comment
......
...@@ -5,15 +5,15 @@ module QA ...@@ -5,15 +5,15 @@ module QA
describe 'Merge request rebasing' do describe 'Merge request rebasing' do
it 'user rebases source branch of merge request' do it 'user rebases source branch of merge request' do
Runtime::Browser.visit(:gitlab, Page::Main::Login) 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 = Resource::Project.fabricate! do |project|
project.name = "only-fast-forward" project.name = "only-fast-forward"
end end
project.visit! project.visit!
Page::Project::Menu.act { go_to_settings } Page::Project::Menu.perform(&:go_to_settings)
Page::Project::Settings::MergeRequest.act { enable_ff_only } Page::Project::Settings::MergeRequest.perform(&:enable_ff_only)
merge_request = Resource::MergeRequest.fabricate! do |merge_request| merge_request = Resource::MergeRequest.fabricate! do |merge_request|
merge_request.project = project merge_request.project = project
...@@ -38,7 +38,7 @@ module QA ...@@ -38,7 +38,7 @@ module QA
merge_request.rebase! merge_request.rebase!
expect(merge_request).to have_merge_button 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 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