Commit f2eb668348bc8ff70d62ee607a080f235f470dfd
1 parent
bd2b6f59
Exists in
master
and in
4 other branches
Feature test for New file feature
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
22 additions
and
9 deletions
Show diff stats
app/views/projects/tree/_tree.html.haml
| @@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
| 12 | = link_to title, '#' | 12 | = link_to title, '#' |
| 13 | \/ | 13 | \/ |
| 14 | %li | 14 | %li |
| 15 | - = link_to project_new_tree_path(@project, @id) do | 15 | + = link_to project_new_tree_path(@project, @id), title: 'New file', id: 'new-file-link' do |
| 16 | %small | 16 | %small |
| 17 | %i.icon-plus.light | 17 | %i.icon-plus.light |
| 18 | 18 |
features/project/source/browse_files.feature
| @@ -20,6 +20,10 @@ Feature: Project Browse files | @@ -20,6 +20,10 @@ Feature: Project Browse files | ||
| 20 | And I click link "raw" | 20 | And I click link "raw" |
| 21 | Then I should see raw file content | 21 | Then I should see raw file content |
| 22 | 22 | ||
| 23 | + Scenario: I can create file | ||
| 24 | + Given I click on "new file" link in repo | ||
| 25 | + Then I can see new file page | ||
| 26 | + | ||
| 23 | @javascript | 27 | @javascript |
| 24 | Scenario: I can edit file | 28 | Scenario: I can edit file |
| 25 | Given I click on "Gemfile.lock" file in repo | 29 | Given I click on "Gemfile.lock" file in repo |
features/steps/project/project_browse_files.rb
| @@ -3,42 +3,51 @@ class ProjectBrowseFiles < Spinach::FeatureSteps | @@ -3,42 +3,51 @@ class ProjectBrowseFiles < Spinach::FeatureSteps | ||
| 3 | include SharedProject | 3 | include SharedProject |
| 4 | include SharedPaths | 4 | include SharedPaths |
| 5 | 5 | ||
| 6 | - Then 'I should see files from repository' do | 6 | + step 'I should see files from repository' do |
| 7 | page.should have_content "app" | 7 | page.should have_content "app" |
| 8 | page.should have_content "history" | 8 | page.should have_content "history" |
| 9 | page.should have_content "Gemfile" | 9 | page.should have_content "Gemfile" |
| 10 | end | 10 | end |
| 11 | 11 | ||
| 12 | - Then 'I should see files from repository for "8470d70"' do | 12 | + step 'I should see files from repository for "8470d70"' do |
| 13 | current_path.should == project_tree_path(@project, "8470d70") | 13 | current_path.should == project_tree_path(@project, "8470d70") |
| 14 | page.should have_content "app" | 14 | page.should have_content "app" |
| 15 | page.should have_content "history" | 15 | page.should have_content "history" |
| 16 | page.should have_content "Gemfile" | 16 | page.should have_content "Gemfile" |
| 17 | end | 17 | end |
| 18 | 18 | ||
| 19 | - Given 'I click on "Gemfile.lock" file in repo' do | 19 | + step 'I click on "Gemfile.lock" file in repo' do |
| 20 | click_link "Gemfile.lock" | 20 | click_link "Gemfile.lock" |
| 21 | end | 21 | end |
| 22 | 22 | ||
| 23 | - Then 'I should see it content' do | 23 | + step 'I should see it content' do |
| 24 | page.should have_content "DEPENDENCIES" | 24 | page.should have_content "DEPENDENCIES" |
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | - And 'I click link "raw"' do | 27 | + step 'I click link "raw"' do |
| 28 | click_link "raw" | 28 | click_link "raw" |
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | - Then 'I should see raw file content' do | 31 | + step 'I should see raw file content' do |
| 32 | page.source.should == ValidCommit::BLOB_FILE | 32 | page.source.should == ValidCommit::BLOB_FILE |
| 33 | end | 33 | end |
| 34 | 34 | ||
| 35 | - Given 'I click button "edit"' do | 35 | + step 'I click button "edit"' do |
| 36 | click_link 'edit' | 36 | click_link 'edit' |
| 37 | end | 37 | end |
| 38 | 38 | ||
| 39 | - Then 'I can edit code' do | 39 | + step 'I can edit code' do |
| 40 | page.execute_script('editor.setValue("GitlabFileEditor")') | 40 | page.execute_script('editor.setValue("GitlabFileEditor")') |
| 41 | page.evaluate_script('editor.getValue()').should == "GitlabFileEditor" | 41 | page.evaluate_script('editor.getValue()').should == "GitlabFileEditor" |
| 42 | end | 42 | end |
| 43 | 43 | ||
| 44 | + step 'I click on "new file" link in repo' do | ||
| 45 | + click_link 'new-file-link' | ||
| 46 | + end | ||
| 47 | + | ||
| 48 | + step 'I can see new file page' do | ||
| 49 | + page.should have_content "New file" | ||
| 50 | + page.should have_content "File name" | ||
| 51 | + page.should have_content "Commit message" | ||
| 52 | + end | ||
| 44 | end | 53 | end |