browse_files.feature 7.07 KB
Newer Older
Ciro Santilli's avatar
Ciro Santilli committed
1
Feature: Project Source Browse Files
2 3
  Background:
    Given I sign in as a user
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
4 5 6 7 8 9 10
    And I own project "Shop"
    Given I visit project source page

  Scenario: I browse files from master branch
    Then I should see files from repository

  Scenario: I browse files for specific ref
11 12
    Given I visit project source page for "6d39438"
    Then I should see files from repository for "6d39438"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
13 14

  Scenario: I browse file content
15
    Given I click on ".gitignore" file in repo
Ciro Santilli's avatar
Ciro Santilli committed
16
    Then I should see its content
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
17 18

  Scenario: I browse raw file
19
    Given I visit blob file from repo
20
    And I click link "Raw"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
21
    Then I should see raw file content
Valeriy Sizov's avatar
Valeriy Sizov committed
22

23
  Scenario: I can create file
Stan Hu's avatar
Stan Hu committed
24
    Given I click on "New file" link in repo
25 26
    Then I can see new file page

27
  @javascript
Ciro Santilli's avatar
Ciro Santilli committed
28
  Scenario: I can create and commit file
Stan Hu's avatar
Stan Hu committed
29
    Given I click on "New file" link in repo
Ciro Santilli's avatar
Ciro Santilli committed
30 31
    And I edit code
    And I fill the new file name
32 33 34 35
    And I fill the commit message
    And I click on "Commit Changes"
    Then I am redirected to the new file
    And I should see its new content
36

37 38
  @javascript
  Scenario: I can upload file and commit
Stan Hu's avatar
Stan Hu committed
39
    Given I click on "Upload file" link in repo
40 41
    And I upload a new text file
    And I fill the upload file commit message
Stan Hu's avatar
Stan Hu committed
42
    And I fill the new branch name
43 44
    And I click on "Upload file"
    Then I can see the new text file
Douwe Maan's avatar
Douwe Maan committed
45
    And I am redirected to the new merge request page
46 47 48 49 50 51 52 53 54 55 56 57
    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"
    And 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 can see the replacement commit message
58

59 60
  @javascript
  Scenario: I can create and commit file and specify new branch
Stan Hu's avatar
Stan Hu committed
61
    Given I click on "New file" link in repo
62 63 64 65 66
    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"
Douwe Maan's avatar
Douwe Maan committed
67
    Then I am redirected to the new merge request page
68 69
    And I should see its new content

70
  @javascript
71 72 73 74 75 76 77
  Scenario: I can create file in empty repo
    Given I own an empty project
    And I visit my empty project page
    And I create bare repo
    When I click on "add a file" link
    And I edit code
    And I fill the new file name
Ciro Santilli's avatar
Ciro Santilli committed
78
    And I fill the commit message
79
    And I click on "Commit Changes"
Ciro Santilli's avatar
Ciro Santilli committed
80 81 82
    Then I am redirected to the new file
    And I should see its new content

83 84
  @javascript
  Scenario: If I enter an illegal file name I see an error message
Stan Hu's avatar
Stan Hu committed
85
    Given I click on "New file" link in repo
86 87 88 89 90 91 92
    And I fill the new file name with an illegal name
    And I edit code
    And I fill the commit message
    And I click on "Commit changes"
    Then I am on the new file page
    And I see a commit error message

93 94 95 96 97 98 99 100 101 102
  @javascript
  Scenario: I can create file with a directory name
    Given I click on "New file" link in repo
    And I fill the new file name with a new directory
    And I edit code
    And I fill the commit message
    And I click on "Commit changes"
    Then I am redirected to the new file with directory
    And I should see its new content

Valeriy Sizov's avatar
Valeriy Sizov committed
103 104
  @javascript
  Scenario: I can edit file
105
    Given I click on ".gitignore" file in repo
106
    And I click button "Edit"
107
    Then I can edit code
skv-headless's avatar
skv-headless committed
108

109 110 111 112 113 114 115 116 117 118
  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

  Scenario: If I don't have edit permission the edit link is disabled
    Given public project "Community"
    And I visit project "Community" source page
    And I click on ".gitignore" file in repo
    Then The edit button is disabled

Ciro Santilli's avatar
Ciro Santilli committed
119 120 121
  @javascript
  Scenario: I can edit and commit file
    Given I click on ".gitignore" file in repo
122
    And I click button "Edit"
Ciro Santilli's avatar
Ciro Santilli committed
123 124
    And I edit code
    And I fill the commit message
125
    And I click on "Commit Changes"
Ciro Santilli's avatar
Ciro Santilli committed
126 127 128
    Then I am redirected to the ".gitignore"
    And I should see its new content

129 130 131 132 133 134 135 136
  @javascript
  Scenario: I can edit and commit file to new branch
    Given I click on ".gitignore" file in repo
    And I click button "Edit"
    And I edit code
    And I fill the commit message
    And I fill the new branch name
    And I click on "Commit Changes"
Douwe Maan's avatar
Douwe Maan committed
137
    Then I am redirected to the new merge request page
138 139
    And I should see its new content

140 141 142 143 144 145 146 147 148 149
  @javascript  @wip
  Scenario: If I don't change the content of the file I see an error message
    Given I click on ".gitignore" file in repo
    And I click button "edit"
    And I fill the commit message
    And I click on "Commit changes"
    # Test fails because carriage returns are added to the file.
    Then I am on the ".gitignore" edit file page
    And I see a commit error message

Stan Hu's avatar
Stan Hu committed
150 151 152 153 154 155 156
  @javascript
  Scenario: I can create directory in repo
    When I click on "New directory" link in repo
    And I fill the new directory name
    And I fill the commit message
    And I fill the new branch name
    And I click on "Create directory"
Douwe Maan's avatar
Douwe Maan committed
157
    Then I am redirected to the new merge request page
Stan Hu's avatar
Stan Hu committed
158 159 160 161 162 163 164 165 166 167

  @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
    And I fill the commit message
    And I click on "Create directory"
    Then I see "Unable to create directory"
    And I am redirected to the root directory

skv-headless's avatar
skv-headless committed
168 169
  @javascript
  Scenario: I can see editing preview
170
    Given I click on ".gitignore" file in repo
171
    And I click button "Edit"
skv-headless's avatar
skv-headless committed
172 173 174 175
    And I edit code
    And I click link "Diff"
    Then I see diff

Ciro Santilli's avatar
Ciro Santilli committed
176
  @javascript
Douwe Maan's avatar
Douwe Maan committed
177
  Scenario: I can delete file and commit
Ciro Santilli's avatar
Ciro Santilli committed
178 179
    Given I click on ".gitignore" file in repo
    And I see the ".gitignore"
Douwe Maan's avatar
Douwe Maan committed
180
    And I click on "Delete"
Ciro Santilli's avatar
Ciro Santilli committed
181
    And I fill the commit message
Douwe Maan's avatar
Douwe Maan committed
182
    And I click on "Delete file"
Ciro Santilli's avatar
Ciro Santilli committed
183 184 185
    Then I am redirected to the files URL
    And I don't see the ".gitignore"

186
  Scenario: I can browse directory with Browse Dir
187
    Given I click on files directory
188
    And I click on History link
189 190 191 192
    Then I see Browse dir link

  Scenario: I can browse file with Browse File
    Given I click on readme file
193
    And I click on History link
194 195 196
    Then I see Browse file link

  Scenario: I can browse code with Browse Code
197
    Given I click on History link
198
    Then I see Browse code link
199 200 201 202 203

  # Permalink

  Scenario: I click on the permalink link from a branch ref
    Given I click on ".gitignore" file in repo
204
    And I click on Permalink
205 206 207 208 209 210
    Then I am redirected to the permalink URL

  Scenario: I don't see the permalink link from a SHA ref
    Given I visit project source page for "6d394385cf567f80a8fd85055db1ab4c5295806f"
    And I click on ".gitignore" file in repo
    Then I don't see the permalink link
211 212 213 214 215 216 217

  @javascript
  Scenario: I browse code with single quotes in the ref
    Given I switch ref to 'test'
    And I see the ref 'test' has been selected
    And I visit the 'test' tree
    Then I see the commit data
218 219 220 221 222 223

  @javascript
  Scenario: I browse code with a leading dot in the directory
    Given I switch ref to fix
    And I visit the fix tree
    Then I see the commit data for a directory with a leading dot