diff options
Diffstat (limited to 'features/steps/project/source/browse_files.rb')
-rw-r--r-- | features/steps/project/source/browse_files.rb | 103 |
1 files changed, 78 insertions, 25 deletions
diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index a1a49dd58a6..05d1346d006 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -71,31 +71,39 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I fill the new branch name' do - fill_in :new_branch, with: 'new_branch_name' + fill_in :new_branch, with: 'new_branch_name', visible: true end step 'I fill the new file name with an illegal name' do fill_in :file_name, with: 'Spaces Not Allowed' end + step 'I fill the new file name with a new directory' do + fill_in :file_name, with: new_file_name_with_directory + end + step 'I fill the commit message' do fill_in :commit_message, with: 'Not yet a commit message.', visible: true end step 'I click link "Diff"' do - click_link 'Preview changes' + click_link 'Preview Changes' end step 'I click on "Commit Changes"' do click_button 'Commit Changes' end - step 'I click on "Remove"' do - click_button 'Remove' + step 'I click on "Create directory"' do + click_button 'Create directory' end - step 'I click on "Remove file"' do - click_button 'Remove file' + step 'I click on "Delete"' do + click_button 'Delete' + end + + step 'I click on "Delete file"' do + click_button 'Delete file' end step 'I click on "Replace"' do @@ -110,21 +118,32 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps expect(page).to have_css '.line_holder.new' end - step 'I click on "new file" link in repo' do - click_link 'new-file-link' + step 'I click on "New file" link in repo' do + find('.add-to-tree').click + click_link 'Create file' end - step 'I can see new file page' do - expect(page).to have_content "new file" - expect(page).to have_content "Commit message" + step 'I click on "Upload file" link in repo' do + find('.add-to-tree').click + click_link 'Upload file' + end + + step 'I click on "New directory" link in repo' do + find('.add-to-tree').click + click_link 'New directory' end - step 'I can see "upload an existing one"' do - expect(page).to have_content "upload an existing one" + step 'I fill the new directory name' do + fill_in :dir_name, with: new_dir_name end - step 'I click on "upload"' do - click_link 'upload' + step 'I fill an existing directory name' do + fill_in :dir_name, with: 'files' + end + + step 'I can see new file page' do + expect(page).to have_content "New File" + expect(page).to have_content "Commit message" end step 'I click on "Upload file"' do @@ -173,7 +192,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I see Browse dir link' do - expect(page).to have_link 'Browse Dir »' + expect(page).to have_link 'Browse Directory »' expect(page).not_to have_link 'Browse Code »' end @@ -185,13 +204,13 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps step 'I see Browse file link' do expect(page).to have_link 'Browse File »' - expect(page).not_to have_link 'Browse Code »' + expect(page).not_to have_link 'Browse Files »' end step 'I see Browse code link' do - expect(page).to have_link 'Browse Code »' + expect(page).to have_link 'Browse Files »' expect(page).not_to have_link 'Browse File »' - expect(page).not_to have_link 'Browse Dir »' + expect(page).not_to have_link 'Browse Directory »' end step 'I click on Permalink' do @@ -206,10 +225,6 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps expect(current_path).to eq(namespace_project_blob_path(@project.namespace, @project, 'master/.gitignore')) end - step 'I am redirected to the ".gitignore" on new branch' do - expect(current_path).to eq(namespace_project_blob_path(@project.namespace, @project, 'new_branch_name/.gitignore')) - end - step 'I am redirected to the permalink URL' do expect(current_path).to( eq(namespace_project_blob_path(@project.namespace, @project, @@ -223,15 +238,28 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps @project.namespace, @project, 'master/' + new_file_name)) end - step 'I am redirected to the new file on new branch' do + step 'I am redirected to the new file with directory' do expect(current_path).to eq(namespace_project_blob_path( - @project.namespace, @project, 'new_branch_name/' + new_file_name)) + @project.namespace, @project, 'master/' + new_file_name_with_directory)) + end + + step 'I am redirected to the new merge request page' do + expect(current_path).to eq(new_namespace_project_merge_request_path(@project.namespace, @project)) + end + + step 'I am redirected to the root directory' do + expect(current_path).to eq(namespace_project_tree_path( + @project.namespace, @project, 'master/')) end step "I don't see the permalink link" do expect(page).not_to have_link('permalink') end + step 'I see "Unable to create directory"' do + expect(page).to have_content('Directory already exists') + end + step 'I see a commit error message' do expect(page).to have_content('Your changes could not be committed') end @@ -251,6 +279,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps select "'test'", from: 'ref' end + step "I switch ref to fix" do + select "fix", from: 'ref' + end + step "I see the ref 'test' has been selected" do expect(page).to have_selector '.select2-chosen', text: "'test'" end @@ -259,11 +291,20 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps visit namespace_project_tree_path(@project.namespace, @project, "'test'") end + step "I visit the fix tree" do + visit namespace_project_tree_path(@project.namespace, @project, "fix/.testdir") + end + step 'I see the commit data' do expect(page).to have_css('.tree-commit-link', visible: true) expect(page).not_to have_content('Loading commit data...') end + step 'I see the commit data for a directory with a leading dot' do + expect(page).to have_css('.tree-commit-link', visible: true) + expect(page).not_to have_content('Loading commit data...') + end + private def set_new_content @@ -287,6 +328,18 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps 'not_a_file.md' end + # Constant value that is a valid filename with directory and + # not a filename present at root of the seed repository. + def new_file_name_with_directory + 'foo/bar/baz.txt' + end + + # Constant value that is a valid directory and + # not a directory present at root of the seed repository. + def new_dir_name + 'new_dir/subdir' + end + def drop_in_dropzone(file_path) # Generate a fake input selector page.execute_script <<-JS |