summaryrefslogtreecommitdiff
path: root/features/steps/project/browse_files.rb
blob: ca96ed0b6fa29587ca36fdde7921687a4367afc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
class Spinach::Features::ProjectBrowseFiles < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedProject
  include SharedPaths
  include RepoHelpers

  step 'I should see files from repository' do
    page.should have_content "VERSION"
    page.should have_content ".gitignore"
    page.should have_content "LICENSE"
  end

  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"
  end

  step 'I click on ".gitignore" file in repo' do
    click_link ".gitignore"
  end

  step 'I should see its content' do
    page.should have_content "*.rbc"
  end

  step 'I click link "raw"' do
    click_link "raw"
  end

  step 'I should see raw file content' do
    page.source.should == sample_blob.data
  end

  step 'I click button "edit"' do
    click_link 'edit'
  end

  step 'I can edit code' do
    page.execute_script('editor.setValue("GitlabFileEditor")')
    page.evaluate_script('editor.getValue()').should == "GitlabFileEditor"
  end

  step 'I edit code' do
    page.execute_script('editor.setValue("GitlabFileEditor")')
  end

  step 'I click link "Diff"' do
    click_link 'Diff'
  end

  step 'I see diff' do
    page.should have_css '.line_holder.new'
  end

  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

  step 'I click on files directory' do
    click_link 'files'
  end

  step 'I click on history link' do
    click_link 'history'
  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
    within '.tree-table' do
      click_link 'README.md'
    end
  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

  step 'I click on permalink' do
    click_link 'permalink'
  end

  step 'I am redirected to the permalink URL' do
    expect(current_path).to eq(project_blob_path(
      @project, @project.repository.commit.sha + '/.gitignore'))
  end

  step "I don't see the permalink link" do
    expect(page).not_to have_link('permalink')
  end
end