diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-04-20 18:27:03 -0500 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-04-27 12:23:26 -0500 |
commit | 0cfb38194c32547b0e6cbcbfcc06f96f2ec05ffb (patch) | |
tree | 37dc011a7f67320bae916ecf350a04510131a059 /features | |
parent | a6536a84e75952ffba7bb5cea07673963d820766 (diff) | |
download | gitlab-ce-0cfb38194c32547b0e6cbcbfcc06f96f2ec05ffb.tar.gz |
Fix feature specs
Diffstat (limited to 'features')
-rw-r--r-- | features/project/source/browse_files.feature | 3 | ||||
-rw-r--r-- | features/project/source/markdown_render.feature | 12 | ||||
-rw-r--r-- | features/steps/project/source/browse_files.rb | 3 | ||||
-rw-r--r-- | features/steps/project/source/markdown_render.rb | 10 | ||||
-rw-r--r-- | features/steps/shared/markdown.rb | 2 |
5 files changed, 28 insertions, 2 deletions
diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature index d81bc9802bc..472ec9544f3 100644 --- a/features/project/source/browse_files.feature +++ b/features/project/source/browse_files.feature @@ -10,7 +10,8 @@ Feature: Project Source Browse Files Scenario: I browse files for specific ref Given I visit project source page for "6d39438" Then I should see files from repository for "6d39438" - + + @javascript Scenario: I browse file content Given I click on ".gitignore" file in repo Then I should see its content diff --git a/features/project/source/markdown_render.feature b/features/project/source/markdown_render.feature index ecbd721c281..fd583618dcf 100644 --- a/features/project/source/markdown_render.feature +++ b/features/project/source/markdown_render.feature @@ -6,11 +6,13 @@ Feature: Project Source Markdown Render # 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 @@ -29,36 +31,42 @@ Feature: Project Source Markdown Render 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 @@ -73,6 +81,7 @@ Feature: Project Source Markdown Render 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 @@ -80,6 +89,7 @@ Feature: Project Source Markdown Render 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 @@ -87,6 +97,7 @@ Feature: Project Source Markdown Render 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" @@ -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. # 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" diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index b4741f06d1b..36fe21a047c 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -4,6 +4,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps include SharedProject include SharedPaths include RepoHelpers + include WaitForAjax step "I don't have write access" do @project = create(:project, :repository, name: "Other Project", path: "other-project") @@ -36,10 +37,12 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I should see its content' do + wait_for_ajax expect(page).to have_content old_gitignore_content end step 'I should see its new content' do + wait_for_ajax expect(page).to have_content new_gitignore_content end diff --git a/features/steps/project/source/markdown_render.rb b/features/steps/project/source/markdown_render.rb index 0f0827f0477..abdbd795cd5 100644 --- a/features/steps/project/source/markdown_render.rb +++ b/features/steps/project/source/markdown_render.rb @@ -5,6 +5,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps include SharedAuthentication include SharedPaths include SharedMarkdown + include WaitForAjax step 'I own project "Delta"' do @project = ::Project.find_by(name: "Delta") @@ -34,6 +35,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps 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") + wait_for_ajax expect(page).to have_content "All API requests require authentication" end @@ -63,6 +65,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps 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") + wait_for_ajax expect(page).to have_content "bundle exec rake gitlab:env:info RAILS_ENV=production" end @@ -94,6 +97,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps step 'I see correct file rendered' do 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_link "Users" expect(page).to have_link "Rake tasks" @@ -138,6 +142,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps 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") + wait_for_ajax expect(page).to have_content "Contents" expect(page).to have_link "Users" expect(page).to have_link "Rake tasks" @@ -145,6 +150,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps 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") + wait_for_ajax expect(page).to have_content "All API requests require authentication" end @@ -162,6 +168,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps # Expected link contents 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") end @@ -197,6 +204,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps end 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' end @@ -291,10 +299,12 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps 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") + wait_for_ajax expect(page).to have_content "List users" end 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') end diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index 875d27d9383..6610b97ecb2 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -3,7 +3,7 @@ module SharedMarkdown 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 eq "##{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 |