From 9c266d49354e9f7f86c76b00fbe800912f475153 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Wed, 16 Dec 2015 16:29:31 -0200 Subject: Add more descriptive error message when create branch with invalid name --- features/steps/project/commits/branches.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'features/steps/project') diff --git a/features/steps/project/commits/branches.rb b/features/steps/project/commits/branches.rb index 338f5e8d3ee..e9312e87637 100644 --- a/features/steps/project/commits/branches.rb +++ b/features/steps/project/commits/branches.rb @@ -61,7 +61,7 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps end step 'I should see new an error that branch is invalid' do - expect(page).to have_content 'Branch name invalid' + expect(page).to have_content "Branch name can't contains space, '~', '^', ':', '?', '*', '[', '\', '..', '@{', and consecutive slashes, start with '/' or '.' or end in '/' or '.' or '.lock'" end step 'I should see new an error that ref is invalid' do -- cgit v1.2.1 From 1757e6ef65a1cedbfe5d5b5da894d6d0d3d5ef16 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Thu, 17 Dec 2015 16:59:15 -0200 Subject: Add JS validation for invalid characters in branch name More info about valid ref names: https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.ht ml --- features/steps/project/commits/branches.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'features/steps/project') diff --git a/features/steps/project/commits/branches.rb b/features/steps/project/commits/branches.rb index e9312e87637..109d031d446 100644 --- a/features/steps/project/commits/branches.rb +++ b/features/steps/project/commits/branches.rb @@ -61,7 +61,8 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps end step 'I should see new an error that branch is invalid' do - expect(page).to have_content "Branch name can't contains space, '~', '^', ':', '?', '*', '[', '\', '..', '@{', and consecutive slashes, start with '/' or '.' or end in '/' or '.' or '.lock'" + expect(page).to have_content 'Branch name is invalid' + expect(page).to have_content "can't contains spaces" end step 'I should see new an error that ref is invalid' do -- cgit v1.2.1 From d9c82d679fd622aead99aeb90369361a05e02a36 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Fri, 18 Dec 2015 10:03:34 +0100 Subject: Automatically fork a project when not allowed to edit a file. --- features/steps/project/source/browse_files.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'features/steps/project') diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 0c6df18ce2e..da8a07c2b4a 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -75,7 +75,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I fill the new branch name' do - fill_in :new_branch, with: 'new_branch_name', visible: true + fill_in :target_branch, with: 'new_branch_name', visible: true end step 'I fill the new file name with an illegal name' do -- cgit v1.2.1 From f4f4a6b5303a0889f3fdb1bfe0bb014a6788c4d6 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Fri, 18 Dec 2015 16:14:12 +0100 Subject: Fix specs and behavior for LFS files --- features/steps/project/source/browse_files.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'features/steps/project') diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index da8a07c2b4a..4962b68b8f2 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -253,7 +253,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps step 'I am redirected to the root directory' do expect(current_path).to eq( - namespace_project_tree_path(@project.namespace, @project, 'master/')) + namespace_project_tree_path(@project.namespace, @project, 'master')) end step "I don't see the permalink link" do @@ -332,8 +332,8 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps expect(page).to have_content 'Permalink' expect(page).not_to have_content 'Edit' expect(page).not_to have_content 'Blame' - expect(page).not_to have_content 'Delete' - expect(page).not_to have_content 'Replace' + expect(page).to have_content 'Delete' + expect(page).to have_content 'Replace' end private -- cgit v1.2.1 From c65243427f4c940aab35cc86e039c89c6264cf00 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Sat, 19 Dec 2015 18:29:24 +0100 Subject: Fix specs --- features/steps/project/source/browse_files.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'features/steps/project') diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 4962b68b8f2..898a8a0d0f6 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -124,7 +124,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps step 'I click on "New file" link in repo' do find('.add-to-tree').click - click_link 'Create file' + click_link 'New file' end step 'I click on "Upload file" link in repo' do -- cgit v1.2.1 From c910bca730561da3361faec56ef509e25a798c66 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 21 Dec 2015 11:57:51 +0100 Subject: Add tests for new functionality --- features/steps/project/source/browse_files.rb | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'features/steps/project') diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 898a8a0d0f6..d08935aa101 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -5,6 +5,12 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps include SharedPaths include RepoHelpers + step "I don't have write access" do + @project = create(:project, name: "Other Project", path: "other-project") + @project.team << [@user, :reporter] + visit namespace_project_tree_path(@project.namespace, @project, root_ref) + end + step 'I should see files from repository' do expect(page).to have_content "VERSION" expect(page).to have_content ".gitignore" @@ -87,7 +93,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I fill the commit message' do - fill_in :commit_message, with: 'Not yet a commit message.', visible: true + fill_in :commit_message, with: 'New commit message', visible: true end step 'I click link "Diff"' do @@ -103,7 +109,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I click on "Delete"' do - click_button 'Delete' + click_on 'Delete' end step 'I click on "Delete file"' do @@ -111,7 +117,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I click on "Replace"' do - click_button "Replace" + click_on "Replace" end step 'I click on "Replace file"' do @@ -155,7 +161,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I can see the new commit message' do - expect(page).to have_content "New upload commit message" + expect(page).to have_content "New commit message" end step 'I upload a new text file' do @@ -164,7 +170,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps step 'I fill the upload file commit message' do page.within('#modal-upload-blob') do - fill_in :commit_message, with: 'New upload commit message' + fill_in :commit_message, with: 'New commit message' end end @@ -251,6 +257,11 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps expect(current_path).to eq(new_namespace_project_merge_request_path(@project.namespace, @project)) end + step "I am redirected to the fork's new merge request page" do + fork = @user.fork_of(@project) + expect(current_path).to eq(new_namespace_project_merge_request_path(fork.namespace, fork)) + end + step 'I am redirected to the root directory' do expect(current_path).to eq( namespace_project_tree_path(@project.namespace, @project, 'master')) @@ -336,6 +347,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps expect(page).to have_content 'Replace' end + step 'I should see a notice about a new fork having been created' do + expect(page).to have_content "You're not allowed to make changes to this project directly. A fork of this project has been created that you can make changes in, so you can submit a merge request." + end + private def set_new_content -- cgit v1.2.1 From 23b436dc9346275e9fbd6201317e09da63befc46 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Mon, 21 Dec 2015 21:44:34 -0200 Subject: Fix minor stylistic complaints --- features/steps/project/commits/branches.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'features/steps/project') diff --git a/features/steps/project/commits/branches.rb b/features/steps/project/commits/branches.rb index 109d031d446..0a42931147d 100644 --- a/features/steps/project/commits/branches.rb +++ b/features/steps/project/commits/branches.rb @@ -62,7 +62,7 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps step 'I should see new an error that branch is invalid' do expect(page).to have_content 'Branch name is invalid' - expect(page).to have_content "can't contains spaces" + expect(page).to have_content "can't contain spaces" end step 'I should see new an error that ref is invalid' do -- cgit v1.2.1 From 42da7cd375a615d0ba092495981682bafdb99b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20D=C3=A1vila?= Date: Mon, 21 Dec 2015 22:59:15 -0500 Subject: Fix redirect to wrong URL when merging and MR detail URL has an anchor. #4189 --- features/steps/project/merge_requests/acceptance.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'features/steps/project') diff --git a/features/steps/project/merge_requests/acceptance.rb b/features/steps/project/merge_requests/acceptance.rb index 383c055c4ef..2685f5fd6b4 100644 --- a/features/steps/project/merge_requests/acceptance.rb +++ b/features/steps/project/merge_requests/acceptance.rb @@ -6,6 +6,10 @@ class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps visit merge_request_path(@merge_request) end + step 'I am on the Merge Request detail with note anchor page' do + visit merge_request_path(@merge_request, anchor: 'note_123') + end + step 'I click on "Remove source branch" option' do check('Remove source branch') end -- cgit v1.2.1