summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2015-12-24 14:57:07 +0200
committerValery Sizov <valery@gitlab.com>2015-12-24 14:57:07 +0200
commit44cf1cbaafa3be1c284f202dcc67c734bbba1a8e (patch)
treec9b5824fd41cc3efa8d4b62b1e7540e729aac6d6 /features
parent6d0705474791c2071153794e9be8df69375e1028 (diff)
parentd1043c4389cd92d33ff21c3fd994e78cf4d66dba (diff)
downloadgitlab-ce-44cf1cbaafa3be1c284f202dcc67c734bbba1a8e.tar.gz
Merge remote-tracking branch 'origin/master' into emoji-picker-searchemoji-picker-search
Diffstat (limited to 'features')
-rw-r--r--features/project/commits/branches.feature1
-rw-r--r--features/project/merge_requests/accept.feature8
-rw-r--r--features/project/source/browse_files.feature106
-rw-r--r--features/steps/project/commits/branches.rb3
-rw-r--r--features/steps/project/merge_requests/acceptance.rb4
-rw-r--r--features/steps/project/source/browse_files.rb35
6 files changed, 137 insertions, 20 deletions
diff --git a/features/project/commits/branches.feature b/features/project/commits/branches.feature
index 5103ca12947..2c17d32154a 100644
--- a/features/project/commits/branches.feature
+++ b/features/project/commits/branches.feature
@@ -25,6 +25,7 @@ Feature: Project Commits Branches
And I click branch 'improve/awesome' delete link
Then I should not see branch 'improve/awesome'
+ @javascript
Scenario: I create a branch with invalid name
Given I visit project branches page
And I click new branch link
diff --git a/features/project/merge_requests/accept.feature b/features/project/merge_requests/accept.feature
index d5e4f2b0bd8..330ec8ae0fe 100644
--- a/features/project/merge_requests/accept.feature
+++ b/features/project/merge_requests/accept.feature
@@ -13,6 +13,14 @@ Feature: Project Merge Requests Acceptance
And I should not see the Remove Source Branch button
@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
+
+ @javascript
Scenario: Accepting the Merge Request without removing the source branch
Given I am on the Merge Request detail page
When I click on Accept Merge Request
diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature
index 02159ee3776..a8c276b949e 100644
--- a/features/project/source/browse_files.feature
+++ b/features/project/source/browse_files.feature
@@ -24,6 +24,12 @@ Feature: Project Source Browse Files
Given I click on "New file" link in repo
Then I can see new file page
+ Scenario: I can create file when I don't have write access
+ Given I don't have write access
+ And I click on "New file" link in repo
+ Then I should see a notice about a new fork having been created
+ Then I can see new file page
+
@javascript
Scenario: I can create and commit file
Given I click on "New file" link in repo
@@ -35,6 +41,17 @@ Feature: Project Source Browse Files
And I should see its new content
@javascript
+ Scenario: I can create and commit file when I don't have write access
+ Given I don't have write access
+ And I click on "New file" link in repo
+ And I edit code
+ And I fill the new file name
+ And I fill the commit message
+ And I click on "Commit Changes"
+ Then I am redirected to the fork's new merge request page
+ And I can see the new commit message
+
+ @javascript
Scenario: I can create and commit file with new lines at the end of file
Given I click on "New file" link in repo
And I edit code with new lines at end of file
@@ -46,6 +63,17 @@ Feature: Project Source Browse Files
And I should see its content with new lines preserved at end of file
@javascript
+ Scenario: I can create and commit file and specify new branch
+ Given I click on "New file" link in repo
+ And I edit code
+ And I fill the new file name
+ And I fill the commit message
+ And I fill the new branch name
+ And I click on "Commit Changes"
+ Then I am redirected to the new merge request page
+ And I should see its new content
+
+ @javascript
Scenario: I can upload file and commit
Given I click on "Upload file" link in repo
And I upload a new text file
@@ -57,6 +85,19 @@ Feature: Project Source Browse Files
And I can see the new commit message
@javascript
+ Scenario: I can upload file and commit when I don't have write access
+ Given I don't have write access
+ And I click on "Upload file" link in repo
+ Then I should see a notice about a new fork having been created
+ When I click on "Upload file" link in repo
+ And I upload a new text file
+ And I fill the upload file commit message
+ And I click on "Upload file"
+ Then I can see the new text file
+ And I am redirected to the fork's new merge request page
+ And I can see the new commit message
+
+ @javascript
Scenario: I can replace file and commit
Given I click on ".gitignore" file in repo
And I see the ".gitignore"
@@ -68,15 +109,19 @@ Feature: Project Source Browse Files
And I can see the replacement commit message
@javascript
- Scenario: I can create and commit file and specify new branch
- Given I click on "New file" link in repo
- And I edit code
- And I fill the new file name
- And I fill the commit message
- And I fill the new branch name
- And I click on "Commit Changes"
- Then I am redirected to the new merge request page
- And I should see its new content
+ Scenario: I can replace file and commit when I don't have write access
+ Given I don't have write access
+ And I click on ".gitignore" file in repo
+ And I see the ".gitignore"
+ And I click on "Replace"
+ Then I should see a notice about a new fork having been created
+ When I click on "Replace"
+ And I replace it with a text file
+ And I fill the replace file commit message
+ And I click on "Replace file"
+ Then I can see the new text file
+ And I am redirected to the fork's new merge request page
+ And I can see the replacement commit message
@javascript
Scenario: I can create file in empty repo
@@ -117,6 +162,14 @@ Feature: Project Source Browse Files
And I click button "Edit"
Then I can edit code
+ @javascript
+ Scenario: I can edit file when I don't have write access
+ Given I don't have write access
+ And I click on ".gitignore" file in repo
+ And I click button "Edit"
+ Then I should see a notice about a new fork having been created
+ And I can edit code
+
Scenario: If the file is binary the edit link is hidden
Given I visit a binary file in the repo
Then I cannot see the edit button
@@ -132,6 +185,17 @@ Feature: Project Source Browse Files
And I should see its new content
@javascript
+ Scenario: I can edit and commit file when I don't have write access
+ Given I don't have write access
+ And I click on ".gitignore" file in repo
+ And I click button "Edit"
+ And I edit code
+ And I fill the commit message
+ And I click on "Commit Changes"
+ Then I am redirected to the fork's new merge request page
+ And I can see the new commit message
+
+ @javascript
Scenario: I can edit and commit file to new branch
Given I click on ".gitignore" file in repo
And I click button "Edit"
@@ -162,6 +226,17 @@ Feature: Project Source Browse Files
Then I am redirected to the new merge request page
@javascript
+ Scenario: I can create directory in repo when I don't have write access
+ Given I don't have write access
+ When I click on "New directory" link in repo
+ Then I should see a notice about a new fork having been created
+ When I click on "New directory" link in repo
+ And I fill the new directory name
+ And I fill the commit message
+ And I click on "Create directory"
+ Then I am redirected to the fork's new merge request page
+
+ @javascript
Scenario: I attempt to create an existing directory
When I click on "New directory" link in repo
And I fill an existing directory name
@@ -188,6 +263,19 @@ Feature: Project Source Browse Files
Then I am redirected to the files URL
And I don't see the ".gitignore"
+ @javascript
+ Scenario: I can delete file and commit when I don't have write access
+ Given I don't have write access
+ And I click on ".gitignore" file in repo
+ And I see the ".gitignore"
+ And I click on "Delete"
+ Then I should see a notice about a new fork having been created
+ When I click on "Delete"
+ And I fill the commit message
+ And I click on "Delete file"
+ Then I am redirected to the fork's new merge request page
+ And I can see the new commit message
+
Scenario: I can browse directory with Browse Dir
Given I click on files directory
And I click on History link
diff --git a/features/steps/project/commits/branches.rb b/features/steps/project/commits/branches.rb
index 338f5e8d3ee..0a42931147d 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 invalid'
+ expect(page).to have_content 'Branch name is invalid'
+ expect(page).to have_content "can't contain spaces"
end
step 'I should see new an error that ref is invalid' do
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
diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb
index 0c6df18ce2e..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"
@@ -75,7 +81,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
@@ -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
@@ -124,7 +130,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
@@ -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,9 +257,14 @@ 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/'))
+ namespace_project_tree_path(@project.namespace, @project, 'master'))
end
step "I don't see the permalink link" do
@@ -332,8 +343,12 @@ 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
+
+ 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