diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-12-24 15:24:57 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-12-24 15:24:57 +0300 |
commit | 76b7e24f855c99814fc09e286fb061b7aea3954c (patch) | |
tree | 498970380a63da563d29b24078bf293ce66a7658 /features/project | |
parent | 84e75ebd4cd463cf5e0dea9c46e7bcef50b98f50 (diff) | |
parent | cfa716ebe0f149fd3f152d90c4dcf32ea450b486 (diff) |
Merge branch 'edit-on-fork' into 'master'
Automatically fork a project when not allowed to edit a file.
Fixes #3215.
To do:
- [ ] Add tests
-----
## "Edit" button on file in a project the user does NOT have write access to
![edit_file](/uploads/7602157420768aef483a6586bba2d164/edit_file.png)
## Clicking will automatically create a fork
![during_fork](/uploads/32f4f5dff9f24ea99522000b0bf881c5/during_fork.png)
## When the fork has been created, the user is returned to the edit page on the original project with a notice
![edit_notice](/uploads/94ed1319404370ff1e9c0d672fb41e03/edit_notice.png)
## The user cannot change the target branch and is informed that editing will start an MR
![edit_footer](/uploads/4da68d4795c7177e575b7c434d16eeae/edit_footer.png)
## Hitting "Commit changes" will commit and start an MR from my fork to the origin project
![Screen_Shot_2015-12-17_at_23.38.08](/uploads/d777a4db6f38a5a1be84031694465bc1/Screen_Shot_2015-12-17_at_23.38.08.png)
-----
## "Create file, "Upload file" and "New directory" buttons in a project the user does NOT have write access to
![new_directory](/uploads/72f556248f30d6652523bbb4be01b3e0/new_directory.png)
## Clicking any of these options will automatically create a fork
![during_fork](/uploads/32f4f5dff9f24ea99522000b0bf881c5/during_fork.png)
## When the fork has been created, the user is returned to the tree page on the original project with a notice
![new_directory_notice](/uploads/a1a3e11308ae0e8f0913fae6813a37ed/new_directory_notice.png)
## Clicking "New directory" again will show the modal. The user cannot change the target branch and is informed that editing will start an MR
![new_dir](/uploads/99ca8cbfb2f70603e352b3fdf67b6281/new_dir.png)
## Hitting "Create directory" will commit and start an MR from my fork to the origin project
![Screen_Shot_2015-12-17_at_23.39.19](/uploads/3713d0235abf831361b803a6198c5bc1/Screen_Shot_2015-12-17_at_23.39.19.png)
cc @dzaporozhets @skyruler
See merge request !2145
Diffstat (limited to 'features/project')
-rw-r--r-- | features/project/source/browse_files.feature | 106 |
1 files changed, 97 insertions, 9 deletions
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 |