Commit 0cfb3819 authored by Douwe Maan's avatar Douwe Maan

Fix feature specs

parent a6536a84
...@@ -10,7 +10,8 @@ Feature: Project Source Browse Files ...@@ -10,7 +10,8 @@ Feature: Project Source Browse Files
Scenario: I browse files for specific ref Scenario: I browse files for specific ref
Given I visit project source page for "6d39438" Given I visit project source page for "6d39438"
Then I should see files from repository for "6d39438" Then I should see files from repository for "6d39438"
@javascript
Scenario: I browse file content Scenario: I browse file content
Given I click on ".gitignore" file in repo Given I click on ".gitignore" file in repo
Then I should see its content Then I should see its content
......
...@@ -6,11 +6,13 @@ Feature: Project Source Markdown Render ...@@ -6,11 +6,13 @@ Feature: Project Source Markdown Render
# Tree README # Tree README
@javascript
Scenario: Tree view should have correct links in README Scenario: Tree view should have correct links in README
Given I go directory which contains README file Given I go directory which contains README file
And I click on a relative link in README And I click on a relative link in README
Then I should see the correct markdown Then I should see the correct markdown
@javascript
Scenario: I browse files from markdown branch Scenario: I browse files from markdown branch
Then I should see files from repository in markdown Then I should see files from repository in markdown
And I should see rendered README which contains correct links And I should see rendered README which contains correct links
...@@ -29,36 +31,42 @@ Feature: Project Source Markdown Render ...@@ -29,36 +31,42 @@ Feature: Project Source Markdown Render
And I click on GitLab API doc directory in README And I click on GitLab API doc directory in README
Then I should see correct doc/api directory rendered Then I should see correct doc/api directory rendered
@javascript
Scenario: I view README in markdown branch to see reference links to file Scenario: I view README in markdown branch to see reference links to file
Then I should see files from repository in markdown Then I should see files from repository in markdown
And I should see rendered README which contains correct links And I should see rendered README which contains correct links
And I click on Maintenance in README And I click on Maintenance in README
Then I should see correct maintenance file rendered Then I should see correct maintenance file rendered
@javascript
Scenario: README headers should have header links Scenario: README headers should have header links
Then I should see rendered README which contains correct links Then I should see rendered README which contains correct links
And Header "Application details" should have correct id and link And Header "Application details" should have correct id and link
# Blob # Blob
@javascript
Scenario: I navigate to doc directory to view documentation in markdown Scenario: I navigate to doc directory to view documentation in markdown
And I navigate to the doc/api/README And I navigate to the doc/api/README
And I see correct file rendered And I see correct file rendered
And I click on users in doc/api/README And I click on users in doc/api/README
Then I should see the correct document file Then I should see the correct document file
@javascript
Scenario: I navigate to doc directory to view user doc in markdown Scenario: I navigate to doc directory to view user doc in markdown
And I navigate to the doc/api/README And I navigate to the doc/api/README
And I see correct file rendered And I see correct file rendered
And I click on raketasks in doc/api/README And I click on raketasks in doc/api/README
Then I should see correct directory rendered Then I should see correct directory rendered
@javascript
Scenario: I navigate to doc directory to view user doc in markdown Scenario: I navigate to doc directory to view user doc in markdown
And I navigate to the doc/api/README And I navigate to the doc/api/README
And Header "GitLab API" should have correct id and link And Header "GitLab API" should have correct id and link
# Markdown branch # Markdown branch
@javascript
Scenario: I browse files from markdown branch Scenario: I browse files from markdown branch
When I visit markdown branch When I visit markdown branch
Then I should see files from repository in markdown branch Then I should see files from repository in markdown branch
...@@ -73,6 +81,7 @@ Feature: Project Source Markdown Render ...@@ -73,6 +81,7 @@ Feature: Project Source Markdown Render
And I click on Rake tasks in README And I click on Rake tasks in README
Then I should see correct directory rendered for markdown branch Then I should see correct directory rendered for markdown branch
@javascript
Scenario: I navigate to doc directory to view documentation in markdown branch Scenario: I navigate to doc directory to view documentation in markdown branch
When I visit markdown branch When I visit markdown branch
And I navigate to the doc/api/README And I navigate to the doc/api/README
...@@ -80,6 +89,7 @@ Feature: Project Source Markdown Render ...@@ -80,6 +89,7 @@ Feature: Project Source Markdown Render
And I click on users in doc/api/README And I click on users in doc/api/README
Then I should see the users document file in markdown branch Then I should see the users document file in markdown branch
@javascript
Scenario: I navigate to doc directory to view user doc in markdown branch Scenario: I navigate to doc directory to view user doc in markdown branch
When I visit markdown branch When I visit markdown branch
And I navigate to the doc/api/README And I navigate to the doc/api/README
...@@ -87,6 +97,7 @@ Feature: Project Source Markdown Render ...@@ -87,6 +97,7 @@ Feature: Project Source Markdown Render
And I click on raketasks in doc/api/README And I click on raketasks in doc/api/README
Then I should see correct directory rendered for markdown branch Then I should see correct directory rendered for markdown branch
@javascript
Scenario: Tree markdown links view empty urls should have correct urls Scenario: Tree markdown links view empty urls should have correct urls
When I visit markdown branch When I visit markdown branch
Then The link with text "empty" should have url "tree/markdown" Then The link with text "empty" should have url "tree/markdown"
...@@ -99,6 +110,7 @@ Feature: Project Source Markdown Render ...@@ -99,6 +110,7 @@ Feature: Project Source Markdown Render
# "ID" means "#id" on the tests below, because we are unable to escape the hash sign. # "ID" means "#id" on the tests below, because we are unable to escape the hash sign.
# which Spinach interprets as the start of a comment. # which Spinach interprets as the start of a comment.
@javascript
Scenario: All markdown links with ids should have correct urls Scenario: All markdown links with ids should have correct urls
When I visit markdown branch When I visit markdown branch
Then The link with text "ID" should have url "tree/markdownID" Then The link with text "ID" should have url "tree/markdownID"
......
...@@ -4,6 +4,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps ...@@ -4,6 +4,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
include SharedProject include SharedProject
include SharedPaths include SharedPaths
include RepoHelpers include RepoHelpers
include WaitForAjax
step "I don't have write access" do step "I don't have write access" do
@project = create(:project, :repository, name: "Other Project", path: "other-project") @project = create(:project, :repository, name: "Other Project", path: "other-project")
...@@ -36,10 +37,12 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps ...@@ -36,10 +37,12 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end end
step 'I should see its content' do step 'I should see its content' do
wait_for_ajax
expect(page).to have_content old_gitignore_content expect(page).to have_content old_gitignore_content
end end
step 'I should see its new content' do step 'I should see its new content' do
wait_for_ajax
expect(page).to have_content new_gitignore_content expect(page).to have_content new_gitignore_content
end end
......
...@@ -5,6 +5,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps ...@@ -5,6 +5,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
include SharedAuthentication include SharedAuthentication
include SharedPaths include SharedPaths
include SharedMarkdown include SharedMarkdown
include WaitForAjax
step 'I own project "Delta"' do step 'I own project "Delta"' do
@project = ::Project.find_by(name: "Delta") @project = ::Project.find_by(name: "Delta")
...@@ -34,6 +35,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps ...@@ -34,6 +35,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
step 'I should see correct document rendered' do step 'I should see correct document rendered' do
expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md") expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md")
wait_for_ajax
expect(page).to have_content "All API requests require authentication" expect(page).to have_content "All API requests require authentication"
end end
...@@ -63,6 +65,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps ...@@ -63,6 +65,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
step 'I should see correct maintenance file rendered' do step 'I should see correct maintenance file rendered' do
expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/raketasks/maintenance.md") expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/raketasks/maintenance.md")
wait_for_ajax
expect(page).to have_content "bundle exec rake gitlab:env:info RAILS_ENV=production" expect(page).to have_content "bundle exec rake gitlab:env:info RAILS_ENV=production"
end end
...@@ -94,6 +97,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps ...@@ -94,6 +97,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
step 'I see correct file rendered' do step 'I see correct file rendered' do
expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md") expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md")
wait_for_ajax
expect(page).to have_content "Contents" expect(page).to have_content "Contents"
expect(page).to have_link "Users" expect(page).to have_link "Users"
expect(page).to have_link "Rake tasks" expect(page).to have_link "Rake tasks"
...@@ -138,6 +142,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps ...@@ -138,6 +142,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
step 'I see correct file rendered in markdown branch' do step 'I see correct file rendered in markdown branch' do
expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md") expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md")
wait_for_ajax
expect(page).to have_content "Contents" expect(page).to have_content "Contents"
expect(page).to have_link "Users" expect(page).to have_link "Users"
expect(page).to have_link "Rake tasks" expect(page).to have_link "Rake tasks"
...@@ -145,6 +150,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps ...@@ -145,6 +150,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
step 'I should see correct document rendered for markdown branch' do step 'I should see correct document rendered for markdown branch' do
expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md") expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/README.md")
wait_for_ajax
expect(page).to have_content "All API requests require authentication" expect(page).to have_content "All API requests require authentication"
end end
...@@ -162,6 +168,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps ...@@ -162,6 +168,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
# Expected link contents # Expected link contents
step 'The link with text "empty" should have url "tree/markdown"' do step 'The link with text "empty" should have url "tree/markdown"' do
wait_for_ajax
find('a', text: /^empty$/)['href'] == current_host + namespace_project_tree_path(@project.namespace, @project, "markdown") find('a', text: /^empty$/)['href'] == current_host + namespace_project_tree_path(@project.namespace, @project, "markdown")
end end
...@@ -197,6 +204,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps ...@@ -197,6 +204,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
end end
step 'The link with text "ID" should have url "blob/markdown/README.mdID"' do step 'The link with text "ID" should have url "blob/markdown/README.mdID"' do
wait_for_ajax
find('a', text: /^#id$/)['href'] == current_host + namespace_project_blob_path(@project.namespace, @project, "markdown/README.md") + '#id' find('a', text: /^#id$/)['href'] == current_host + namespace_project_blob_path(@project.namespace, @project, "markdown/README.md") + '#id'
end end
...@@ -291,10 +299,12 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps ...@@ -291,10 +299,12 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
step 'I should see the correct markdown' do step 'I should see the correct markdown' do
expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/users.md") expect(current_path).to eq namespace_project_blob_path(@project.namespace, @project, "markdown/doc/api/users.md")
wait_for_ajax
expect(page).to have_content "List users" expect(page).to have_content "List users"
end end
step 'Header "Application details" should have correct id and link' do step 'Header "Application details" should have correct id and link' do
wait_for_ajax
header_should_have_correct_id_and_link(2, 'Application details', 'application-details') header_should_have_correct_id_and_link(2, 'Application details', 'application-details')
end end
......
...@@ -3,7 +3,7 @@ module SharedMarkdown ...@@ -3,7 +3,7 @@ module SharedMarkdown
def header_should_have_correct_id_and_link(level, text, id, parent = ".wiki") def header_should_have_correct_id_and_link(level, text, id, parent = ".wiki")
node = find("#{parent} h#{level} a#user-content-#{id}") node = find("#{parent} h#{level} a#user-content-#{id}")
expect(node[:href]).to eq "##{id}" expect(node[:href]).to end_with "##{id}"
# Work around a weird Capybara behavior where calling `parent` on a node # Work around a weird Capybara behavior where calling `parent` on a node
# returns the whole document, not the node's actual parent element # returns the whole document, not the node's actual parent element
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment