diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/project/source/markdown_render.feature | 147 | ||||
-rw-r--r-- | features/steps/project/source/markdown_render.rb | 317 | ||||
-rw-r--r-- | features/steps/shared/markdown.rb | 9 |
3 files changed, 0 insertions, 473 deletions
diff --git a/features/project/source/markdown_render.feature b/features/project/source/markdown_render.feature deleted file mode 100644 index fe4466ad241..00000000000 --- a/features/project/source/markdown_render.feature +++ /dev/null @@ -1,147 +0,0 @@ -Feature: Project Source Markdown Render - Background: - Given I sign in as a user - And I own project "Delta" - And I visit markdown branch - - # Tree README - - @javascript - Scenario: Tree view should have correct links in README - Given I go directory which contains README file - And I click on a relative link in README - Then I should see the correct markdown - - @javascript - Scenario: I browse files from markdown branch - Then I should see files from repository in markdown - And I should see rendered README which contains correct links - And I click on Gitlab API in README - Then I should see correct document rendered - - @javascript - Scenario: I view README in markdown branch - Then I should see files from repository in markdown - And I should see rendered README which contains correct links - And I click on Rake tasks in README - Then I should see correct directory rendered - - @javascript - Scenario: I view README in markdown branch to see reference links to directory - Then I should see files from repository in markdown - And I should see rendered README which contains correct links - And I click on GitLab API doc directory in README - Then I should see correct doc/api directory rendered - - @javascript - Scenario: I view README in markdown branch to see reference links to file - Then I should see files from repository in markdown - And I should see rendered README which contains correct links - And I click on Maintenance in README - Then I should see correct maintenance file rendered - - @javascript - Scenario: README headers should have header links - Then I should see rendered README which contains correct links - And Header "Application details" should have correct id and link - - # Blob - - @javascript - Scenario: I navigate to doc directory to view documentation in markdown - And I navigate to the doc/api/README - And I see correct file rendered - And I click on users in doc/api/README - Then I should see the correct document file - - @javascript - Scenario: I navigate to doc directory to view user doc in markdown - And I navigate to the doc/api/README - And I see correct file rendered - And I click on raketasks in doc/api/README - Then I should see correct directory rendered - - @javascript - Scenario: I navigate to doc directory to view user doc in markdown - And I navigate to the doc/api/README - And Header "GitLab API" should have correct id and link - - # Markdown branch - - @javascript - Scenario: I browse files from markdown branch - When I visit markdown branch - Then I should see files from repository in markdown branch - And I should see rendered README which contains correct links - And I click on Gitlab API in README - Then I should see correct document rendered for markdown branch - - @javascript - Scenario: I browse directory from markdown branch - When I visit markdown branch - Then I should see files from repository in markdown branch - And I should see rendered README which contains correct links - And I click on Rake tasks in README - Then I should see correct directory rendered for markdown branch - - @javascript - Scenario: I navigate to doc directory to view documentation in markdown branch - When I visit markdown branch - And I navigate to the doc/api/README - And I see correct file rendered in markdown branch - And I click on users in doc/api/README - 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 - When I visit markdown branch - And I navigate to the doc/api/README - And I see correct file rendered in markdown branch - And I click on raketasks in doc/api/README - Then I should see correct directory rendered for markdown branch - - @javascript - Scenario: Tree markdown links view empty urls should have correct urls - When I visit markdown branch - Then The link with text "empty" should have url "tree/markdown" - When I visit markdown branch "README.md" blob - Then The link with text "empty" should have url "blob/markdown/README.md" - When I visit markdown branch "d" tree - Then The link with text "empty" should have url "tree/markdown/d" - When I visit markdown branch "d/README.md" blob - Then The link with text "empty" should have url "blob/markdown/d/README.md" - - # "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. - @javascript - Scenario: All markdown links with ids should have correct urls - 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" - Then The link with text "README.mdID" should have url "blob/markdown/README.mdID" - Then The link with text "d/README.mdID" should have url "blob/markdown/d/README.mdID" - When I visit markdown branch "README.md" blob - Then The link with text "ID" should have url "blob/markdown/README.mdID" - Then The link with text "/ID" should have url "blob/markdown/README.mdID" - Then The link with text "README.mdID" should have url "blob/markdown/README.mdID" - Then The link with text "d/README.mdID" should have url "blob/markdown/d/README.mdID" - - # Wiki - - Scenario: I create a wiki page with different links - Given I go to wiki page - And I add various links to the wiki page - Then Wiki page should have added links - And I click on test link - Then I see new wiki page named test - When I go back to wiki page home - And I click on GitLab API doc link - Then I see Gitlab API document - When I go back to wiki page home - And I click on Rake tasks link - Then I see Rake tasks directory - - Scenario: Wiki headers should have should have ids generated for them. - Given I go to wiki page - And I add a header to the wiki page - Then Wiki header should have correct id and link diff --git a/features/steps/project/source/markdown_render.rb b/features/steps/project/source/markdown_render.rb deleted file mode 100644 index db99c179439..00000000000 --- a/features/steps/project/source/markdown_render.rb +++ /dev/null @@ -1,317 +0,0 @@ -# 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. -class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedMarkdown - include WaitForRequests - - step 'I own project "Delta"' do - @project = ::Project.find_by(name: "Delta") - @project ||= create(:project, :repository, name: "Delta", namespace: @user.namespace) - @project.add_master(@user) - end - - step 'I should see files from repository in markdown' do - expect(current_path).to eq project_tree_path(@project, "markdown") - expect(page).to have_content "README.md" - expect(page).to have_content "CHANGELOG" - end - - step 'I should see rendered README which contains correct links' do - 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" - end - - step 'I click on Gitlab API in README' do - click_link "GitLab API doc" - end - - step 'I should see correct document rendered' do - expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/README.md") - wait_for_requests - expect(page).to have_content "All API requests require authentication" - end - - step 'I click on Rake tasks in README' do - click_link "Rake tasks" - end - - step 'I should see correct directory rendered' do - expect(current_path).to eq project_tree_path(@project, "markdown/doc/raketasks") - expect(page).to have_content "backup_restore.md" - expect(page).to have_content "maintenance.md" - end - - step 'I click on GitLab API doc directory in README' do - click_link "GitLab API doc directory" - end - - step 'I should see correct doc/api directory rendered' do - expect(current_path).to eq project_tree_path(@project, "markdown/doc/api") - expect(page).to have_content "README.md" - expect(page).to have_content "users.md" - end - - step 'I click on Maintenance in README' do - click_link "Maintenance" - end - - step 'I should see correct maintenance file rendered' do - expect(current_path).to eq project_blob_path(@project, "markdown/doc/raketasks/maintenance.md") - wait_for_requests - expect(page).to have_content "bundle exec rake gitlab:env:info RAILS_ENV=production" - end - - step 'I click on link "empty" in the README' do - page.within('.readme-holder') do - click_link "empty" - end - end - - step 'I click on link "id" in the README' do - page.within('.readme-holder') do - click_link "#id" - end - end - - step 'I navigate to the doc/api/README' do - page.within '.tree-table' do - click_link "doc" - end - - page.within '.tree-table' do - click_link "api" - end - - wait_for_requests - - page.within '.tree-table' do - click_link "README.md" - end - end - - step 'I see correct file rendered' do - expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/README.md") - wait_for_requests - expect(page).to have_content "Contents" - expect(page).to have_link "Users" - expect(page).to have_link "Rake tasks" - end - - step 'I click on users in doc/api/README' do - click_link "Users" - end - - step 'I should see the correct document file' do - expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/users.md") - expect(page).to have_content "Get a list of users." - end - - step 'I click on raketasks in doc/api/README' do - click_link "Rake tasks" - end - - # Markdown branch - - When 'I visit markdown branch' do - visit project_tree_path(@project, "markdown") - wait_for_requests - end - - When 'I visit markdown branch "README.md" blob' do - visit project_blob_path(@project, "markdown/README.md") - end - - When 'I visit markdown branch "d" tree' do - visit project_tree_path(@project, "markdown/d") - end - - When 'I visit markdown branch "d/README.md" blob' do - visit project_blob_path(@project, "markdown/d/README.md") - end - - step 'I should see files from repository in markdown branch' do - expect(current_path).to eq project_tree_path(@project, "markdown") - expect(page).to have_content "README.md" - expect(page).to have_content "CHANGELOG" - end - - step 'I see correct file rendered in markdown branch' do - expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/README.md") - wait_for_requests - expect(page).to have_content "Contents" - expect(page).to have_link "Users" - expect(page).to have_link "Rake tasks" - end - - step 'I should see correct document rendered for markdown branch' do - expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/README.md") - wait_for_requests - expect(page).to have_content "All API requests require authentication" - end - - step 'I should see correct directory rendered for markdown branch' do - expect(current_path).to eq project_tree_path(@project, "markdown/doc/raketasks") - expect(page).to have_content "backup_restore.md" - expect(page).to have_content "maintenance.md" - end - - step 'I should see the users document file in markdown branch' do - expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/users.md") - expect(page).to have_content "Get a list of users." - end - - # Expected link contents - - step 'The link with text "empty" should have url "tree/markdown"' do - wait_for_requests - find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown") - end - - step 'The link with text "empty" should have url "blob/markdown/README.md"' do - find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") - end - - step 'The link with text "empty" should have url "tree/markdown/d"' do - find('a', text: /^empty$/)['href'] == current_host + project_tree_path(@project, "markdown/d") - end - - step 'The link with text "empty" should have '\ - 'url "blob/markdown/d/README.md"' do - find('a', text: /^empty$/)['href'] == current_host + project_blob_path(@project, "markdown/d/README.md") - end - - step 'The link with text "ID" should have url "tree/markdownID"' do - find('a', text: /^#id$/)['href'] == current_host + project_tree_path(@project, "markdown") + '#id' - end - - step 'The link with text "/ID" should have url "tree/markdownID"' do - find('a', text: %r{^/#id$})['href'] == current_host + project_tree_path(@project, "markdown") + '#id' - end - - step 'The link with text "README.mdID" '\ - 'should have url "blob/markdown/README.mdID"' do - find('a', text: /^README.md#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id' - end - - step 'The link with text "d/README.mdID" should have '\ - 'url "blob/markdown/d/README.mdID"' do - find('a', text: %r{^d/README.md#id$})['href'] == current_host + project_blob_path(@project, "d/markdown/README.md") + '#id' - end - - step 'The link with text "ID" should have url "blob/markdown/README.mdID"' do - wait_for_requests - find('a', text: /^#id$/)['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id' - end - - step 'The link with text "/ID" should have url "blob/markdown/README.mdID"' do - find('a', text: %r{^/#id$})['href'] == current_host + project_blob_path(@project, "markdown/README.md") + '#id' - end - - # Wiki - - step 'I go to wiki page' do - first(:link, "Wiki").click - expect(current_path).to eq project_wiki_path(@project, "home") - end - - step 'I add various links to the wiki page' do - fill_in "wiki[content]", with: "[test](test)\n[GitLab API doc](api)\n[Rake tasks](raketasks)\n" - fill_in "wiki[message]", with: "Adding links to wiki" - page.within '.wiki-form' do - click_button "Create page" - end - end - - step 'Wiki page should have added links' do - expect(current_path).to eq project_wiki_path(@project, "home") - expect(page).to have_content "test GitLab API doc Rake tasks" - end - - 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" - page.within '.wiki-form' do - click_button "Create page" - end - end - - step 'Wiki header should have correct id and link' do - header_should_have_correct_id_and_link(1, 'Wiki header', 'wiki-header') - end - - step 'I click on test link' do - click_link "test" - end - - step 'I see new wiki page named test' do - expect(current_path).to eq project_wiki_path(@project, "test") - - page.within(:css, ".nav-text") do - expect(page).to have_content "Test" - expect(page).to have_content "Create Page" - end - end - - When 'I go back to wiki page home' do - visit project_wiki_path(@project, "home") - expect(current_path).to eq project_wiki_path(@project, "home") - end - - step 'I click on GitLab API doc link' do - click_link "GitLab API" - end - - step 'I see Gitlab API document' do - expect(current_path).to eq project_wiki_path(@project, "api") - - page.within(:css, ".nav-text") do - expect(page).to have_content "Create" - expect(page).to have_content "Api" - end - end - - step 'I click on Rake tasks link' do - click_link "Rake tasks" - end - - step 'I see Rake tasks directory' do - expect(current_path).to eq project_wiki_path(@project, "raketasks") - - page.within(:css, ".nav-text") do - expect(page).to have_content "Create" - expect(page).to have_content "Rake" - end - end - - step 'I go directory which contains README file' do - visit project_tree_path(@project, "markdown/doc/api") - expect(current_path).to eq project_tree_path(@project, "markdown/doc/api") - end - - step 'I click on a relative link in README' do - click_link "Users" - end - - step 'I should see the correct markdown' do - expect(current_path).to eq project_blob_path(@project, "markdown/doc/api/users.md") - wait_for_requests - expect(page).to have_content "List users" - end - - step 'Header "Application details" should have correct id and link' do - wait_for_requests - 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 -end diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index 9d522936fb6..65118f07ca2 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -1,15 +1,6 @@ module SharedMarkdown include Spinach::DSL - def header_should_have_correct_id_and_link(level, text, id, parent = ".wiki") - node = find("#{parent} h#{level} a#user-content-#{id}") - expect(node[:href]).to end_with "##{id}" - - # Work around a weird Capybara behavior where calling `parent` on a node - # returns the whole document, not the node's actual parent element - expect(find(:xpath, "#{node.path}/..").text).to eq text - end - step 'I should not see the Markdown preview' do expect(find('.gfm-form .js-md-preview')).not_to be_visible end |