2014-10-02 16:42:54 +00:00
|
|
|
class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
|
2012-09-10 15:35:03 +00:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
2014-07-31 14:23:40 +00:00
|
|
|
include RepoHelpers
|
2012-09-10 15:35:03 +00:00
|
|
|
|
2013-11-05 08:45:23 +00:00
|
|
|
step 'I should see files from repository' do
|
2014-07-31 13:20:47 +00:00
|
|
|
page.should have_content "VERSION"
|
|
|
|
page.should have_content ".gitignore"
|
|
|
|
page.should have_content "LICENSE"
|
2012-09-10 12:34:01 +00:00
|
|
|
end
|
|
|
|
|
2014-07-31 13:20:47 +00:00
|
|
|
step 'I should see files from repository for "6d39438"' do
|
|
|
|
current_path.should == project_tree_path(@project, "6d39438")
|
|
|
|
page.should have_content ".gitignore"
|
|
|
|
page.should have_content "LICENSE"
|
2012-09-10 12:34:01 +00:00
|
|
|
end
|
|
|
|
|
2014-09-26 13:26:52 +00:00
|
|
|
step 'I see the ".gitignore"' do
|
|
|
|
page.should have_content '.gitignore'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I don\'t see the ".gitignore"' do
|
|
|
|
page.should_not have_content '.gitignore'
|
|
|
|
end
|
|
|
|
|
2014-07-31 13:20:47 +00:00
|
|
|
step 'I click on ".gitignore" file in repo' do
|
|
|
|
click_link ".gitignore"
|
2012-09-10 12:34:01 +00:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:45:54 +00:00
|
|
|
step 'I should see its content' do
|
2014-09-26 13:26:52 +00:00
|
|
|
page.should have_content old_gitignore_content
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see its new content' do
|
|
|
|
page.should have_content new_gitignore_content
|
2012-09-10 12:34:01 +00:00
|
|
|
end
|
|
|
|
|
2014-09-29 21:11:30 +00:00
|
|
|
step 'I click link "Raw"' do
|
|
|
|
click_link 'Raw'
|
2012-09-10 12:34:01 +00:00
|
|
|
end
|
|
|
|
|
2013-11-05 08:45:23 +00:00
|
|
|
step 'I should see raw file content' do
|
2014-09-24 06:28:41 +00:00
|
|
|
source.should == sample_blob.data
|
2012-09-10 12:34:01 +00:00
|
|
|
end
|
2012-10-12 16:56:06 +00:00
|
|
|
|
2014-09-29 21:11:30 +00:00
|
|
|
step 'I click button "Edit"' do
|
|
|
|
click_link 'Edit'
|
2012-10-12 16:56:06 +00:00
|
|
|
end
|
|
|
|
|
2013-11-05 08:45:23 +00:00
|
|
|
step 'I can edit code' do
|
2014-09-26 13:26:52 +00:00
|
|
|
set_new_content
|
|
|
|
evaluate_script('editor.getValue()').should == new_gitignore_content
|
2012-10-12 16:56:06 +00:00
|
|
|
end
|
|
|
|
|
2014-04-15 15:02:02 +00:00
|
|
|
step 'I edit code' do
|
2014-09-26 13:26:52 +00:00
|
|
|
set_new_content
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I fill the new file name' do
|
|
|
|
fill_in :file_name, with: new_file_name
|
|
|
|
end
|
|
|
|
|
2014-09-25 14:43:23 +00:00
|
|
|
step 'I fill the new file name with an illegal name' do
|
|
|
|
fill_in :file_name, with: '.git'
|
|
|
|
end
|
|
|
|
|
2014-09-26 13:26:52 +00:00
|
|
|
step 'I fill the commit message' do
|
|
|
|
fill_in :commit_message, with: 'Not yet a commit message.'
|
2014-04-15 15:02:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click link "Diff"' do
|
|
|
|
click_link 'Diff'
|
|
|
|
end
|
|
|
|
|
2014-10-02 22:13:23 +00:00
|
|
|
step 'I click on "Commit Changes"' do
|
|
|
|
click_button 'Commit Changes'
|
2014-09-26 13:26:52 +00:00
|
|
|
end
|
|
|
|
|
2014-09-29 21:11:30 +00:00
|
|
|
step 'I click on "Remove"' do
|
|
|
|
click_link 'Remove'
|
2014-09-26 13:26:52 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click on "Remove file"' do
|
|
|
|
click_button 'Remove file'
|
|
|
|
end
|
|
|
|
|
2014-04-15 15:02:02 +00:00
|
|
|
step 'I see diff' do
|
|
|
|
page.should have_css '.line_holder.new'
|
|
|
|
end
|
|
|
|
|
2013-11-05 08:45:23 +00:00
|
|
|
step 'I click on "new file" link in repo' do
|
|
|
|
click_link 'new-file-link'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I can see new file page' do
|
|
|
|
page.should have_content "New file"
|
|
|
|
page.should have_content "File name"
|
|
|
|
page.should have_content "Commit message"
|
|
|
|
end
|
2014-07-09 08:12:02 +00:00
|
|
|
|
2014-07-31 13:20:47 +00:00
|
|
|
step 'I click on files directory' do
|
|
|
|
click_link 'files'
|
2014-07-09 08:12:02 +00:00
|
|
|
end
|
|
|
|
|
2014-09-29 21:11:30 +00:00
|
|
|
step 'I click on History link' do
|
|
|
|
click_link 'History'
|
2014-07-09 08:12:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see Browse dir link' do
|
|
|
|
page.should have_link 'Browse Dir »'
|
|
|
|
page.should_not have_link 'Browse Code »'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click on readme file' do
|
2014-09-17 17:37:41 +00:00
|
|
|
within '.tree-table' do
|
|
|
|
click_link 'README.md'
|
|
|
|
end
|
2014-07-09 08:12:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see Browse file link' do
|
|
|
|
page.should have_link 'Browse File »'
|
|
|
|
page.should_not have_link 'Browse Code »'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see Browse code link' do
|
|
|
|
page.should have_link 'Browse Code »'
|
|
|
|
page.should_not have_link 'Browse File »'
|
|
|
|
page.should_not have_link 'Browse Dir »'
|
|
|
|
end
|
2014-08-08 14:03:58 +00:00
|
|
|
|
2014-09-29 21:11:30 +00:00
|
|
|
step 'I click on Permalink' do
|
|
|
|
click_link 'Permalink'
|
2014-08-08 14:03:58 +00:00
|
|
|
end
|
|
|
|
|
2014-09-26 13:26:52 +00:00
|
|
|
step 'I am redirected to the files URL' do
|
|
|
|
current_path.should == project_tree_path(@project, 'master')
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I am redirected to the ".gitignore"' do
|
|
|
|
expect(current_path).to eq(project_blob_path(@project, 'master/.gitignore'))
|
|
|
|
end
|
|
|
|
|
2014-08-08 14:03:58 +00:00
|
|
|
step 'I am redirected to the permalink URL' do
|
|
|
|
expect(current_path).to eq(project_blob_path(
|
|
|
|
@project, @project.repository.commit.sha + '/.gitignore'))
|
|
|
|
end
|
|
|
|
|
2014-09-26 13:26:52 +00:00
|
|
|
step 'I am redirected to the new file' do
|
|
|
|
expect(current_path).to eq(project_blob_path(
|
|
|
|
@project, 'master/' + new_file_name))
|
|
|
|
end
|
|
|
|
|
2014-08-08 14:03:58 +00:00
|
|
|
step "I don't see the permalink link" do
|
|
|
|
expect(page).not_to have_link('permalink')
|
|
|
|
end
|
2014-09-26 13:26:52 +00:00
|
|
|
|
2014-09-25 14:43:23 +00:00
|
|
|
step 'I see a commit error message' do
|
|
|
|
expect(page).to have_content('Your changes could not be committed')
|
|
|
|
end
|
|
|
|
|
2014-09-26 13:26:52 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def set_new_content
|
|
|
|
execute_script("editor.setValue('#{new_gitignore_content}')")
|
|
|
|
end
|
|
|
|
|
|
|
|
# Content of the gitignore file on the seed repository.
|
|
|
|
def old_gitignore_content
|
|
|
|
'*.rbc'
|
|
|
|
end
|
|
|
|
|
|
|
|
# Constant value that differs from the content
|
|
|
|
# of the gitignore of the seed repository.
|
|
|
|
def new_gitignore_content
|
|
|
|
old_gitignore_content + 'a'
|
|
|
|
end
|
|
|
|
|
|
|
|
# Constant value that is a valid filename and
|
|
|
|
# not a filename present at root of the seed repository.
|
|
|
|
def new_file_name
|
|
|
|
'not_a_file.md'
|
|
|
|
end
|
2012-09-10 12:34:01 +00:00
|
|
|
end
|