2014-02-20 09:09:30 -05:00
|
|
|
# If you need to modify the existing seed repository for your tests,
|
|
|
|
# it is recommended that you make the changes on the `markdown` branch of the seed project repository,
|
|
|
|
# which should only be used by tests in this file. See `/spec/factories.rb#project` for more info.
|
2014-10-02 12:42:54 -04:00
|
|
|
class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps
|
2013-10-11 07:44:00 -04:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
2014-02-04 02:48:33 -05:00
|
|
|
include SharedMarkdown
|
2017-05-17 14:25:13 -04:00
|
|
|
include WaitForRequests
|
2013-10-11 07:44:00 -04:00
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I own project "Delta"' do
|
2017-04-24 16:26:44 -04:00
|
|
|
@project = ::Project.find_by(name: "Delta")
|
2017-01-16 23:09:57 -05:00
|
|
|
@project ||= create(:project, :repository, name: "Delta", namespace: @user.namespace)
|
2013-10-11 07:44:00 -04:00
|
|
|
@project.team << [@user, :master]
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see files from repository in markdown' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_tree_path(@project, "markdown")
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "README.md"
|
|
|
|
expect(page).to have_content "CHANGELOG"
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see rendered README which contains correct links' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Welcome to GitLab GitLab is a free project and repository management application"
|
|
|
|
expect(page).to have_link "GitLab API doc"
|
|
|
|
expect(page).to have_link "GitLab API website"
|
|
|
|
expect(page).to have_link "Rake tasks"
|
|
|
|
expect(page).to have_link "backup and restore procedure"
|
|
|
|
expect(page).to have_link "GitLab API doc directory"
|
|
|
|
expect(page).to have_link "Maintenance"
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on Gitlab API in README' do
|
2013-10-11 07:44:00 -04:00
|
|
|
click_link "GitLab API doc"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see correct document rendered' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/README.md")
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "All API requests require authentication"
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on Rake tasks in README' do
|
2013-10-11 07:44:00 -04:00
|
|
|
click_link "Rake tasks"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see correct directory rendered' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_tree_path(@project, "markdown/doc/raketasks")
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "backup_restore.md"
|
|
|
|
expect(page).to have_content "maintenance.md"
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on GitLab API doc directory in README' do
|
2014-01-23 05:08:57 -05:00
|
|
|
click_link "GitLab API doc directory"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see correct doc/api directory rendered' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_tree_path(@project, "markdown/doc/api")
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "README.md"
|
|
|
|
expect(page).to have_content "users.md"
|
2014-01-23 05:08:57 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on Maintenance in README' do
|
2014-01-23 05:08:57 -05:00
|
|
|
click_link "Maintenance"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see correct maintenance file rendered' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_blob_path(@project, "markdown/doc/raketasks/maintenance.md")
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "bundle exec rake gitlab:env:info RAILS_ENV=production"
|
2014-01-23 05:08:57 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on link "empty" in the README' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within('.readme-holder') do
|
2014-02-20 09:09:30 -05:00
|
|
|
click_link "empty"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on link "id" in the README' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within('.readme-holder') do
|
2014-02-20 09:09:30 -05:00
|
|
|
click_link "#id"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I navigate to the doc/api/README' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.tree-table' do
|
2014-09-17 13:37:41 -04:00
|
|
|
click_link "doc"
|
|
|
|
end
|
|
|
|
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.tree-table' do
|
2014-09-17 13:37:41 -04:00
|
|
|
click_link "api"
|
|
|
|
end
|
|
|
|
|
2017-06-09 09:59:54 -04:00
|
|
|
wait_for_requests
|
|
|
|
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.tree-table' do
|
2014-09-17 13:37:41 -04:00
|
|
|
click_link "README.md"
|
|
|
|
end
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I see correct file rendered' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/README.md")
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Contents"
|
|
|
|
expect(page).to have_link "Users"
|
|
|
|
expect(page).to have_link "Rake tasks"
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on users in doc/api/README' do
|
2013-10-11 07:44:00 -04:00
|
|
|
click_link "Users"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see the correct document file' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/users.md")
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Get a list of users."
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on raketasks in doc/api/README' do
|
2013-10-11 07:44:00 -04:00
|
|
|
click_link "Rake tasks"
|
|
|
|
end
|
|
|
|
|
2014-02-20 09:09:30 -05:00
|
|
|
# Markdown branch
|
|
|
|
|
2013-10-11 07:44:00 -04:00
|
|
|
When 'I visit markdown branch' do
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_tree_path(@project, "markdown")
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-02-20 09:09:30 -05:00
|
|
|
When 'I visit markdown branch "README.md" blob' do
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_blob_path(@project, "markdown/README.md")
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
When 'I visit markdown branch "d" tree' do
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_tree_path(@project, "markdown/d")
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
When 'I visit markdown branch "d/README.md" blob' do
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_blob_path(@project, "markdown/d/README.md")
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see files from repository in markdown branch' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_tree_path(@project, "markdown")
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "README.md"
|
|
|
|
expect(page).to have_content "CHANGELOG"
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I see correct file rendered in markdown branch' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/README.md")
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Contents"
|
|
|
|
expect(page).to have_link "Users"
|
|
|
|
expect(page).to have_link "Rake tasks"
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see correct document rendered for markdown branch' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/README.md")
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "All API requests require authentication"
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see correct directory rendered for markdown branch' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_tree_path(@project, "markdown/doc/raketasks")
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "backup_restore.md"
|
|
|
|
expect(page).to have_content "maintenance.md"
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see the users document file in markdown branch' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/users.md")
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "Get a list of users."
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-02-20 09:09:30 -05:00
|
|
|
# Expected link contents
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'The link with text "empty" should have url "tree/markdown"' do
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2017-06-29 13:06:35 -04:00
|
|
|
find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown")
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'The link with text "empty" should have url "blob/markdown/README.md"' do
|
2017-06-29 13:06:35 -04:00
|
|
|
find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md")
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'The link with text "empty" should have url "tree/markdown/d"' do
|
2017-06-29 13:06:35 -04:00
|
|
|
find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown/d")
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'The link with text "empty" should have '\
|
|
|
|
'url "blob/markdown/d/README.md"' do
|
2017-06-29 13:06:35 -04:00
|
|
|
find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/d/README.md")
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'The link with text "ID" should have url "tree/markdownID"' do
|
2017-06-29 13:06:35 -04:00
|
|
|
find('a', text: /^#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id'
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'The link with text "/ID" should have url "tree/markdownID"' do
|
2017-06-29 13:06:35 -04:00
|
|
|
find('a', text: /^\/#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id'
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'The link with text "README.mdID" '\
|
|
|
|
'should have url "blob/markdown/README.mdID"' do
|
2017-06-29 13:06:35 -04:00
|
|
|
find('a', text: /^README.md#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id'
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'The link with text "d/README.mdID" should have '\
|
|
|
|
'url "blob/markdown/d/README.mdID"' do
|
2017-06-29 13:06:35 -04:00
|
|
|
find('a', text: /^d\/README.md#id$/)['href'] == current_host + project_blob_path(@project, "d/markdown/README.md") + '#id'
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'The link with text "ID" should have url "blob/markdown/README.mdID"' do
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2017-06-29 13:06:35 -04:00
|
|
|
find('a', text: /^#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id'
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'The link with text "/ID" should have url "blob/markdown/README.mdID"' do
|
2017-06-29 13:06:35 -04:00
|
|
|
find('a', text: /^\/#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id'
|
2014-02-20 09:09:30 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
# Wiki
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I go to wiki page' do
|
2017-09-01 03:41:31 -04:00
|
|
|
first(:link, "Wiki").click
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_wiki_path(@project, "home")
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I add various links to the wiki page' do
|
2014-03-17 07:16:26 -04:00
|
|
|
fill_in "wiki[content]", with: "[test](test)\n[GitLab API doc](api)\n[Rake tasks](raketasks)\n"
|
2013-10-11 07:44:00 -04:00
|
|
|
fill_in "wiki[message]", with: "Adding links to wiki"
|
2017-04-06 09:55:11 -04:00
|
|
|
page.within '.wiki-form' do
|
|
|
|
click_button "Create page"
|
|
|
|
end
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'Wiki page should have added links' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_wiki_path(@project, "home")
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "test GitLab API doc Rake tasks"
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-02-04 02:48:33 -05:00
|
|
|
step 'I add a header to the wiki page' do
|
|
|
|
fill_in "wiki[content]", with: "# Wiki header\n"
|
|
|
|
fill_in "wiki[message]", with: "Add header to wiki"
|
2017-04-06 09:55:11 -04:00
|
|
|
page.within '.wiki-form' do
|
|
|
|
click_button "Create page"
|
|
|
|
end
|
2014-02-04 02:48:33 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'Wiki header should have correct id and link' do
|
|
|
|
header_should_have_correct_id_and_link(1, 'Wiki header', 'wiki-header')
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on test link' do
|
2013-10-11 07:44:00 -04:00
|
|
|
click_link "test"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I see new wiki page named test' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_wiki_path(@project, "test")
|
2016-02-08 17:56:45 -05:00
|
|
|
|
|
|
|
page.within(:css, ".nav-text") do
|
|
|
|
expect(page).to have_content "Test"
|
2016-11-15 12:32:57 -05:00
|
|
|
expect(page).to have_content "Create Page"
|
2016-02-08 17:56:45 -05:00
|
|
|
end
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
When 'I go back to wiki page home' do
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_wiki_path(@project, "home")
|
|
|
|
expect(current_path).to eq project_wiki_path(@project, "home")
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on GitLab API doc link' do
|
2013-10-11 07:44:00 -04:00
|
|
|
click_link "GitLab API"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I see Gitlab API document' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_wiki_path(@project, "api")
|
2016-02-13 14:58:07 -05:00
|
|
|
|
|
|
|
page.within(:css, ".nav-text") do
|
2016-11-15 12:32:57 -05:00
|
|
|
expect(page).to have_content "Create"
|
2016-02-13 14:58:07 -05:00
|
|
|
expect(page).to have_content "Api"
|
|
|
|
end
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on Rake tasks link' do
|
2013-10-11 07:44:00 -04:00
|
|
|
click_link "Rake tasks"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I see Rake tasks directory' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_wiki_path(@project, "raketasks")
|
2016-02-13 14:58:07 -05:00
|
|
|
|
|
|
|
page.within(:css, ".nav-text") do
|
2016-11-15 12:32:57 -05:00
|
|
|
expect(page).to have_content "Create"
|
2016-02-13 14:58:07 -05:00
|
|
|
expect(page).to have_content "Rake"
|
|
|
|
end
|
2013-10-11 07:44:00 -04:00
|
|
|
end
|
2013-10-11 15:41:33 -04:00
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I go directory which contains README file' do
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_tree_path(@project, "markdown/doc/api")
|
|
|
|
expect(current_path).to eq project_tree_path(@project, "markdown/doc/api")
|
2013-10-14 09:55:44 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click on a relative link in README' do
|
2013-10-14 09:55:44 -04:00
|
|
|
click_link "Users"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see the correct markdown' do
|
2017-06-29 13:06:35 -04:00
|
|
|
expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/users.md")
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content "List users"
|
2013-10-14 09:55:44 -04:00
|
|
|
end
|
2014-02-04 02:48:33 -05:00
|
|
|
|
|
|
|
step 'Header "Application details" should have correct id and link' do
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2014-02-04 02:48:33 -05:00
|
|
|
header_should_have_correct_id_and_link(2, 'Application details', 'application-details')
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'Header "GitLab API" should have correct id and link' do
|
|
|
|
header_should_have_correct_id_and_link(1, 'GitLab API', 'gitlab-api')
|
|
|
|
end
|
2013-10-14 09:55:44 -04:00
|
|
|
end
|