From 0b5947849a32991904f8cbc5e4612d2438b97e0b Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 21 Dec 2017 17:25:50 +0000 Subject: Fix broken spinach test --- features/steps/shared/builds.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'features') diff --git a/features/steps/shared/builds.rb b/features/steps/shared/builds.rb index c267195f0e8..a3e4459f169 100644 --- a/features/steps/shared/builds.rb +++ b/features/steps/shared/builds.rb @@ -11,7 +11,7 @@ module SharedBuilds step 'project has a recent build' do @pipeline = create(:ci_empty_pipeline, project: @project, sha: @project.commit.sha, ref: 'master') - @build = create(:ci_build, :coverage, pipeline: @pipeline) + @build = create(:ci_build, :running, :coverage, pipeline: @pipeline) end step 'recent build is successful' do -- cgit v1.2.1 From 27c95364b52f4e93054c45211010aeb22e40a2b2 Mon Sep 17 00:00:00 2001 From: blackst0ne Date: Fri, 22 Dec 2017 19:18:28 +1100 Subject: Replace '.team << [user, role]' with 'add_role(user)' in specs --- features/steps/profile/profile.rb | 2 +- features/steps/project/deploy_keys.rb | 4 ++-- features/steps/project/fork.rb | 4 ++-- features/steps/project/forked_merge_requests.rb | 2 +- features/steps/project/source/browse_files.rb | 2 +- features/steps/project/source/markdown_render.rb | 2 +- features/steps/shared/group.rb | 2 +- features/steps/shared/project.rb | 21 ++++++++++----------- 8 files changed, 19 insertions(+), 20 deletions(-) (limited to 'features') diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb index 4b88cb5e27f..d3b88ae8d2a 100644 --- a/features/steps/profile/profile.rb +++ b/features/steps/profile/profile.rb @@ -165,7 +165,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps @project = create(:project, :repository, namespace: @group) @event = create(:closed_issue_event, project: @project) - @project.team << [current_user, :master] + @project.add_master(current_user) end step 'I should see groups I belong to' do diff --git a/features/steps/project/deploy_keys.rb b/features/steps/project/deploy_keys.rb index b4403becb0d..9db31522c5c 100644 --- a/features/steps/project/deploy_keys.rb +++ b/features/steps/project/deploy_keys.rb @@ -48,11 +48,11 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps step 'other projects have deploy keys' do @second_project = create(:project, namespace: create(:group)) - @second_project.team << [current_user, :master] + @second_project.add_master(current_user) create(:deploy_keys_project, project: @second_project) @third_project = create(:project, namespace: create(:group)) - @third_project.team << [current_user, :master] + @third_project.add_master(current_user) create(:deploy_keys_project, project: @third_project, deploy_key: @second_project.deploy_keys.first) end diff --git a/features/steps/project/fork.rb b/features/steps/project/fork.rb index 60707f26aee..0350e1c2aef 100644 --- a/features/steps/project/fork.rb +++ b/features/steps/project/fork.rb @@ -10,7 +10,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps step 'I am a member of project "Shop"' do @project = create(:project, :repository, name: "Shop") - @project.team << [@user, :reporter] + @project.add_reporter(@user) end step 'I should see the forked project page' do @@ -71,7 +71,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps step 'There is an existent fork of the "Shop" project' do user = create(:user, name: 'Mike') - @project.team << [user, :reporter] + @project.add_reporter(user) @forked_project = Projects::ForkService.new(@project, user).execute end diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb index 6781a906a94..fd51ee1a316 100644 --- a/features/steps/project/forked_merge_requests.rb +++ b/features/steps/project/forked_merge_requests.rb @@ -10,7 +10,7 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps step 'I am a member of project "Shop"' do @project = ::Project.find_by(name: "Shop") @project ||= create(:project, :repository, name: "Shop") - @project.team << [@user, :reporter] + @project.add_reporter(@user) end step 'I have a project forked off of "Shop" called "Forked Shop"' do diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 93b057430d3..afaad4b255e 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -8,7 +8,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps step "I don't have write access" do @project = create(:project, :repository, name: "Other Project", path: "other-project") - @project.team << [@user, :reporter] + @project.add_reporter(@user) visit project_tree_path(@project, root_ref) end diff --git a/features/steps/project/source/markdown_render.rb b/features/steps/project/source/markdown_render.rb index f6445b57ec0..fc4ef26f6b6 100644 --- a/features/steps/project/source/markdown_render.rb +++ b/features/steps/project/source/markdown_render.rb @@ -10,7 +10,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps step 'I own project "Delta"' do @project = ::Project.find_by(name: "Delta") @project ||= create(:project, :repository, name: "Delta", namespace: @user.namespace) - @project.team << [@user, :master] + @project.add_master(@user) end step 'I should see files from repository in markdown' do diff --git a/features/steps/shared/group.rb b/features/steps/shared/group.rb index 03bc7e798e0..0a0588346b1 100644 --- a/features/steps/shared/group.rb +++ b/features/steps/shared/group.rb @@ -41,7 +41,7 @@ module SharedGroup group.add_user(user, role) project ||= create(:project, :repository, namespace: group) create(:closed_issue_event, project: project) - project.team << [user, :master] + project.add_master(user) end def owned_group diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index 5e4edaf99a6..affbccccdf9 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -4,13 +4,13 @@ module SharedProject # Create a project without caring about what it's called step "I own a project" do @project = create(:project, :repository, namespace: @user.namespace) - @project.team << [@user, :master] + @project.add_master(@user) end step "I own a project in some group namespace" do @group = create(:group, name: 'some group') @project = create(:project, namespace: @group) - @project.team << [@user, :master] + @project.add_master(@user) end step "project exists in some group namespace" do @@ -22,7 +22,7 @@ module SharedProject step 'I own project "Shop"' do @project = Project.find_by(name: "Shop") @project ||= create(:project, :repository, name: "Shop", namespace: @user.namespace) - @project.team << [@user, :master] + @project.add_master(@user) end step 'I disable snippets in project' do @@ -40,7 +40,7 @@ module SharedProject step 'I add a user to project "Shop"' do @project = Project.find_by(name: "Shop") other_user = create(:user, name: 'Alpha') - @project.team << [other_user, :master] + @project.add_master(other_user) end # Create another specific project called "Forum" @@ -49,14 +49,13 @@ module SharedProject @project ||= create(:project, :repository, name: "Forum", namespace: @user.namespace, path: 'forum_project') @project.build_project_feature @project.project_feature.save - @project.team << [@user, :master] + @project.add_master(@user) end # Create an empty project without caring about the name step 'I own an empty project' do - @project = create(:project, - name: 'Empty Project', namespace: @user.namespace) - @project.team << [@user, :master] + @project = create(:project, name: 'Empty Project', namespace: @user.namespace) + @project.add_master(@user) end step 'I visit my empty project page' do @@ -101,11 +100,11 @@ module SharedProject # ---------------------------------------- step 'I am member of a project with a guest role' do - @project.team << [@user, Gitlab::Access::GUEST] + @project.add_guest(@user) end step 'I am member of a project with a reporter role' do - @project.team << [@user, Gitlab::Access::REPORTER] + @project.add_reporter(@user) end # ---------------------------------------- @@ -245,6 +244,6 @@ module SharedProject user = user_exists(user_name, username: user_name.gsub(/\s/, '').underscore) project = Project.find_by(name: project_name) project ||= create(:project, visibility, name: project_name, namespace: user.namespace) - project.team << [user, :master] + project.add_master(user) end end -- cgit v1.2.1 From f7ffe27c2e4075789ccd9e798c8a88c9e1d85a4e Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 21 Dec 2017 23:40:56 -0800 Subject: Disable /dev/shm in CI According to the Chrome source code (https://chromium.googlesource.com/chromium/src/base/+/master/base_switches.cc#120): The /dev/shm partition is too small in certain VM environments, causing Chrome to fail or crash (see http://crbug.com/715363). Use this flag to work-around this issue (a temporary directory will always be used to create anonymous shared memory files). Addresses gitlab-org/gitlab-ee#4252 but doesn't appear to cure it completely. --- features/support/capybara.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'features') diff --git a/features/support/capybara.rb b/features/support/capybara.rb index 5a77b859113..4e2b3c67af5 100644 --- a/features/support/capybara.rb +++ b/features/support/capybara.rb @@ -29,6 +29,9 @@ Capybara.register_driver :chrome do |app| options.add_argument("disable-gpu") end + # Disable /dev/shm use in CI. See https://gitlab.com/gitlab-org/gitlab-ee/issues/4252 + options.add_argument("disable-dev-shm-usage") if ENV['CI'] || ENV['CI_SERVER'] + Capybara::Selenium::Driver.new( app, browser: :chrome, -- cgit v1.2.1 From 40264b87af1c8a228a6b943367d6cd06d9f8d812 Mon Sep 17 00:00:00 2001 From: Semyon Pupkov Date: Sun, 24 Dec 2017 17:03:38 +0500 Subject: Move invites spinach test to Rspec https://gitlab.com/gitlab-org/gitlab-ce/issues/23036 --- features/invites.feature | 45 -------------------------- features/steps/invites.rb | 80 ----------------------------------------------- 2 files changed, 125 deletions(-) delete mode 100644 features/invites.feature delete mode 100644 features/steps/invites.rb (limited to 'features') diff --git a/features/invites.feature b/features/invites.feature deleted file mode 100644 index dc8eefaeaed..00000000000 --- a/features/invites.feature +++ /dev/null @@ -1,45 +0,0 @@ -Feature: Invites - Background: - Given "John Doe" is owner of group "Owned" - And "John Doe" has invited "user@example.com" to group "Owned" - - Scenario: Viewing invitation when signed out - When I visit the invitation page - Then I should be redirected to the sign in page - And I should see a notice telling me to sign in - - Scenario: Signing in to view invitation - When I visit the invitation page - And I sign in as "Mary Jane" - Then I should be redirected to the invitation page - - Scenario: Viewing invitation when signed in - Given I sign in as "Mary Jane" - And I visit the invitation page - Then I should see the invitation details - And I should see an "Accept invitation" button - And I should see a "Decline" button - - Scenario: Viewing invitation as an existing member - Given I sign in as "John Doe" - And I visit the invitation page - Then I should see a message telling me I'm already a member - - Scenario: Accepting the invitation - Given I sign in as "Mary Jane" - And I visit the invitation page - And I click the "Accept invitation" button - Then I should be redirected to the group page - And I should see a notice telling me I have access - - Scenario: Declining the application when signed in - Given I sign in as "Mary Jane" - And I visit the invitation page - And I click the "Decline" button - Then I should be redirected to the dashboard - And I should see a notice telling me I have declined - - Scenario: Declining the application when signed out - When I visit the invitation's decline page - Then I should be redirected to the sign in page - And I should see a notice telling me I have declined diff --git a/features/steps/invites.rb b/features/steps/invites.rb deleted file mode 100644 index dac972172aa..00000000000 --- a/features/steps/invites.rb +++ /dev/null @@ -1,80 +0,0 @@ -class Spinach::Features::Invites < Spinach::FeatureSteps - include SharedAuthentication - include SharedUser - include SharedGroup - - step '"John Doe" has invited "user@example.com" to group "Owned"' do - user = User.find_by(name: "John Doe") - group = Group.find_by(name: "Owned") - group.add_developer("user@example.com", user) - end - - step 'I visit the invitation page' do - group = Group.find_by(name: "Owned") - invite = group.group_members.invite.last - invite.generate_invite_token! - @raw_invite_token = invite.raw_invite_token - visit invite_path(@raw_invite_token) - end - - step 'I should be redirected to the sign in page' do - expect(current_path).to eq(new_user_session_path) - end - - step 'I should see a notice telling me to sign in' do - expect(page).to have_content "To accept this invitation, sign in" - end - - step 'I should be redirected to the invitation page' do - expect(current_path).to eq(invite_path(@raw_invite_token)) - end - - step 'I should see the invitation details' do - expect(page).to have_content("You have been invited by John Doe to join group Owned as Developer.") - end - - step "I should see a message telling me I'm already a member" do - expect(page).to have_content("However, you are already a member of this group.") - end - - step 'I should see an "Accept invitation" button' do - expect(page).to have_link("Accept invitation") - end - - step 'I should see a "Decline" button' do - expect(page).to have_link("Decline") - end - - step 'I click the "Accept invitation" button' do - page.click_link "Accept invitation" - end - - step 'I should be redirected to the group page' do - group = Group.find_by(name: "Owned") - expect(current_path).to eq(group_path(group)) - end - - step 'I should see a notice telling me I have access' do - expect(page).to have_content("You have been granted Developer access to group Owned.") - end - - step 'I click the "Decline" button' do - page.click_link "Decline" - end - - step 'I should be redirected to the dashboard' do - expect(current_path).to eq(dashboard_projects_path) - end - - step 'I should see a notice telling me I have declined' do - expect(page).to have_content("You have declined the invitation to join group Owned.") - end - - step "I visit the invitation's decline page" do - group = Group.find_by(name: "Owned") - invite = group.group_members.invite.last - invite.generate_invite_token! - @raw_invite_token = invite.raw_invite_token - visit decline_invite_path(@raw_invite_token) - end -end -- cgit v1.2.1 From 7a815d7585a8a433359297f37b349604bfbcf2c8 Mon Sep 17 00:00:00 2001 From: Semyon Pupkov Date: Sun, 24 Dec 2017 22:46:30 +0500 Subject: Move explore groups spinach test to RSpec https://gitlab.com/gitlab-org/gitlab-ce/issues/23036 --- features/explore/groups.feature | 105 --------------------------------------- features/steps/explore/groups.rb | 88 -------------------------------- 2 files changed, 193 deletions(-) delete mode 100644 features/explore/groups.feature delete mode 100644 features/steps/explore/groups.rb (limited to 'features') diff --git a/features/explore/groups.feature b/features/explore/groups.feature deleted file mode 100644 index 830810615e0..00000000000 --- a/features/explore/groups.feature +++ /dev/null @@ -1,105 +0,0 @@ -@public -Feature: Explore Groups - Background: - Given group "TestGroup" has private project "Enterprise" - - @javascript - Scenario: I should see group with private and internal projects as user - Given group "TestGroup" has internal project "Internal" - When I sign in as a user - And I visit group "TestGroup" page - Then I should see project "Internal" items - And I should not see project "Enterprise" items - - @javascript - Scenario: I should see group issues for internal project as user - Given group "TestGroup" has internal project "Internal" - When I sign in as a user - And I visit group "TestGroup" issues page - Then I should see project "Internal" items - And I should not see project "Enterprise" items - - @javascript - Scenario: I should see group merge requests for internal project as user - Given group "TestGroup" has internal project "Internal" - When I sign in as a user - And I visit group "TestGroup" merge requests page - Then I should see project "Internal" items - And I should not see project "Enterprise" items - - @javascript - Scenario: I should see group with private, internal and public projects as visitor - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I visit group "TestGroup" page - Then I should see project "Community" items - And I should not see project "Internal" items - And I should not see project "Enterprise" items - - @javascript - Scenario: I should see group issues for public project as visitor - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I visit group "TestGroup" issues page - Then I should see project "Community" items - And I should not see project "Internal" items - And I should not see project "Enterprise" items - - @javascript - Scenario: I should see group merge requests for public project as visitor - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I visit group "TestGroup" merge requests page - Then I should see project "Community" items - And I should not see project "Internal" items - And I should not see project "Enterprise" items - - @javascript - Scenario: I should see group with private, internal and public projects as user - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I sign in as a user - And I visit group "TestGroup" page - Then I should see project "Community" items - And I should see project "Internal" items - And I should not see project "Enterprise" items - - @javascript - Scenario: I should see group issues for internal and public projects as user - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I sign in as a user - And I visit group "TestGroup" issues page - Then I should see project "Community" items - And I should see project "Internal" items - And I should not see project "Enterprise" items - - @javascript - Scenario: I should see group merge requests for internal and public projects as user - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I sign in as a user - And I visit group "TestGroup" merge requests page - Then I should see project "Community" items - And I should see project "Internal" items - And I should not see project "Enterprise" items - - @javascript - Scenario: I should see group with public project in public groups area - Given group "TestGroup" has public project "Community" - When I visit the public groups area - Then I should see group "TestGroup" - - @javascript - Scenario: I should see group with public project in public groups area as user - Given group "TestGroup" has public project "Community" - When I sign in as a user - And I visit the public groups area - Then I should see group "TestGroup" - - @javascript - Scenario: I should see group with internal project in public groups area as user - Given group "TestGroup" has internal project "Internal" - When I sign in as a user - And I visit the public groups area - Then I should see group "TestGroup" diff --git a/features/steps/explore/groups.rb b/features/steps/explore/groups.rb deleted file mode 100644 index 409bf0cb416..00000000000 --- a/features/steps/explore/groups.rb +++ /dev/null @@ -1,88 +0,0 @@ -class Spinach::Features::ExploreGroups < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedGroup - include SharedProject - - step 'group "TestGroup" has private project "Enterprise"' do - group_has_project("TestGroup", "Enterprise", Gitlab::VisibilityLevel::PRIVATE) - end - - step 'group "TestGroup" has internal project "Internal"' do - group_has_project("TestGroup", "Internal", Gitlab::VisibilityLevel::INTERNAL) - end - - step 'group "TestGroup" has public project "Community"' do - group_has_project("TestGroup", "Community", Gitlab::VisibilityLevel::PUBLIC) - end - - step '"John Doe" is owner of group "TestGroup"' do - group = Group.find_by(name: "TestGroup") || create(:group, name: "TestGroup") - user = create(:user, name: "John Doe") - group.add_owner(user) - end - - step 'I visit group "TestGroup" page' do - visit group_path(Group.find_by(name: "TestGroup")) - end - - step 'I visit group "TestGroup" issues page' do - visit issues_group_path(Group.find_by(name: "TestGroup")) - end - - step 'I visit group "TestGroup" merge requests page' do - visit merge_requests_group_path(Group.find_by(name: "TestGroup")) - end - - step 'I visit group "TestGroup" members page' do - visit group_group_members_path(Group.find_by(name: "TestGroup")) - end - - step 'I should not see project "Enterprise" items' do - expect(page).not_to have_content "Enterprise" - end - - step 'I should see project "Internal" items' do - expect(page).to have_content "Internal" - end - - step 'I should not see project "Internal" items' do - expect(page).not_to have_content "Internal" - end - - step 'I should see project "Community" items' do - expect(page).to have_content "Community" - end - - step 'I change filter to Everyone\'s' do - click_link "Everyone's" - end - - step 'I should see group member "John Doe"' do - expect(page).to have_content "John Doe" - end - - protected - - def group_has_project(groupname, projectname, visibility_level) - group = Group.find_by(name: groupname) || create(:group, name: groupname) - project = create(:project, - namespace: group, - name: projectname, - path: "#{groupname}-#{projectname}", - visibility_level: visibility_level - ) - create(:issue, - title: "#{projectname} feature", - project: project - ) - create(:merge_request, - title: "#{projectname} feature implemented", - source_project: project, - target_project: project - ) - create(:closed_issue_event, - project: project - ) - end -end -- cgit v1.2.1 From 27a75ea1757d1c1b67bf501ec333221ed5e92d04 Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Wed, 20 Dec 2017 10:01:21 +0100 Subject: Backport 'Rebase' feature from EE to CE When a project uses fast-forward merging strategy user has to rebase MRs to target branch before it can be merged. Now user can do rebase in UI by clicking 'Rebase' button instead of doing rebase locally. This feature was already present in EE, this is only backport of the feature to CE. Couple of changes: * removed rebase license check * renamed migration (changed timestamp) Closes #40301 --- features/project/ff_merge_requests.feature | 17 +++++++++++++++++ features/steps/project/ff_merge_requests.rb | 22 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) (limited to 'features') diff --git a/features/project/ff_merge_requests.feature b/features/project/ff_merge_requests.feature index 995e52f9332..39035d551d1 100644 --- a/features/project/ff_merge_requests.feature +++ b/features/project/ff_merge_requests.feature @@ -22,3 +22,20 @@ Feature: Project Ff Merge Requests Then I should see ff-only merge button When I accept this merge request Then I should see merged request + + @javascript + Scenario: I do rebase before ff-only merge + Given ff merge enabled + And rebase before merge enabled + When I visit merge request page "Bug NS-05" + Then I should see rebase button + When I press rebase button + Then I should see rebase in progress message + + @javascript + Scenario: I do rebase before regular merge + Given rebase before merge enabled + When I visit merge request page "Bug NS-05" + Then I should see rebase button + When I press rebase button + Then I should see rebase in progress message diff --git a/features/steps/project/ff_merge_requests.rb b/features/steps/project/ff_merge_requests.rb index d68fe71e16e..27efcfd65b6 100644 --- a/features/steps/project/ff_merge_requests.rb +++ b/features/steps/project/ff_merge_requests.rb @@ -17,6 +17,10 @@ class Spinach::Features::ProjectFfMergeRequests < Spinach::FeatureSteps author: project.users.first) end + step 'merge request is mergeable' do + expect(page).to have_button 'Merge' + end + step 'I should see ff-only merge button' do expect(page).to have_content "Fast-forward merge without a merge commit" expect(page).to have_button 'Merge' @@ -45,6 +49,10 @@ class Spinach::Features::ProjectFfMergeRequests < Spinach::FeatureSteps project.save! end + step 'I should see rebase button' do + expect(page).to have_button "Rebase" + end + step 'merge request "Bug NS-05" is rebased' do merge_request.source_branch = 'flatten-dir' merge_request.target_branch = 'improve/awesome' @@ -59,6 +67,20 @@ class Spinach::Features::ProjectFfMergeRequests < Spinach::FeatureSteps merge_request.save! end + step 'rebase before merge enabled' do + project = merge_request.target_project + project.merge_requests_rebase_enabled = true + project.save! + end + + step 'I press rebase button' do + click_button "Rebase" + end + + step "I should see rebase in progress message" do + expect(page).to have_content("Rebase in progress") + end + def merge_request @merge_request ||= MergeRequest.find_by!(title: "Bug NS-05") end -- cgit v1.2.1