From 0151325dacebb99d54b6effb1d5842c0c712168c Mon Sep 17 00:00:00 2001 From: Fatih Acet Date: Tue, 9 May 2017 04:15:34 +0000 Subject: Merge request widget redesign --- features/project/commits/revert.feature | 3 +++ features/project/merge_requests.feature | 7 ++++++ features/project/merge_requests/accept.feature | 3 +-- features/steps/project/commits/revert.rb | 1 + features/steps/project/forked_merge_requests.rb | 3 +++ features/steps/project/merge_requests.rb | 25 ++++++++++++++++++---- .../steps/project/merge_requests/acceptance.rb | 18 ++++++++-------- features/steps/project/merge_requests/revert.rb | 4 +++- features/steps/shared/paths.rb | 6 ++++++ features/support/env.rb | 2 +- 10 files changed, 55 insertions(+), 17 deletions(-) (limited to 'features') diff --git a/features/project/commits/revert.feature b/features/project/commits/revert.feature index 7a2effafe03..7ee1d717d80 100644 --- a/features/project/commits/revert.feature +++ b/features/project/commits/revert.feature @@ -5,12 +5,14 @@ Feature: Revert Commits And I own a project And I visit my project's commits page + @javascript Scenario: I revert a commit Given I click on commit link And I click on the revert button And I revert the changes directly Then I should see the revert commit notice + @javascript Scenario: I revert a commit that was previously reverted Given I click on commit link And I click on the revert button @@ -21,6 +23,7 @@ Feature: Revert Commits And I revert the changes directly Then I should see a revert error + @javascript Scenario: I revert a commit in a new merge request Given I click on commit link And I click on the revert button diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature index bcde497553b..a8c528d3d6f 100644 --- a/features/project/merge_requests.feature +++ b/features/project/merge_requests.feature @@ -26,11 +26,13 @@ Feature: Project Merge Requests When I visit project "Shop" merge requests page Then I should see "feature_conflict" branch + @javascript Scenario: I should not see the numbers of diverged commits if the branch is rebased on the target Given project "Shop" have "Bug NS-07" open merge request with rebased branch When I visit merge request page "Bug NS-07" Then I should not see the diverged commits count + @javascript Scenario: I should see the numbers of diverged commits if the branch diverged from the target Given project "Shop" have "Bug NS-08" open merge request with diverged branch When I visit merge request page "Bug NS-08" @@ -46,21 +48,25 @@ Feature: Project Merge Requests Then I should see "Feature NS-03" in merge requests And I should see "Bug NS-04" in merge requests + @javascript Scenario: I visit an open merge request page Given I click link "Bug NS-04" Then I should see merge request "Bug NS-04" + @javascript Scenario: I visit a merged merge request page Given project "Shop" have "Feature NS-05" merged merge request And I click link "Merged" And I click link "Feature NS-05" Then I should see merge request "Feature NS-05" + @javascript Scenario: I close merge request page Given I click link "Bug NS-04" And I click link "Close" Then I should see closed merge request "Bug NS-04" + @javascript Scenario: I reopen merge request page Given I click link "Bug NS-04" And I click link "Close" @@ -176,6 +182,7 @@ Feature: Project Merge Requests # Markdown + @javascript Scenario: Headers inside the description should have ids generated for them. When I visit merge request page "Bug NS-04" Then Header "Description header" should have correct id and link diff --git a/features/project/merge_requests/accept.feature b/features/project/merge_requests/accept.feature index 330ec8ae0fe..c45ed9ea68b 100644 --- a/features/project/merge_requests/accept.feature +++ b/features/project/merge_requests/accept.feature @@ -7,7 +7,6 @@ Feature: Project Merge Requests Acceptance @javascript Scenario: Accepting the Merge Request and removing the source branch Given I am on the Merge Request detail page - When I click on "Remove source branch" option And I click on Accept Merge Request Then I should see merge request merged And I should not see the Remove Source Branch button @@ -15,7 +14,6 @@ Feature: Project Merge Requests Acceptance @javascript Scenario: Accepting the Merge Request when URL has an anchor Given I am on the Merge Request detail with note anchor page - When I click on "Remove source branch" option And I click on Accept Merge Request Then I should see merge request merged And I should not see the Remove Source Branch button @@ -23,6 +21,7 @@ Feature: Project Merge Requests Acceptance @javascript Scenario: Accepting the Merge Request without removing the source branch Given I am on the Merge Request detail page + When I click on "Remove source branch" option When I click on Accept Merge Request Then I should see merge request merged And I should see the Remove Source Branch button diff --git a/features/steps/project/commits/revert.rb b/features/steps/project/commits/revert.rb index c9746407344..114de129d19 100644 --- a/features/steps/project/commits/revert.rb +++ b/features/steps/project/commits/revert.rb @@ -10,6 +10,7 @@ class Spinach::Features::RevertCommits < Spinach::FeatureSteps end step 'I click on the revert button' do + find(".header-action-buttons .dropdown").click find("a[href='#modal-revert-commit']").click end diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb index 8081b764be6..310db6e6dad 100644 --- a/features/steps/project/forked_merge_requests.rb +++ b/features/steps/project/forked_merge_requests.rb @@ -4,6 +4,7 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps include SharedNote include SharedPaths include Select2Helper + include WaitForVueResource step 'I am a member of project "Shop"' do @project = ::Project.find_by(name: "Shop") @@ -31,6 +32,8 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps expect(page).to have_content @project.path_with_namespace expect(page).to have_content @merge_request.source_branch expect(page).to have_content @merge_request.target_branch + + wait_for_vue_resource end step 'I fill out a "Merge Request On Forked Project" merge request' do diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index 4b7d6cd840b..573be44c695 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -8,6 +8,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps include SharedDiffNote include SharedUser include WaitForAjax + include WaitForVueResource after do wait_for_ajax if javascript_test? @@ -45,19 +46,23 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps page.within '.merge-request' do expect(page).to have_content "Wiki Feature" end + wait_for_vue_resource end step 'I should see closed merge request "Bug NS-04"' do expect(page).to have_content "Bug NS-04" expect(page).to have_content "Closed by" + wait_for_vue_resource end step 'I should see merge request "Bug NS-04"' do expect(page).to have_content "Bug NS-04" + wait_for_vue_resource end step 'I should see merge request "Feature NS-05"' do expect(page).to have_content "Feature NS-05" + wait_for_vue_resource end step 'I should not see "master" branch' do @@ -358,10 +363,12 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps step 'I should see a badge of "1" next to the discussion link' do expect_discussion_badge_to_have_counter("1") + wait_for_vue_resource end step 'I should see a badge of "0" next to the discussion link' do expect_discussion_badge_to_have_counter("0") + wait_for_vue_resource end step 'I should see a discussion has started on commit diff' do @@ -369,6 +376,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps page.should have_content "#{current_user.name} #{current_user.to_reference} started a discussion on commit" page.should have_content sample_commit.line_code_path page.should have_content "Line is wrong" + wait_for_vue_resource end end @@ -376,16 +384,17 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps page.within(".notes .discussion") do page.should have_content "#{current_user.name} #{current_user.to_reference} started a discussion on commit" page.should have_content "One comment to rule them all" + wait_for_vue_resource end end step 'merge request is mergeable' do - expect(page).to have_button 'Accept merge request' + expect(page).to have_button 'Merge' end step 'I modify merge commit message' do click_button "Modify commit message" - fill_in 'commit_message', with: 'wow such merge' + fill_in 'Commit message', with: 'wow such merge' end step 'merge request "Bug NS-05" is mergeable' do @@ -394,24 +403,26 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps step 'I accept this merge request' do page.within '.mr-state-widget' do - click_button "Accept merge request" + click_button "Merge" end end step 'I should see merged request' do page.within '.status-box' do expect(page).to have_content "Merged" + wait_for_vue_resource end end step 'I click link "Reopen"' do - first(:css, '.reopen-mr-link').click + first(:css, '.reopen-mr-link').trigger('click') end step 'I should see reopened merge request "Bug NS-04"' do page.within '.status-box' do expect(page).to have_content "Open" end + wait_for_vue_resource end step 'I click link "Hide inline discussion" of the third file' do @@ -435,6 +446,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps step 'I should see a comment like "Line is wrong" in the third file' do page.within '.files>div:nth-child(3) .note-body > .note-text' do expect(page).to have_visible_content "Line is wrong" + wait_for_vue_resource end end @@ -502,6 +514,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps step 'I should see comments on the side-by-side diff page' do page.within '.files>div:nth-child(2) .parallel .note-body > .note-text' do expect(page).to have_visible_content "Line is correct" + wait_for_vue_resource end end @@ -557,12 +570,16 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps page.within ".mr-source-target" do expect(page).to have_content /([0-9]+ commits behind)/ end + + wait_for_vue_resource end step 'I should not see the diverged commits count' do page.within ".mr-source-target" do expect(page).not_to have_content /([0-9]+ commit[s]? behind)/ end + + wait_for_vue_resource end def merge_request diff --git a/features/steps/project/merge_requests/acceptance.rb b/features/steps/project/merge_requests/acceptance.rb index 7521a9439e3..3c976f675a2 100644 --- a/features/steps/project/merge_requests/acceptance.rb +++ b/features/steps/project/merge_requests/acceptance.rb @@ -1,7 +1,7 @@ class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps include LoginHelpers include GitlabRoutingHelper - include WaitForAjax + include WaitForVueResource step 'I am on the Merge Request detail page' do visit merge_request_path(@merge_request) @@ -12,27 +12,27 @@ class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps end step 'I click on "Remove source branch" option' do - check('Remove source branch') + uncheck('Remove source branch') end step 'I click on Accept Merge Request' do - click_button('Accept merge request') + click_button('Merge') end step 'I should see the Remove Source Branch button' do - expect(page).to have_link('Remove source branch') + expect(page).to have_selector('.js-remove-branch-button') - # Wait for AJAX requests to complete so they don't blow up if they are + # Wait for View Resource requests to complete so they don't blow up if they are # only handled after `DatabaseCleaner` has already run - wait_for_ajax + wait_for_vue_resource end step 'I should not see the Remove Source Branch button' do - expect(page).not_to have_link('Remove source branch') + expect(page).not_to have_selector('.js-remove-branch-button') - # Wait for AJAX requests to complete so they don't blow up if they are + # Wait for View Resource requests to complete so they don't blow up if they are # only handled after `DatabaseCleaner` has already run - wait_for_ajax + wait_for_vue_resource end step 'There is an open Merge Request' do diff --git a/features/steps/project/merge_requests/revert.rb b/features/steps/project/merge_requests/revert.rb index 1149c1c2426..aa76d6f8c48 100644 --- a/features/steps/project/merge_requests/revert.rb +++ b/features/steps/project/merge_requests/revert.rb @@ -1,6 +1,7 @@ class Spinach::Features::RevertMergeRequests < Spinach::FeatureSteps include LoginHelpers include GitlabRoutingHelper + include WaitForVueResource step 'I click on the revert button' do find("a[href='#modal-revert-commit']").click @@ -15,6 +16,7 @@ class Spinach::Features::RevertMergeRequests < Spinach::FeatureSteps step 'I should see the revert merge request notice' do page.should have_content('The merge request has been successfully reverted.') + wait_for_vue_resource end step 'I should not see the revert button' do @@ -26,7 +28,7 @@ class Spinach::Features::RevertMergeRequests < Spinach::FeatureSteps end step 'I click on Accept Merge Request' do - click_button('Accept merge request') + click_button('Merge') end step 'I am signed in as a developer of the project' do diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index d5b3bb34d7a..46b3cb79af2 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -2,6 +2,7 @@ module SharedPaths include Spinach::DSL include RepoHelpers include DashboardHelper + include WaitForVueResource step 'I visit new project page' do visit new_project_path @@ -377,23 +378,28 @@ module SharedPaths step 'I visit merge request page "Bug NS-04"' do visit merge_request_path("Bug NS-04") + wait_for_vue_resource end step 'I visit merge request page "Bug NS-05"' do visit merge_request_path("Bug NS-05") + wait_for_vue_resource end step 'I visit merge request page "Bug NS-07"' do visit merge_request_path("Bug NS-07") + wait_for_vue_resource end step 'I visit merge request page "Bug NS-08"' do visit merge_request_path("Bug NS-08") + wait_for_vue_resource end step 'I visit merge request page "Bug CO-01"' do mr = MergeRequest.find_by(title: "Bug CO-01") visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr) + wait_for_vue_resource end step 'I visit project "Shop" merge requests page' do diff --git a/features/support/env.rb b/features/support/env.rb index 92d13bea4b6..568eeae4479 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -10,7 +10,7 @@ if ENV['CI'] Knapsack::Adapters::SpinachAdapter.bind end -%w(select2_helper test_env repo_helpers wait_for_ajax wait_for_requests sidekiq).each do |f| +%w(select2_helper test_env repo_helpers wait_for_ajax wait_for_requests sidekiq wait_for_vue_resource).each do |f| require Rails.root.join('spec', 'support', f) end -- cgit v1.2.3