diff options
Diffstat (limited to 'features')
26 files changed, 164 insertions, 99 deletions
diff --git a/features/dashboard/dashboard.feature b/features/dashboard/dashboard.feature index 92061dac7f4..b1d5e4a7acb 100644 --- a/features/dashboard/dashboard.feature +++ b/features/dashboard/dashboard.feature @@ -11,6 +11,7 @@ Feature: Dashboard And I visit dashboard page Scenario: I should see projects list + Then I should see "New Project" link Then I should see "Shop" project link Then I should see "Shop" project CI status diff --git a/features/project/active_tab.feature b/features/project/active_tab.feature index 5c14c5db665..0d6f7350181 100644 --- a/features/project/active_tab.feature +++ b/features/project/active_tab.feature @@ -7,8 +7,9 @@ Feature: Project Active Tab Scenario: On Project Home Given I visit my project's home page - Then the active main tab should be Home - And no other main tabs should be active + Then the active sub tab should be Home + And no other sub tabs should be active + And the active main tab should be Project Scenario: On Project Repository Given I visit my project's files page @@ -34,36 +35,45 @@ Feature: Project Active Tab Scenario: On Project Home/Show Given I visit my project's home page - Then the active main tab should be Home + Then the active sub tab should be Home + And no other sub tabs should be active + And the active main tab should be Project And no other main tabs should be active + Scenario: On Project Home/Activity + Given I visit my project's home page + And I click the "Activity" tab + Then the active sub tab should be Activity + And no other sub tabs should be active + And the active main tab should be Project + # Sub Tabs: Settings Scenario: On Project Settings/Integrations Given I visit my project's settings page And I click the "Integrations" tab - Then the active sub nav should be Integrations - And no other sub navs should be active + Then the active sub tab should be Integrations + And no other sub tabs should be active And the active main tab should be Settings - Scenario: On Project Settings/Deploy Keys + Scenario: On Project Settings/Repository Given I visit my project's settings page - And I click the "Deploy Keys" tab - Then the active sub nav should be Deploy Keys - And no other sub navs should be active + And I click the "Repository" tab + Then the active sub tab should be Repository + And no other sub tabs should be active And the active main tab should be Settings Scenario: On Project Settings/Pages Given I visit my project's settings page And I click the "Pages" tab - Then the active sub nav should be Pages - And no other sub navs should be active + Then the active sub tab should be Pages + And no other sub tabs should be active And the active main tab should be Settings Scenario: On Project Members Given I visit my project's members page - Then the active sub nav should be Members - And no other sub navs should be active + Then the active sub tab should be Members + And no other sub tabs should be active And the active main tab should be Settings # Sub Tabs: Repository @@ -80,9 +90,9 @@ Feature: Project Active Tab And no other sub tabs should be active And the active main tab should be Repository - Scenario: On Project Repository/Network - Given I visit my project's network page - Then the active sub tab should be Network + Scenario: On Project Repository/Graph + Given I visit my project's graph page + Then the active sub tab should be Graph And no other sub tabs should be active And the active main tab should be Repository @@ -93,6 +103,13 @@ Feature: Project Active Tab And no other sub tabs should be active And the active main tab should be Repository + Scenario: On Project Repository/Charts + Given I visit my project's commits page + And I click the "Charts" tab + Then the active sub tab should be Charts + And no other sub tabs should be active + And the active main tab should be Repository + Scenario: On Project Repository/Branches Given I visit my project's commits page And I click the "Branches" tab diff --git a/features/project/commits/branches.feature b/features/project/commits/branches.feature index 88fef674c0c..c57376aecff 100644 --- a/features/project/commits/branches.feature +++ b/features/project/commits/branches.feature @@ -13,6 +13,7 @@ Feature: Project Commits Branches Given I visit project protected branches page Then I should see "Shop" protected branches list + @javascript Scenario: I create a branch Given I visit project branches page And I click new branch link @@ -33,12 +34,7 @@ Feature: Project Commits Branches And I submit new branch form with invalid name Then I should see new an error that branch is invalid - Scenario: I create a branch with invalid reference - Given I visit project branches page - And I click new branch link - And I submit new branch form with invalid reference - Then I should see new an error that ref is invalid - + @javascript Scenario: I create a branch that already exists Given I visit project branches page And I click new branch link diff --git a/features/project/graph.feature b/features/project/graph.feature index 63793d6f989..b25c73ad870 100644 --- a/features/project/graph.feature +++ b/features/project/graph.feature @@ -9,9 +9,10 @@ Feature: Project Graph Then page should have graphs @javascript - Scenario: I should see project commits graphs + Scenario: I should see project languages & commits graphs on commits graph url When I visit project "Shop" commits graph page Then page should have commits graphs + Then page should have languages graphs @javascript Scenario: I should see project ci graphs @@ -20,6 +21,13 @@ Feature: Project Graph Then page should have CI graphs @javascript - Scenario: I should see project languages graphs + Scenario: I should see project languages & commits graphs on language graph url When I visit project "Shop" languages graph page Then page should have languages graphs + Then page should have commits graphs + + @javascript + Scenario: I should see project languages & commits graphs on charts url + When I visit project "Shop" chart page + Then page should have languages graphs + Then page should have commits graphs diff --git a/features/project/issues/award_emoji.feature b/features/project/issues/award_emoji.feature index f0fd414a9f9..1d7adfdd2c2 100644 --- a/features/project/issues/award_emoji.feature +++ b/features/project/issues/award_emoji.feature @@ -42,4 +42,4 @@ Feature: Award Emoji @javascript Scenario: I add award emoji using regular comment Given I leave comment with a single emoji - Then I have award added + Then I have new comment with emoji added diff --git a/features/project/shortcuts.feature b/features/project/shortcuts.feature index f71f69ef060..b47fca31ef2 100644 --- a/features/project/shortcuts.feature +++ b/features/project/shortcuts.feature @@ -19,15 +19,16 @@ Feature: Project Shortcuts Then the active sub tab should be Commits @javascript - Scenario: Navigate to network tab + Scenario: Navigate to graph tab Given I press "g" and "n" - Then the active sub tab should be Network + Then the active sub tab should be Graph And the active main tab should be Repository @javascript - Scenario: Navigate to graphs tab + Scenario: Navigate to repository charts tab Given I press "g" and "g" - Then the active main tab should be Graphs + Then the active sub tab should be Charts + And the active main tab should be Repository @javascript Scenario: Navigate to issues tab @@ -52,9 +53,11 @@ Feature: Project Shortcuts @javascript Scenario: Navigate to project home Given I press "g" and "p" - Then the active main tab should be Home + Then the active sub tab should be Home + And the active main tab should be Project @javascript Scenario: Navigate to project feed Given I press "g" and "e" - Then the active main tab should be Activity + Then the active sub tab should be Activity + And the active main tab should be Project diff --git a/features/steps/dashboard/todos.rb b/features/steps/dashboard/todos.rb index eb906a55a83..9f01dff776f 100644 --- a/features/steps/dashboard/todos.rb +++ b/features/steps/dashboard/todos.rb @@ -159,7 +159,11 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps end def should_not_see_todo(title) - expect(page).not_to have_content title + expect(page).not_to have_visible_content title + end + + def have_visible_content(text) + have_css('*', text: text, visible: true) end def john_doe diff --git a/features/steps/explore/projects.rb b/features/steps/explore/projects.rb index 2b4a5ab0864..7dc33ab5683 100644 --- a/features/steps/explore/projects.rb +++ b/features/steps/explore/projects.rb @@ -49,7 +49,7 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps step 'I should see an http link to the repository' do project = Project.find_by(name: 'Community') - expect(page).to have_field('project_clone', with: project.http_url_to_repo) + expect(page).to have_field('project_clone', with: project.http_url_to_repo(@user)) end step 'I should see an ssh link to the repository' do diff --git a/features/steps/group/milestones.rb b/features/steps/group/milestones.rb index 70e23098dde..20204ad8654 100644 --- a/features/steps/group/milestones.rb +++ b/features/steps/group/milestones.rb @@ -5,9 +5,7 @@ class Spinach::Features::GroupMilestones < Spinach::FeatureSteps include SharedUser step 'I click on group milestones' do - page.within('.layout-nav') do - click_link 'Milestones' - end + visit group_milestones_path('owned') end step 'I should see group milestones index page has no milestones' do diff --git a/features/steps/project/active_tab.rb b/features/steps/project/active_tab.rb index e842d7bec2b..4befd49ac81 100644 --- a/features/steps/project/active_tab.rb +++ b/features/steps/project/active_tab.rb @@ -22,37 +22,53 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps end step 'I click the "Edit Project"' do - page.within '.layout-nav .controls' do + page.within '.sub-nav' do click_link('Edit Project') end end step 'I click the "Integrations" tab' do - click_link('Integrations') + page.within '.sub-nav' do + click_link('Integrations') + end end - step 'I click the "Deploy Keys" tab' do - click_link('Deploy Keys') + step 'I click the "Repository" tab' do + page.within '.sub-nav' do + click_link('Repository') + end end step 'I click the "Pages" tab' do - click_link('Pages') + page.within '.sub-nav' do + click_link('Pages') + end end - step 'the active sub nav should be Members' do - ensure_active_sub_nav('Members') + step 'I click the "Activity" tab' do + page.within '.sub-nav' do + click_link('Activity') + end end - step 'the active sub nav should be Integrations' do - ensure_active_sub_nav('Integrations') + step 'the active sub tab should be Members' do + ensure_active_sub_tab('Members') end - step 'the active sub nav should be Deploy Keys' do - ensure_active_sub_nav('Deploy Keys') + step 'the active sub tab should be Integrations' do + ensure_active_sub_tab('Integrations') end - step 'the active sub nav should be Pages' do - ensure_active_sub_nav('Pages') + step 'the active sub tab should be Repository' do + ensure_active_sub_tab('Repository') + end + + step 'the active sub tab should be Pages' do + ensure_active_sub_tab('Pages') + end + + step 'the active sub tab should be Activity' do + ensure_active_sub_tab('Activity') end # Sub Tabs: Commits @@ -71,6 +87,12 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps click_link('Tags') end + step 'I click the "Charts" tab' do + page.within '.sub-nav' do + click_link('Charts') + end + end + step 'the active sub tab should be Compare' do ensure_active_sub_tab('Compare') end diff --git a/features/steps/project/builds/artifacts.rb b/features/steps/project/builds/artifacts.rb index 055fca036d3..be0f6eee55a 100644 --- a/features/steps/project/builds/artifacts.rb +++ b/features/steps/project/builds/artifacts.rb @@ -76,7 +76,7 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps base64_params = send_data.sub(/\Aartifacts\-entry:/, '') params = JSON.parse(Base64.urlsafe_decode64(base64_params)) - expect(params.keys).to eq(['Archive', 'Entry']) + expect(params.keys).to eq(%w(Archive Entry)) expect(params['Archive']).to end_with('build_artifacts.zip') expect(params['Entry']).to eq(Base64.encode64('ci_artifacts.txt')) end diff --git a/features/steps/project/commits/branches.rb b/features/steps/project/commits/branches.rb index 5f9b9e0445e..ccaf3237815 100644 --- a/features/steps/project/commits/branches.rb +++ b/features/steps/project/commits/branches.rb @@ -34,25 +34,19 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps step 'I submit new branch form' do fill_in 'branch_name', with: 'deploy_keys' - fill_in 'ref', with: 'master' + select_branch('master') click_button 'Create branch' end step 'I submit new branch form with invalid name' do fill_in 'branch_name', with: '1.0 stable' - fill_in 'ref', with: 'master' - click_button 'Create branch' - end - - step 'I submit new branch form with invalid reference' do - fill_in 'branch_name', with: 'foo' - fill_in 'ref', with: 'foo' + select_branch('master') click_button 'Create branch' end step 'I submit new branch form with branch that already exists' do fill_in 'branch_name', with: 'master' - fill_in 'ref', with: 'master' + select_branch('master') click_button 'Create branch' end @@ -65,10 +59,6 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps expect(page).to have_content "can't contain spaces" end - step 'I should see new an error that ref is invalid' do - expect(page).to have_content 'Invalid reference name' - end - step 'I should see new an error that branch already exists' do expect(page).to have_content 'Branch already exists' end @@ -88,4 +78,12 @@ class Spinach::Features::ProjectCommitsBranches < Spinach::FeatureSteps step "I should not see branch 'improve/awesome'" do expect(page.all(visible: true)).not_to have_content 'improve/awesome' end + + def select_branch(branch_name) + click_button 'master' + + page.within '#new-branch-form .dropdown-menu' do + click_link branch_name + end + end end diff --git a/features/steps/project/commits/commits.rb b/features/steps/project/commits/commits.rb index 18e267294e4..cf75fac8ac6 100644 --- a/features/steps/project/commits/commits.rb +++ b/features/steps/project/commits/commits.rb @@ -163,7 +163,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps end step 'I see commit ci info' do - expect(page).to have_content "Pipeline #1 for 570e7b2a pending" + expect(page).to have_content "Pipeline #1 pending" end step 'I search "submodules" commits' do diff --git a/features/steps/project/commits/revert.rb b/features/steps/project/commits/revert.rb index 94a5d4e2e4d..c9746407344 100644 --- a/features/steps/project/commits/revert.rb +++ b/features/steps/project/commits/revert.rb @@ -36,5 +36,6 @@ class Spinach::Features::RevertCommits < Spinach::FeatureSteps step 'I should see the new merge request notice' do page.should have_content('The commit has been successfully reverted. You can now submit a merge request to get this change into the original branch.') + page.should have_content("From revert-#{Commit.truncate_sha(sample_commit.id)} into master") end end diff --git a/features/steps/project/deploy_keys.rb b/features/steps/project/deploy_keys.rb index edf78f62f9a..580a19494c2 100644 --- a/features/steps/project/deploy_keys.rb +++ b/features/steps/project/deploy_keys.rb @@ -36,7 +36,7 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps end step 'I should be on deploy keys page' do - expect(current_path).to eq namespace_project_deploy_keys_path(@project.namespace, @project) + expect(current_path).to eq namespace_project_settings_repository_path(@project.namespace, @project) end step 'I should see newly created deploy key' do diff --git a/features/steps/project/fork.rb b/features/steps/project/fork.rb index 9a6c04fba7a..79db9728227 100644 --- a/features/steps/project/fork.rb +++ b/features/steps/project/fork.rb @@ -56,7 +56,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps end step 'I should see my fork on the list' do - page.within('.projects-list-holder') do + page.within('.js-projects-list-holder') do project = @user.fork_of(@project) expect(page).to have_content("#{project.namespace.human_name} / #{project.name}") end diff --git a/features/steps/project/graph.rb b/features/steps/project/graph.rb index 48ac7a98f0d..176d04d721c 100644 --- a/features/steps/project/graph.rb +++ b/features/steps/project/graph.rb @@ -18,6 +18,10 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps visit languages_namespace_project_graph_path(project.namespace, project, "master") end + step 'I visit project "Shop" chart page' do + visit charts_namespace_project_graph_path(project.namespace, project, "master") + end + step 'page should have languages graphs' do expect(page).to have_content /Ruby 66.* %/ expect(page).to have_content /JavaScript 22.* %/ diff --git a/features/steps/project/issues/award_emoji.rb b/features/steps/project/issues/award_emoji.rb index cbe5738e7e4..1762d5bdf95 100644 --- a/features/steps/project/issues/award_emoji.rb +++ b/features/steps/project/issues/award_emoji.rb @@ -44,6 +44,10 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps end end + step 'I have new comment with emoji added' do + expect(page).to have_selector ".emoji[title=':smile:']" + end + step 'I have award added' do page.within '.awards' do expect(page).to have_selector '.js-emoji-btn' @@ -86,7 +90,7 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps step 'I see search result for "hand"' do page.within '.emoji-menu-content' do - expect(page).to have_selector '[data-emoji="raised_hand"]' + expect(page).to have_selector '[data-name="raised_hand"]' end end diff --git a/features/steps/project/network_graph.rb b/features/steps/project/network_graph.rb index ff9251615c9..370e46265c7 100644 --- a/features/steps/project/network_graph.rb +++ b/features/steps/project/network_graph.rb @@ -66,7 +66,7 @@ class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps end step 'page should have "v1.0.0" in title' do - expect(page).to have_css 'title', text: 'Network · v1.0.0', visible: false + expect(page).to have_css 'title', text: 'Graph · v1.0.0', visible: false end step 'page should only have content from "v1.0.0"' do diff --git a/features/steps/project/pages.rb b/features/steps/project/pages.rb index c80c6273807..4045955a8b9 100644 --- a/features/steps/project/pages.rb +++ b/features/steps/project/pages.rb @@ -53,13 +53,13 @@ class Spinach::Features::ProjectPages < Spinach::FeatureSteps end step 'pages are exposed on external HTTP address' do - allow(Gitlab.config.pages).to receive(:external_http).and_return('1.1.1.1:80') + allow(Gitlab.config.pages).to receive(:external_http).and_return(['1.1.1.1:80']) allow(Gitlab.config.pages).to receive(:external_https).and_return(nil) end step 'pages are exposed on external HTTPS address' do - allow(Gitlab.config.pages).to receive(:external_http).and_return('1.1.1.1:80') - allow(Gitlab.config.pages).to receive(:external_https).and_return('1.1.1.1:443') + allow(Gitlab.config.pages).to receive(:external_http).and_return(['1.1.1.1:80']) + allow(Gitlab.config.pages).to receive(:external_https).and_return(['1.1.1.1:443']) end step 'I should be able to add a New Domain' do diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index f18adcadcce..5c47eaf0279 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -48,7 +48,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I click link "Raw"' do - click_link 'Raw' + click_link 'Open raw' end step 'I should see raw file content' do @@ -82,7 +82,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I fill the new branch name' do - fill_in :target_branch, with: 'new_branch_name', visible: true + first('button.js-target-branch', visible: true).click + first('.create-new-branch', visible: true).click + first('#new_branch_name', visible: true).set('new_branch_name') + first('.js-new-branch-btn', visible: true).click end step 'I fill the new file name with an illegal name' do @@ -334,6 +337,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps end step 'I click on "files/lfs/lfs_object.iso" file in repo' do + allow_any_instance_of(Project).to receive(:lfs_enabled?).and_return(true) visit namespace_project_tree_path(@project.namespace, @project, "lfs") click_link 'files' click_link "lfs" @@ -352,7 +356,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps step 'I should see buttons for allowed commands' do page.within '.content' do - expect(page).to have_content 'Raw' + expect(page).to have_link 'Open raw' expect(page).to have_content 'History' expect(page).to have_content 'Permalink' expect(page).not_to have_content 'Edit' diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb index 79dde620265..3d9cedf5c2d 100644 --- a/features/steps/shared/issuable.rb +++ b/features/steps/shared/issuable.rb @@ -153,7 +153,7 @@ module SharedIssuable case type when :issue - attrs.merge!(project: project) + attrs[:project] = project when :merge_request attrs.merge!( source_project: project, diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 718cf924729..d5b3bb34d7a 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -232,7 +232,7 @@ module SharedPaths visit stats_namespace_project_repository_path(@project.namespace, @project) end - step "I visit my project's network page" do + step "I visit my project's graph page" do # Stub Graph max_size to speed up test (10 commits vs. 650) Network::Graph.stub(max_count: 10) diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index dae248b8b7e..345a28f27dc 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -166,11 +166,15 @@ module SharedProject end step 'I should see project "Internal"' do - expect(page).to have_content "Internal" + page.within '.js-projects-list-holder' do + expect(page).to have_content "Internal" + end end step 'I should not see project "Internal"' do - expect(page).not_to have_content "Internal" + page.within '.js-projects-list-holder' do + expect(page).not_to have_content "Internal" + end end step 'public project "Community"' do diff --git a/features/steps/shared/project_tab.rb b/features/steps/shared/project_tab.rb index d6024212601..0cb9229dbae 100644 --- a/features/steps/shared/project_tab.rb +++ b/features/steps/shared/project_tab.rb @@ -4,7 +4,7 @@ module SharedProjectTab include Spinach::DSL include SharedActiveTab - step 'the active main tab should be Home' do + step 'the active main tab should be Project' do ensure_active_main_tab('Project') end @@ -12,16 +12,12 @@ module SharedProjectTab ensure_active_main_tab('Repository') end - step 'the active main tab should be Graphs' do - ensure_active_main_tab('Graphs') - end - step 'the active main tab should be Issues' do ensure_active_main_tab('Issues') end - step 'the active main tab should be Members' do - ensure_active_main_tab('Members') + step 'the active sub tab should be Members' do + ensure_active_sub_tab('Members') end step 'the active main tab should be Merge Requests' do @@ -37,15 +33,11 @@ module SharedProjectTab end step 'the active main tab should be Settings' do - expect(page).to have_selector('.layout-nav .nav-links > li.active', count: 0) + ensure_active_main_tab('Settings') end - step 'the active main tab should be Activity' do - ensure_active_main_tab('Activity') - end - - step 'the active sub tab should be Network' do - ensure_active_sub_tab('Network') + step 'the active sub tab should be Graph' do + ensure_active_sub_tab('Graph') end step 'the active sub tab should be Files' do @@ -55,4 +47,16 @@ module SharedProjectTab step 'the active sub tab should be Commits' do ensure_active_sub_tab('Commits') end + + step 'the active sub tab should be Home' do + ensure_active_sub_tab('Home') + end + + step 'the active sub tab should be Activity' do + ensure_active_sub_tab('Activity') + end + + step 'the active sub tab should be Charts' do + ensure_active_sub_tab('Charts') + end end diff --git a/features/support/capybara.rb b/features/support/capybara.rb index 47372df152d..c0c489d2775 100644 --- a/features/support/capybara.rb +++ b/features/support/capybara.rb @@ -1,8 +1,9 @@ require 'spinach/capybara' require 'capybara/poltergeist' +require 'capybara-screenshot/spinach' # Give CI some extra time -timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 90 : 15 +timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 30 : 10 Capybara.javascript_driver = :poltergeist Capybara.register_driver :poltergeist do |app| @@ -20,12 +21,8 @@ end Capybara.default_max_wait_time = timeout Capybara.ignore_hidden_elements = false -unless ENV['CI'] || ENV['CI_SERVER'] - require 'capybara-screenshot/spinach' - - # Keep only the screenshots generated from the last failing test suite - Capybara::Screenshot.prune_strategy = :keep_last_run -end +# Keep only the screenshots generated from the last failing test suite +Capybara::Screenshot.prune_strategy = :keep_last_run Spinach.hooks.before_run do TestEnv.warm_asset_cache unless ENV['CI'] || ENV['CI_SERVER'] |