diff options
Diffstat (limited to 'features/steps')
57 files changed, 102 insertions, 1249 deletions
diff --git a/features/steps/abuse_reports.rb b/features/steps/abuse_reports.rb deleted file mode 100644 index 499accb0b08..00000000000 --- a/features/steps/abuse_reports.rb +++ /dev/null @@ -1,32 +0,0 @@ -class Spinach::Features::AbuseReports < Spinach::FeatureSteps - include SharedAuthentication - - step 'I visit "Mike" user page' do - visit user_path(user_mike) - end - - step 'I click "Report abuse" button' do - click_link 'Report abuse' - end - - step 'I fill and submit abuse form' do - fill_in 'abuse_report_message', with: 'This user send spam' - click_button 'Send report' - end - - step 'I should see success message' do - page.should have_content 'Thank you for your report' - end - - step 'user "Mike" exists' do - user_mike - end - - step 'I should see a red "Report abuse" button' do - expect(page).to have_button("Already reported for abuse") - end - - def user_mike - @user_mike ||= create(:user, name: 'Mike') - end -end diff --git a/features/steps/admin/abuse_reports.rb b/features/steps/admin/abuse_reports.rb deleted file mode 100644 index 0149416c919..00000000000 --- a/features/steps/admin/abuse_reports.rb +++ /dev/null @@ -1,15 +0,0 @@ -class Spinach::Features::AdminAbuseReports < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - - step 'I should see list of abuse reports' do - page.should have_content("Abuse Reports") - page.should have_content AbuseReport.first.message - page.should have_link("Remove user") - end - - step 'abuse reports exist' do - create(:abuse_report) - end -end diff --git a/features/steps/admin/active_tab.rb b/features/steps/admin/active_tab.rb deleted file mode 100644 index 9b1689a8198..00000000000 --- a/features/steps/admin/active_tab.rb +++ /dev/null @@ -1,41 +0,0 @@ -class Spinach::Features::AdminActiveTab < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedActiveTab - - step 'the active main tab should be Overview' do - ensure_active_main_tab('Overview') - end - - step 'the active sub tab should be Projects' do - ensure_active_sub_tab('Projects') - end - - step 'the active sub tab should be Groups' do - ensure_active_sub_tab('Groups') - end - - step 'the active sub tab should be Users' do - ensure_active_sub_tab('Users') - end - - step 'the active main tab should be Hooks' do - ensure_active_main_tab('Hooks') - end - - step 'the active main tab should be Monitoring' do - ensure_active_main_tab('Monitoring') - end - - step 'the active sub tab should be Resque' do - ensure_active_sub_tab('Background Jobs') - end - - step 'the active sub tab should be Logs' do - ensure_active_sub_tab('Logs') - end - - step 'the active main tab should be Messages' do - ensure_active_main_tab('Messages') - end -end diff --git a/features/steps/admin/appearance.rb b/features/steps/admin/appearance.rb deleted file mode 100644 index 0d1be46d11d..00000000000 --- a/features/steps/admin/appearance.rb +++ /dev/null @@ -1,72 +0,0 @@ -class Spinach::Features::AdminAppearance < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - - step 'submit form with new appearance' do - fill_in 'appearance_title', with: 'MyCompany' - fill_in 'appearance_description', with: 'dev server' - click_button 'Save' - end - - step 'I should be redirected to admin appearance page' do - expect(current_path).to eq admin_appearances_path - expect(page).to have_content 'Appearance settings' - end - - step 'I should see newly created appearance' do - expect(page).to have_field('appearance_title', with: 'MyCompany') - expect(page).to have_field('appearance_description', with: 'dev server') - expect(page).to have_content 'Last edit' - end - - step 'I click preview button' do - click_link "Preview" - end - - step 'application has custom appearance' do - create(:appearance) - end - - step 'I should see a customized appearance' do - expect(page).to have_content appearance.title - expect(page).to have_content appearance.description - end - - step 'I attach a logo' do - attach_file(:appearance_logo, Rails.root.join('spec', 'fixtures', 'dk.png')) - click_button 'Save' - end - - step 'I attach header logos' do - attach_file(:appearance_header_logo, Rails.root.join('spec', 'fixtures', 'dk.png')) - click_button 'Save' - end - - step 'I should see a logo' do - expect(page).to have_xpath('//img[@src="/uploads/appearance/logo/1/dk.png"]') - end - - step 'I should see header logos' do - expect(page).to have_xpath('//img[@src="/uploads/appearance/header_logo/1/dk.png"]') - end - - step 'I remove the logo' do - click_link 'Remove logo' - end - - step 'I remove the header logos' do - click_link 'Remove header logo' - end - - step 'I should see logo removed' do - expect(page).not_to have_xpath('//img[@src="/uploads/appearance/logo/1/gitlab_logo.png"]') - end - - step 'I should see header logos removed' do - expect(page).not_to have_xpath('//img[@src="/uploads/appearance/header_logo/1/header_logo_light.png"]') - end - - def appearance - Appearance.last - end -end diff --git a/features/steps/admin/applications.rb b/features/steps/admin/applications.rb deleted file mode 100644 index 7c12cb96921..00000000000 --- a/features/steps/admin/applications.rb +++ /dev/null @@ -1,55 +0,0 @@ -class Spinach::Features::AdminApplications < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - - step 'I click on new application button' do - click_on 'New Application' - end - - step 'I should see application form' do - expect(page).to have_content "New application" - end - - step 'I fill application form out and submit' do - fill_in :doorkeeper_application_name, with: 'test' - fill_in :doorkeeper_application_redirect_uri, with: 'https://test.com' - click_on "Submit" - end - - step 'I see application' do - expect(page).to have_content "Application: test" - expect(page).to have_content "Application Id" - expect(page).to have_content "Secret" - end - - step 'I click edit' do - click_on "Edit" - end - - step 'I see edit application form' do - expect(page).to have_content "Edit application" - end - - step 'I change name of application and submit' do - expect(page).to have_content "Edit application" - fill_in :doorkeeper_application_name, with: 'test_changed' - click_on "Submit" - end - - step 'I see that application was changed' do - expect(page).to have_content "test_changed" - expect(page).to have_content "Application Id" - expect(page).to have_content "Secret" - end - - step 'I click to remove application' do - page.within '.oauth-applications' do - click_on "Destroy" - end - end - - step "I see that application is removed" do - expect(page.find(".oauth-applications")).not_to have_content "test_changed" - end -end diff --git a/features/steps/admin/broadcast_messages.rb b/features/steps/admin/broadcast_messages.rb deleted file mode 100644 index af2b4a29313..00000000000 --- a/features/steps/admin/broadcast_messages.rb +++ /dev/null @@ -1,66 +0,0 @@ -class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - - step 'application already has a broadcast message' do - FactoryGirl.create(:broadcast_message, :expired, message: "Migration to new server") - end - - step 'I should see all broadcast messages' do - expect(page).to have_content "Migration to new server" - end - - step 'I should be redirected to admin messages page' do - expect(current_path).to eq admin_broadcast_messages_path - end - - step 'I should see newly created broadcast message' do - expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST' - end - - step 'submit form with new customized broadcast message' do - fill_in 'broadcast_message_message', with: 'Application update from **4:00 CST to 5:00 CST**' - fill_in 'broadcast_message_color', with: '#f2dede' - fill_in 'broadcast_message_font', with: '#b94a48' - select Date.today.next_year.year, from: "broadcast_message_ends_at_1i" - click_button "Add broadcast message" - end - - step 'I should see a customized broadcast message' do - expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST' - expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST' - expect(page).to have_selector %(div[style="background-color: #f2dede; color: #b94a48"]) - end - - step 'I edit an existing broadcast message' do - click_link 'Edit' - end - - step 'I change the broadcast message text' do - fill_in 'broadcast_message_message', with: 'Application update RIGHT NOW' - click_button 'Update broadcast message' - end - - step 'I should see the updated broadcast message' do - expect(page).to have_content "Application update RIGHT NOW" - end - - step 'I remove an existing broadcast message' do - click_link 'Remove' - end - - step 'I should not see the removed broadcast message' do - expect(page).not_to have_content 'Migration to new server' - end - - step 'I enter a broadcast message with Markdown' do - fill_in 'broadcast_message_message', with: "Live **Markdown** previews. :tada:" - end - - step 'I should see a live preview of the rendered broadcast message' do - page.within('.broadcast-message-preview') do - expect(page).to have_selector('strong', text: 'Markdown') - expect(page).to have_selector('img.emoji') - end - end -end diff --git a/features/steps/admin/deploy_keys.rb b/features/steps/admin/deploy_keys.rb deleted file mode 100644 index 56787eeb6b3..00000000000 --- a/features/steps/admin/deploy_keys.rb +++ /dev/null @@ -1,46 +0,0 @@ -class Spinach::Features::AdminDeployKeys < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - - step 'there are public deploy keys in system' do - create(:deploy_key, public: true) - create(:another_deploy_key, public: true) - end - - step 'I should see all public deploy keys' do - DeployKey.are_public.each do |p| - expect(page).to have_content p.title - end - end - - step 'I visit admin deploy key page' do - visit admin_deploy_key_path(deploy_key) - end - - step 'I visit admin deploy keys page' do - visit admin_deploy_keys_path - end - - step 'I click \'New Deploy Key\'' do - click_link 'New Deploy Key' - end - - step 'I submit new deploy key' do - fill_in "deploy_key_title", with: "laptop" - fill_in "deploy_key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop" - click_button "Create" - end - - step 'I should be on admin deploy keys page' do - expect(current_path).to eq admin_deploy_keys_path - end - - step 'I should see newly created deploy key' do - expect(page).to have_content(deploy_key.title) - end - - def deploy_key - @deploy_key ||= DeployKey.are_public.first - end -end diff --git a/features/steps/admin/groups.rb b/features/steps/admin/groups.rb deleted file mode 100644 index 9396a76f0a2..00000000000 --- a/features/steps/admin/groups.rb +++ /dev/null @@ -1,143 +0,0 @@ -class Spinach::Features::AdminGroups < Spinach::FeatureSteps - include SharedAuthentication - include SharedGroup - include SharedPaths - include SharedUser - include SharedActiveTab - include Select2Helper - - When 'I visit admin group page' do - visit admin_group_path(current_group) - end - - When 'I click new group link' do - click_link "New Group" - end - - step 'I have group with projects' do - @group = create(:group) - @project = create(:project, group: @group) - @event = create(:closed_issue_event, project: @project) - - @project.team << [current_user, :master] - end - - step 'submit form with new group info' do - fill_in 'group_path', with: 'gitlab' - fill_in 'group_description', with: 'Group description' - click_button "Create group" - end - - step 'I should see newly created group' do - expect(page).to have_content "Group: gitlab" - expect(page).to have_content "Group description" - end - - step 'I should be redirected to group page' do - expect(current_path).to eq admin_group_path(Group.find_by(path: 'gitlab')) - end - - When 'I select user "John Doe" from user list as "Reporter"' do - select2(user_john.id, from: "#user_ids", multiple: true) - page.within "#new_project_member" do - select "Reporter", from: "access_level" - end - click_button "Add users to group" - end - - When 'I select user "johndoe@gitlab.com" from user list as "Reporter"' do - select2('johndoe@gitlab.com', from: "#user_ids", multiple: true) - page.within "#new_project_member" do - select "Reporter", from: "access_level" - end - click_button "Add users to group" - end - - step 'I should see "John Doe" in team list in every project as "Reporter"' do - page.within ".group-users-list" do - expect(page).to have_content "John Doe" - expect(page).to have_content "Reporter" - end - end - - step 'I should see "johndoe@gitlab.com" in team list in every project as "Reporter"' do - page.within ".group-users-list" do - expect(page).to have_content "johndoe@gitlab.com" - expect(page).to have_content "Invited by" - expect(page).to have_content "Reporter" - end - end - - step 'I should be all groups' do - Group.all.each do |group| - expect(page).to have_content group.name - end - end - - step 'group has shared projects' do - share_link = shared_project.project_group_links.new(group_access: Gitlab::Access::MASTER) - share_link.group_id = current_group.id - share_link.save! - end - - step 'I visit group page' do - visit admin_group_path(current_group) - end - - step 'I should see project shared with group' do - expect(page).to have_content(shared_project.name_with_namespace) - expect(page).to have_content "Projects shared with" - end - - step 'we have user "John Doe" in group' do - current_group.add_reporter(user_john) - end - - step 'I should not see "John Doe" in team list' do - page.within ".group-users-list" do - expect(page).not_to have_content "John Doe" - end - end - - step 'I select current user as "Developer"' do - page.within ".users-group-form" do - select2(current_user.id, from: "#user_ids", multiple: true) - select "Developer", from: "access_level" - end - - click_button "Add to group" - end - - step 'I should see current user as "Developer"' do - page.within '.content-list' do - expect(page).to have_content(current_user.name) - expect(page).to have_content('Developer') - end - end - - step 'I click on the "Remove User From Group" button for current user' do - find(:css, 'li', text: current_user.name).find(:css, 'a.btn-remove').click - # poltergeist always confirms popups. - end - - step 'I should not see current user as "Developer"' do - page.within '.content-list' do - expect(page).not_to have_content(current_user.name) - expect(page).not_to have_content('Developer') - end - end - - protected - - def current_group - @group ||= Group.first - end - - def shared_project - @shared_project ||= create(:empty_project) - end - - def user_john - @user_john ||= User.find_by(name: "John Doe") - end -end diff --git a/features/steps/admin/hooks.rb b/features/steps/admin/hooks.rb deleted file mode 100644 index 541e25fcb70..00000000000 --- a/features/steps/admin/hooks.rb +++ /dev/null @@ -1,15 +0,0 @@ -class Spinach::Features::AdminHooks < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - - step "I submit the form with enabled SSL verification" do - fill_in 'hook_url', with: 'http://google.com' - check "Enable SSL verification" - click_on "Add System Hook" - end - - step "I see new hook with enabled SSL verification" do - expect(page).to have_content "SSL Verification: enabled" - end -end diff --git a/features/steps/admin/labels.rb b/features/steps/admin/labels.rb deleted file mode 100644 index 55ddcc25085..00000000000 --- a/features/steps/admin/labels.rb +++ /dev/null @@ -1,117 +0,0 @@ -class Spinach::Features::AdminIssuesLabels < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - step 'I visit \'bug\' label edit page' do - visit edit_admin_label_path(bug_label) - end - - step 'I visit admin new label page' do - visit new_admin_label_path - end - - step 'I visit admin labels page' do - visit admin_labels_path - end - - step 'I remove label \'bug\'' do - page.within "#label_#{bug_label.id}" do - click_link 'Delete' - end - end - - step 'I have labels: "bug", "feature", "enhancement"' do - ["bug", "feature", "enhancement"].each do |title| - Label.create(title: title, template: true) - end - end - - step 'I delete all labels' do - page.within '.labels' do - page.all('.btn-remove').each do |remove| - remove.click - sleep 0.05 - end - end - end - - step 'I should see labels help message' do - page.within '.labels' do - expect(page).to have_content 'There are no labels yet' - end - end - - step 'I submit new label \'support\'' do - visit new_admin_label_path - fill_in 'Title', with: 'support' - fill_in 'Background color', with: '#F95610' - click_button 'Save' - end - - step 'I submit new label \'bug\'' do - visit new_admin_label_path - fill_in 'Title', with: 'bug' - fill_in 'Background color', with: '#F95610' - click_button 'Save' - end - - step 'I submit new label with invalid color' do - visit new_admin_label_path - fill_in 'Title', with: 'support' - fill_in 'Background color', with: '#12' - click_button 'Save' - end - - step 'I should see label exist error message' do - page.within '.label-form' do - expect(page).to have_content 'Title has already been taken' - end - end - - step 'I should see label color error message' do - page.within '.label-form' do - expect(page).to have_content 'Color must be a valid color code' - end - end - - step 'I should see label \'feature\'' do - page.within '.manage-labels-list' do - expect(page).to have_content 'feature' - end - end - - step 'I should see label \'bug\'' do - page.within '.manage-labels-list' do - expect(page).to have_content 'bug' - end - end - - step 'I should not see label \'bug\'' do - page.within '.manage-labels-list' do - expect(page).not_to have_content 'bug' - end - end - - step 'I should see label \'support\'' do - page.within '.manage-labels-list' do - expect(page).to have_content 'support' - end - end - - step 'I change label \'bug\' to \'fix\'' do - fill_in 'Title', with: 'fix' - fill_in 'Background color', with: '#F15610' - click_button 'Save' - end - - step 'I should see label \'fix\'' do - page.within '.manage-labels-list' do - expect(page).to have_content 'fix' - end - end - - def bug_label - Label.templates.find_or_create_by(title: 'bug') - end -end diff --git a/features/steps/admin/logs.rb b/features/steps/admin/logs.rb deleted file mode 100644 index 63881d69146..00000000000 --- a/features/steps/admin/logs.rb +++ /dev/null @@ -1,11 +0,0 @@ -class Spinach::Features::AdminLogs < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - - step 'I should see tabs with available logs' do - expect(page).to have_content 'test.log' - expect(page).to have_content 'githost.log' - expect(page).to have_content 'application.log' - end -end diff --git a/features/steps/admin/projects.rb b/features/steps/admin/projects.rb deleted file mode 100644 index 2b8cd030ace..00000000000 --- a/features/steps/admin/projects.rb +++ /dev/null @@ -1,104 +0,0 @@ -class Spinach::Features::AdminProjects < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - include SharedProject - include SharedUser - include Select2Helper - - step 'I should see all non-archived projects' do - Project.non_archived.each do |p| - expect(page).to have_content p.name_with_namespace - end - end - - step 'I should see all projects' do - Project.all.each do |p| - expect(page).to have_content p.name_with_namespace - end - end - - step 'I select "Show archived projects"' do - find(:css, '#sort-projects-dropdown').click - click_link 'Show archived projects' - end - - step 'I should see "archived" label' do - expect(page).to have_xpath("//span[@class='label label-warning']", text: 'archived') - end - - step 'I click on first project' do - click_link Project.first.name_with_namespace - end - - step 'I should see project details' do - project = Project.first - expect(current_path).to eq admin_namespace_project_path(project.namespace, project) - expect(page).to have_content(project.name_with_namespace) - expect(page).to have_content(project.creator.name) - end - - step 'I visit admin project page' do - visit admin_namespace_project_path(project.namespace, project) - end - - step 'I transfer project to group \'Web\'' do - allow_any_instance_of(Projects::TransferService). - to receive(:move_uploads_to_new_namespace).and_return(true) - click_button 'Search for Namespace' - click_link 'group: web' - click_button 'Transfer' - end - - step 'group \'Web\'' do - create(:group, name: 'Web') - end - - step 'I should see project transfered' do - expect(page).to have_content 'Web / ' + project.name - expect(page).to have_content 'Namespace: Web' - end - - step 'I visit project "Enterprise" members page' do - project = Project.find_by!(name: "Enterprise") - visit namespace_project_project_members_path(project.namespace, project) - end - - step 'I select current user as "Developer"' do - page.within ".users-project-form" do - select2(current_user.id, from: "#user_ids", multiple: true) - select "Developer", from: "access_level" - end - - click_button "Add to project" - end - - step 'I should see current user as "Developer"' do - page.within '.content-list' do - expect(page).to have_content(current_user.name) - expect(page).to have_content('Developer') - end - end - - step 'current user is developer of project "Enterprise"' do - project = Project.find_by!(name: "Enterprise") - project.team << [current_user, :developer] - end - - step 'I click on the "Remove User From Project" button for current user' do - find(:css, 'li', text: current_user.name).find(:css, 'a.btn-remove').click - # poltergeist always confirms popups. - end - - step 'I should not see current_user as "Developer"' do - expect(page).not_to have_selector(:css, '.content-list') - end - - def project - @project ||= Project.first - end - - def group - Group.find_by(name: 'Web') - end -end diff --git a/features/steps/admin/settings.rb b/features/steps/admin/settings.rb deleted file mode 100644 index 11dc7f580f0..00000000000 --- a/features/steps/admin/settings.rb +++ /dev/null @@ -1,62 +0,0 @@ -class Spinach::Features::AdminSettings < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - include Gitlab::CurrentSettings - - step 'I modify settings and save form' do - uncheck 'Gravatar enabled' - fill_in 'Home page URL', with: 'https://about.gitlab.com/' - fill_in 'Help page text', with: 'Example text' - click_button 'Save' - end - - step 'I should see application settings saved' do - expect(current_application_settings.gravatar_enabled).to be_falsey - expect(current_application_settings.home_page_url).to eq "https://about.gitlab.com/" - expect(page).to have_content "Application settings saved successfully" - end - - step 'I click on "Service Templates"' do - click_link 'Service Templates' - end - - step 'I click on "Slack" service' do - click_link 'Slack' - end - - step 'I check all events and submit form' do - page.check('Active') - page.check('Push') - page.check('Tag push') - page.check('Note') - page.check('Issue') - page.check('Merge request') - page.check('Build') - page.check('Pipeline') - click_on 'Save' - end - - step 'I fill out Slack settings' do - fill_in 'Webhook', with: 'http://localhost' - fill_in 'Username', with: 'test_user' - fill_in 'service_push_channel', with: '#test_channel' - page.check('Notify only broken builds') - end - - step 'I should see service template settings saved' do - expect(page).to have_content 'Application settings saved successfully' - end - - step 'I should see all checkboxes checked' do - page.all('input[type=checkbox]').each do |checkbox| - expect(checkbox).to be_checked - end - end - - step 'I should see Slack settings saved' do - expect(find_field('Webhook').value).to eq 'http://localhost' - expect(find_field('Username').value).to eq 'test_user' - expect(find('#service_push_channel').value).to eq '#test_channel' - end -end diff --git a/features/steps/admin/spam_logs.rb b/features/steps/admin/spam_logs.rb deleted file mode 100644 index ad825fd414c..00000000000 --- a/features/steps/admin/spam_logs.rb +++ /dev/null @@ -1,28 +0,0 @@ -class Spinach::Features::AdminSpamLogs < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - - step 'I should see list of spam logs' do - expect(page).to have_content('Spam Logs') - expect(page).to have_content spam_log.source_ip - expect(page).to have_content spam_log.noteable_type - expect(page).to have_content 'N' - expect(page).to have_content spam_log.title - expect(page).to have_content truncate(spam_log.description) - expect(page).to have_link('Remove user') - expect(page).to have_link('Block user') - end - - step 'spam logs exist' do - create(:spam_log) - end - - def spam_log - @spam_log ||= SpamLog.first - end - - def truncate(description) - "#{spam_log.description[0...97]}..." - end -end diff --git a/features/steps/admin/users.rb b/features/steps/admin/users.rb deleted file mode 100644 index 8fb8a86d58b..00000000000 --- a/features/steps/admin/users.rb +++ /dev/null @@ -1,167 +0,0 @@ -class Spinach::Features::AdminUsers < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedAdmin - - before do - allow(Gitlab::OAuth::Provider).to receive(:providers).and_return([:twitter, :twitter_updated]) - allow_any_instance_of(ApplicationHelper).to receive(:user_omniauth_authorize_path).and_return(root_path) - end - - after do - allow(Gitlab::OAuth::Provider).to receive(:providers).and_call_original - allow_any_instance_of(ApplicationHelper).to receive(:user_omniauth_authorize_path).and_call_original - end - - step 'I should see all users' do - User.all.each do |user| - expect(page).to have_content user.name - end - end - - step 'Click edit' do - @user = User.first - find("#edit_user_#{@user.id}").click - end - - step 'Input non ascii char in username' do - fill_in 'user_username', with: "\u3042\u3044" - end - - step 'Click save' do - click_button("Save") - end - - step 'See username error message' do - page.within "#error_explanation" do - expect(page).to have_content "Username" - end - end - - step 'Not changed form action url' do - expect(page).to have_selector %(form[action="/admin/users/#{@user.username}"]) - end - - step 'I submit modified user' do - check :user_can_create_group - click_button 'Save' - end - - step 'I see user attributes changed' do - expect(page).to have_content 'Can create groups: Yes' - end - - step 'click edit on my user' do - find("#edit_user_#{current_user.id}").click - end - - step 'I view the user with secondary email' do - @user_with_secondary_email = User.last - @user_with_secondary_email.emails.new(email: "secondary@example.com") - @user_with_secondary_email.save - visit "/admin/users/#{@user_with_secondary_email.username}" - end - - step 'I see the secondary email' do - expect(page).to have_content "Secondary email: #{@user_with_secondary_email.emails.last.email}" - end - - step 'I click remove secondary email' do - find("#remove_email_#{@user_with_secondary_email.emails.last.id}").click - end - - step 'I should not see secondary email anymore' do - expect(page).not_to have_content "Secondary email:" - end - - step 'user "Mike" with groups and projects' do - user = create(:user, name: 'Mike') - - project = create(:empty_project) - project.team << [user, :developer] - - group = create(:group) - group.add_developer(user) - end - - step 'click on "Mike" link' do - click_link "Mike" - end - - step 'I should see user "Mike" details' do - expect(page).to have_content 'Account' - expect(page).to have_content 'Personal projects limit' - end - - step 'user "Pete" with ssh keys' do - user = create(:user, name: 'Pete') - create(:key, user: user, title: "ssh-rsa Key1", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4FIEBXGi4bPU8kzxMefudPIJ08/gNprdNTaO9BR/ndy3+58s2HCTw2xCHcsuBmq+TsAqgEidVq4skpqoTMB+Uot5Uzp9z4764rc48dZiI661izoREoKnuRQSsRqUTHg5wrLzwxlQbl1MVfRWQpqiz/5KjBC7yLEb9AbusjnWBk8wvC1bQPQ1uLAauEA7d836tgaIsym9BrLsMVnR4P1boWD3Xp1B1T/ImJwAGHvRmP/ycIqmKdSpMdJXwxcb40efWVj0Ibbe7ii9eeoLdHACqevUZi6fwfbymdow+FeqlkPoHyGg3Cu4vD/D8+8cRc7mE/zGCWcQ15Var83Tczour Key1") - create(:key, user: user, title: "ssh-rsa Key2", key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQSTWXhJAX/He+nG78MiRRRn7m0Pb0XbcgTxE0etArgoFoh9WtvDf36HG6tOSg/0UUNcp0dICsNAmhBKdncp6cIyPaXJTURPRAGvhI0/VDk4bi27bRnccGbJ/hDaUxZMLhhrzY0r22mjVf8PF6dvv5QUIQVm1/LeaWYsHHvLgiIjwrXirUZPnFrZw6VLREoBKG8uWvfSXw1L5eapmstqfsME8099oi+vWLR8MgEysZQmD28M73fgW4zek6LDQzKQyJx9nB+hJkKUDvcuziZjGmRFlNgSA2mguERwL1OXonD8WYUrBDGKroIvBT39zS5d9tQDnidEJZ9Y8gv5ViYP7x Key2") - end - - step 'click on user "Pete"' do - click_link 'Pete' - end - - step 'I should see key list' do - expect(page).to have_content 'ssh-rsa Key2' - expect(page).to have_content 'ssh-rsa Key1' - end - - step 'I click on the key title' do - click_link 'ssh-rsa Key2' - end - - step 'I should see key details' do - expect(page).to have_content 'ssh-rsa Key2' - expect(page).to have_content 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQSTWXhJAX/He+nG78MiRRRn7m0Pb0XbcgTxE0etArgoFoh9WtvDf36HG6tOSg/0UUNcp0dICsNAmhBKdncp6cIyPaXJTURPRAGvhI0/VDk4bi27bRnccGbJ/hDaUxZMLhhrzY0r22mjVf8PF6dvv5QUIQVm1/LeaWYsHHvLgiIjwrXirUZPnFrZw6VLREoBKG8uWvfSXw1L5eapmstqfsME8099oi+vWLR8MgEysZQmD28M73fgW4zek6LDQzKQyJx9nB+hJkKUDvcuziZjGmRFlNgSA2mguERwL1OXonD8WYUrBDGKroIvBT39zS5d9tQDnidEJZ9Y8gv5ViYP7x Key2' - end - - step 'I click on remove key' do - click_link 'Remove' - end - - step 'I should see the key removed' do - expect(page).not_to have_content 'ssh-rsa Key2' - end - - step 'user "Pete" with twitter account' do - @user = create(:user, name: 'Pete') - @user.identities.create!(extern_uid: '123456', provider: 'twitter') - end - - step 'I visit "Pete" identities page in admin' do - visit admin_user_identities_path(@user) - end - - step 'I should see twitter details' do - expect(page).to have_content 'Pete' - expect(page).to have_content 'twitter' - end - - step 'I modify twitter identity' do - find('.table').find(:link, 'Edit').click - fill_in 'identity_extern_uid', with: '654321' - select 'twitter_updated', from: 'identity_provider' - click_button 'Save changes' - end - - step 'I should see twitter details updated' do - expect(page).to have_content 'Pete' - expect(page).to have_content 'twitter_updated' - expect(page).to have_content '654321' - end - - step 'I remove twitter identity' do - click_link 'Delete' - end - - step 'I should not see twitter details' do - expect(page).to have_content 'Pete' - expect(page).not_to have_content 'twitter' - end - - step 'click on ssh keys tab' do - click_link 'SSH keys' - end -end diff --git a/features/steps/dashboard/active_tab.rb b/features/steps/dashboard/active_tab.rb deleted file mode 100644 index 04fe96cef22..00000000000 --- a/features/steps/dashboard/active_tab.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Spinach::Features::DashboardActiveTab < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedSidebarActiveTab -end diff --git a/features/steps/dashboard/archived_projects.rb b/features/steps/dashboard/archived_projects.rb deleted file mode 100644 index 6510f8d9b32..00000000000 --- a/features/steps/dashboard/archived_projects.rb +++ /dev/null @@ -1,26 +0,0 @@ -class Spinach::Features::DashboardArchivedProjects < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - - When 'project "Forum" is archived' do - project = Project.find_by(name: "Forum") - project.update_attribute(:archived, true) - end - - step 'I should see "Shop" project link' do - expect(page).to have_link "Shop" - end - - step 'I should not see "Forum" project link' do - expect(page).not_to have_link "Forum" - end - - step 'I should see "Forum" project link' do - expect(page).to have_link "Forum" - end - - step 'I click "Show archived projects" link' do - click_link "Show archived projects" - end -end diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb index b2bec369e0f..33a1c88e33c 100644 --- a/features/steps/dashboard/dashboard.rb +++ b/features/steps/dashboard/dashboard.rb @@ -35,7 +35,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps step 'I have group with projects' do @group = create(:group) - @project = create(:project, namespace: @group) + @project = create(:empty_project, namespace: @group) @event = create(:closed_issue_event, project: @project) @project.team << [current_user, :master] @@ -54,8 +54,8 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps end step 'group has a projects that does not belongs to me' do - @forbidden_project1 = create(:project, group: @group) - @forbidden_project2 = create(:project, group: @group) + @forbidden_project1 = create(:empty_project, group: @group) + @forbidden_project2 = create(:empty_project, group: @group) end step 'I should see 1 project at group list' do diff --git a/features/steps/dashboard/group.rb b/features/steps/dashboard/group.rb deleted file mode 100644 index cf679fea530..00000000000 --- a/features/steps/dashboard/group.rb +++ /dev/null @@ -1,25 +0,0 @@ -class Spinach::Features::DashboardGroup < Spinach::FeatureSteps - include SharedAuthentication - include SharedGroup - include SharedPaths - include SharedUser - - step 'I click new group link' do - click_link "New Group" - end - - step 'submit form with new group "Samurai" info' do - fill_in 'group_path', with: 'Samurai' - fill_in 'group_description', with: 'Tokugawa Shogunate' - click_button "Create group" - end - - step 'I should be redirected to group "Samurai" page' do - expect(current_path).to eq group_path(Group.find_by(name: 'Samurai')) - end - - step 'I should see newly created group "Samurai"' do - expect(page).to have_content "Samurai" - expect(page).to have_content "Tokugawa Shogunate" - end -end diff --git a/features/steps/dashboard/help.rb b/features/steps/dashboard/help.rb deleted file mode 100644 index 3c5bf44c538..00000000000 --- a/features/steps/dashboard/help.rb +++ /dev/null @@ -1,21 +0,0 @@ -class Spinach::Features::DashboardHelp < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedMarkdown - - step 'I visit the help page' do - visit help_path - end - - step 'I visit the "Rake Tasks" help page' do - visit help_page_path("administration/raketasks/maintenance") - end - - step 'I should see "Rake Tasks" page markdown rendered' do - expect(page).to have_content "Gather information about GitLab and the system it runs on" - end - - step 'Header "Rebuild project satellites" should have correct ids and links' do - header_should_have_correct_id_and_link(2, 'Check GitLab configuration', 'check-gitlab-configuration', '.documentation') - end -end diff --git a/features/steps/dashboard/issues.rb b/features/steps/dashboard/issues.rb index 39c65bb6cde..4e15d79ae74 100644 --- a/features/steps/dashboard/issues.rb +++ b/features/steps/dashboard/issues.rb @@ -79,13 +79,13 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps def project @project ||= begin - project = create :project + project = create(:empty_project) project.team << [current_user, :master] project end end def public_project - @public_project ||= create :project, :public + @public_project ||= create(:empty_project, :public) end end diff --git a/features/steps/dashboard/merge_requests.rb b/features/steps/dashboard/merge_requests.rb index 6777101fb15..909ffec3646 100644 --- a/features/steps/dashboard/merge_requests.rb +++ b/features/steps/dashboard/merge_requests.rb @@ -105,14 +105,14 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps def project @project ||= begin - project = create :project + project = create(:project, :repository) project.team << [current_user, :master] project end end def public_project - @public_project ||= create :project, :public + @public_project ||= create(:project, :public, :repository) end def forked_project diff --git a/features/steps/group/members.rb b/features/steps/group/members.rb index cefc55d07ab..adaf375453c 100644 --- a/features/steps/group/members.rb +++ b/features/steps/group/members.rb @@ -117,7 +117,12 @@ class Spinach::Features::GroupMembers < Spinach::FeatureSteps member = mary_jane_member page.within "#group_member_#{member.id}" do - select 'Developer', from: "member_access_level_#{member.id}" + click_button member.human_access + + page.within '.dropdown-menu' do + click_link 'Developer' + end + wait_for_ajax end end diff --git a/features/steps/group/milestones.rb b/features/steps/group/milestones.rb index f5fddab357d..70e23098dde 100644 --- a/features/steps/group/milestones.rb +++ b/features/steps/group/milestones.rb @@ -104,7 +104,7 @@ class Spinach::Features::GroupMilestones < Spinach::FeatureSteps group = owned_group %w(gitlabhq gitlab-ci cookbook-gitlab).each do |path| - project = create :project, path: path, group: group + project = create(:empty_project, path: path, group: group) milestone = create :milestone, title: "Version 7.2", project: project create(:label, project: project, title: 'bug') @@ -131,5 +131,7 @@ class Spinach::Features::GroupMilestones < Spinach::FeatureSteps issue.labels << project.labels.find_by(title: 'bug') issue.labels << project.labels.find_by(title: 'feature') end + + current_user.refresh_authorized_projects end end diff --git a/features/steps/groups.rb b/features/steps/groups.rb index 0c88838767c..4dc87dc4d9c 100644 --- a/features/steps/groups.rb +++ b/features/steps/groups.rb @@ -109,7 +109,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps step 'Group "Owned" has archived project' do group = Group.find_by(name: 'Owned') - @archived_project = create(:project, namespace: group, archived: true, path: "archived-project") + @archived_project = create(:empty_project, :archived, namespace: group, path: "archived-project") end step 'I should see "archived" label' do diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb index ea480d2ad68..24cfbaad7fe 100644 --- a/features/steps/profile/profile.rb +++ b/features/steps/profile/profile.rb @@ -162,7 +162,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps step 'I have group with projects' do @group = create(:group) @group.add_owner(current_user) - @project = create(:project, namespace: @group) + @project = create(:project, :repository, namespace: @group) @event = create(:closed_issue_event, project: @project) @project.team << [current_user, :master] diff --git a/features/steps/project/active_tab.rb b/features/steps/project/active_tab.rb index 58225032859..9f701840f1d 100644 --- a/features/steps/project/active_tab.rb +++ b/features/steps/project/active_tab.rb @@ -27,8 +27,8 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps end end - step 'I click the "Hooks" tab' do - click_link('Webhooks') + step 'I click the "Integrations" tab' do + click_link('Integrations') end step 'I click the "Deploy Keys" tab' do @@ -39,8 +39,8 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps ensure_active_sub_nav('Members') end - step 'the active sub nav should be Hooks' do - ensure_active_sub_nav('Webhooks') + step 'the active sub nav should be Integrations' do + ensure_active_sub_nav('Integrations') end step 'the active sub nav should be Deploy Keys' do diff --git a/features/steps/project/commits/commits.rb b/features/steps/project/commits/commits.rb index 007dfb67a77..18e267294e4 100644 --- a/features/steps/project/commits/commits.rb +++ b/features/steps/project/commits/commits.rb @@ -166,15 +166,6 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps expect(page).to have_content "Pipeline #1 for 570e7b2a pending" end - step 'I click status link' do - find('.commit-ci-menu').click_link "Builds" - end - - step 'I see builds list' do - expect(page).to have_content "Pipeline #1 for 570e7b2a pending" - expect(page).to have_content "1 build" - end - step 'I search "submodules" commits' do fill_in 'commits-search', with: 'submodules' end diff --git a/features/steps/project/deploy_keys.rb b/features/steps/project/deploy_keys.rb index 83b9ef48392..edf78f62f9a 100644 --- a/features/steps/project/deploy_keys.rb +++ b/features/steps/project/deploy_keys.rb @@ -46,11 +46,11 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps end step 'other projects have deploy keys' do - @second_project = create(:project, namespace: create(:group)) + @second_project = create(:empty_project, namespace: create(:group)) @second_project.team << [current_user, :master] create(:deploy_keys_project, project: @second_project) - @third_project = create(:project, namespace: create(:group)) + @third_project = create(:empty_project, namespace: create(:group)) @third_project.team << [current_user, :master] 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 70dbd030003..9a6c04fba7a 100644 --- a/features/steps/project/fork.rb +++ b/features/steps/project/fork.rb @@ -9,7 +9,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps end step 'I am a member of project "Shop"' do - @project = create(:project, name: "Shop") + @project = create(:project, :repository, name: "Shop") @project.team << [@user, :reporter] end @@ -18,7 +18,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps end step 'I already have a project named "Shop" in my namespace' do - @my_project = create(:project, name: "Shop", namespace: current_user.namespace) + @my_project = create(:project, :repository, name: "Shop", namespace: current_user.namespace) end step 'I should see a "Name has already been taken" warning' do diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb index 6c14d835004..c0827ff8fc7 100644 --- a/features/steps/project/forked_merge_requests.rb +++ b/features/steps/project/forked_merge_requests.rb @@ -7,7 +7,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, name: "Shop") + @project ||= create(:project, :repository, name: "Shop") @project.team << [@user, :reporter] end diff --git a/features/steps/project/hooks.rb b/features/steps/project/hooks.rb index 13c0713669a..37b608ffbd3 100644 --- a/features/steps/project/hooks.rb +++ b/features/steps/project/hooks.rb @@ -36,12 +36,12 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps end step 'I should see newly created hook' do - expect(current_path).to eq namespace_project_hooks_path(current_project.namespace, current_project) + expect(current_path).to eq namespace_project_settings_integrations_path(current_project.namespace, current_project) expect(page).to have_content(@url) end step 'I should see newly created hook with SSL verification enabled' do - expect(current_path).to eq namespace_project_hooks_path(current_project.namespace, current_project) + expect(current_path).to eq namespace_project_settings_integrations_path(current_project.namespace, current_project) expect(page).to have_content(@url) expect(page).to have_content("SSL Verification: enabled") end @@ -57,7 +57,7 @@ class Spinach::Features::ProjectHooks < Spinach::FeatureSteps end step 'hook should be triggered' do - expect(current_path).to eq namespace_project_hooks_path(current_project.namespace, current_project) + expect(current_path).to eq namespace_project_settings_integrations_path(current_project.namespace, current_project) expect(page).to have_selector '.flash-notice', text: 'Hook executed successfully: HTTP 200' end diff --git a/features/steps/project/issues/issues.rb b/features/steps/project/issues/issues.rb index b50f5238e80..aaf0ede67e6 100644 --- a/features/steps/project/issues/issues.rb +++ b/features/steps/project/issues/issues.rb @@ -62,7 +62,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps end step 'I click link "New Issue"' do - click_link "New Issue" + page.has_link?('New Issue') ? click_link('New Issue') : click_link('New issue') end step 'I click "author" dropdown' do diff --git a/features/steps/project/labels.rb b/features/steps/project/labels.rb index 118ffef4774..dbeb07c78db 100644 --- a/features/steps/project/labels.rb +++ b/features/steps/project/labels.rb @@ -2,9 +2,7 @@ class Spinach::Features::Labels < Spinach::FeatureSteps include SharedAuthentication include SharedIssuable include SharedProject - include SharedNote include SharedPaths - include SharedMarkdown step 'And I visit project "Shop" labels page' do visit namespace_project_labels_path(project.namespace, project) diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index 2ccab4334eb..d2fa8cd39af 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -413,37 +413,37 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I click link "Hide inline discussion" of the third file' do - page.within '.files [id^=diff]:nth-child(3)' do + page.within '.files>div:nth-child(3)' do find('.js-toggle-diff-comments').trigger('click') end end step 'I click link "Show inline discussion" of the third file' do - page.within '.files [id^=diff]:nth-child(3)' do + page.within '.files>div:nth-child(3)' do find('.js-toggle-diff-comments').trigger('click') end end step 'I should not see a comment like "Line is wrong" in the third file' do - page.within '.files [id^=diff]:nth-child(3)' do + page.within '.files>div:nth-child(3)' do expect(page).not_to have_visible_content "Line is wrong" end end step 'I should see a comment like "Line is wrong" in the third file' do - page.within '.files [id^=diff]:nth-child(3) .note-body > .note-text' do + page.within '.files>div:nth-child(3) .note-body > .note-text' do expect(page).to have_visible_content "Line is wrong" end end step 'I should not see a comment like "Line is wrong here" in the third file' do - page.within '.files [id^=diff]:nth-child(3)' do + page.within '.files>div:nth-child(3)' do expect(page).not_to have_visible_content "Line is wrong here" end end step 'I should see a comment like "Line is wrong here" in the third file' do - page.within '.files [id^=diff]:nth-child(3) .note-body > .note-text' do + page.within '.files>div:nth-child(3) .note-body > .note-text' do expect(page).to have_visible_content "Line is wrong here" end end @@ -456,7 +456,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps click_button "Comment" end - page.within ".files [id^=diff]:nth-child(2) .note-body > .note-text" do + page.within ".files>div:nth-child(2) .note-body > .note-text" do expect(page).to have_content "Line is correct" end end @@ -471,7 +471,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I should still see a comment like "Line is correct" in the second file' do - page.within '.files [id^=diff]:nth-child(2) .note-body > .note-text' do + page.within '.files>div:nth-child(2) .note-body > .note-text' do expect(page).to have_visible_content "Line is correct" end end @@ -494,7 +494,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps end step 'I should see comments on the side-by-side diff page' do - page.within '.files [id^=diff]:nth-child(2) .parallel .note-body > .note-text' do + page.within '.files>div:nth-child(2) .parallel .note-body > .note-text' do expect(page).to have_visible_content "Line is correct" end end @@ -515,7 +515,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps step 'I should see new target branch changes' do expect(page).to have_content 'Request to merge fix into feature' - expect(page).to have_content 'Target branch changed from merge-test to feature' + expect(page).to have_content 'changed target branch from merge-test to feature' wait_for_ajax end diff --git a/features/steps/project/merge_requests/acceptance.rb b/features/steps/project/merge_requests/acceptance.rb index 4fda0731e2f..0a3f4649870 100644 --- a/features/steps/project/merge_requests/acceptance.rb +++ b/features/steps/project/merge_requests/acceptance.rb @@ -28,7 +28,7 @@ class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps step 'There is an open Merge Request' do @user = create(:user) - @project = create(:project, :public) + @project = create(:project, :public, :repository) @project_member = create(:project_member, :developer, user: @user, project: @project) @merge_request = create(:merge_request, :with_diffs, :simple, source_project: @project) end diff --git a/features/steps/project/merge_requests/revert.rb b/features/steps/project/merge_requests/revert.rb index efbc4831ce1..3cc4fe9dafb 100644 --- a/features/steps/project/merge_requests/revert.rb +++ b/features/steps/project/merge_requests/revert.rb @@ -35,7 +35,7 @@ class Spinach::Features::RevertMergeRequests < Spinach::FeatureSteps step 'There is an open Merge Request' do @user = create(:user) - @project = create(:project, :public) + @project = create(:project, :public, :repository) @project_member = create(:project_member, :developer, user: @user, project: @project) @merge_request = create(:merge_request, :with_diffs, :simple, source_project: @project) end diff --git a/features/steps/project/redirects.rb b/features/steps/project/redirects.rb index 1ffd5cb9de5..92936f27c20 100644 --- a/features/steps/project/redirects.rb +++ b/features/steps/project/redirects.rb @@ -4,11 +4,11 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps include SharedProject step 'public project "Community"' do - create :project, :public, name: 'Community' + create(:empty_project, :public, name: 'Community') end step 'private project "Enterprise"' do - create :project, name: 'Enterprise' + create(:empty_project, :private, name: 'Enterprise') end step 'I visit project "Community" page' do diff --git a/features/steps/project/services.rb b/features/steps/project/services.rb index bd6466f3686..772b07d0ad8 100644 --- a/features/steps/project/services.rb +++ b/features/steps/project/services.rb @@ -4,7 +4,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps include SharedPaths step 'I visit project "Shop" services page' do - visit namespace_project_services_path(@project.namespace, @project) + visit namespace_project_settings_integrations_path(@project.namespace, @project) end step 'I should see list of available services' do @@ -137,17 +137,17 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps expect(find_field('Colorize messages').value).to eq '1' end - step 'I click Slack service link' do - click_link 'Slack' + step 'I click Slack notifications service link' do + click_link 'Slack notifications' end - step 'I fill Slack settings' do + step 'I fill Slack notifications settings' do check 'Active' fill_in 'Webhook', with: 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685' click_button 'Save' end - step 'I should see Slack service settings saved' do + step 'I should see Slack Notifications service settings saved' do expect(find_field('Webhook').value).to eq 'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685' end diff --git a/features/steps/project/snippets.rb b/features/steps/project/snippets.rb index 5e7d539add6..a3bebfa4b71 100644 --- a/features/steps/project/snippets.rb +++ b/features/steps/project/snippets.rb @@ -22,7 +22,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps end step 'I click link "New snippet"' do - click_link "New snippet" + first(:link, "New snippet").click end step 'I click link "Snippet one"' do diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb index 1cc9e37b075..f18adcadcce 100644 --- a/features/steps/project/source/browse_files.rb +++ b/features/steps/project/source/browse_files.rb @@ -6,7 +6,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps include RepoHelpers step "I don't have write access" do - @project = create(:project, name: "Other Project", path: "other-project") + @project = create(:project, :repository, name: "Other Project", path: "other-project") @project.team << [@user, :reporter] visit namespace_project_tree_path(@project.namespace, @project, root_ref) end diff --git a/features/steps/project/source/markdown_render.rb b/features/steps/project/source/markdown_render.rb index 2134dae168a..9183de76881 100644 --- a/features/steps/project/source/markdown_render.rb +++ b/features/steps/project/source/markdown_render.rb @@ -8,7 +8,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps step 'I own project "Delta"' do @project = Project.find_by(name: "Delta") - @project ||= create(:project, name: "Delta", namespace: @user.namespace) + @project ||= create(:project, :repository, name: "Delta", namespace: @user.namespace) @project.team << [@user, :master] end @@ -241,7 +241,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps page.within(:css, ".nav-text") do expect(page).to have_content "Test" - expect(page).to have_content "Edit Page" + expect(page).to have_content "Create Page" end end @@ -258,7 +258,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps expect(current_path).to eq namespace_project_wiki_path(@project.namespace, @project, "api") page.within(:css, ".nav-text") do - expect(page).to have_content "Edit" + expect(page).to have_content "Create" expect(page).to have_content "Api" end end @@ -271,7 +271,7 @@ class Spinach::Features::ProjectSourceMarkdownRender < Spinach::FeatureSteps expect(current_path).to eq namespace_project_wiki_path(@project.namespace, @project, "raketasks") page.within(:css, ".nav-text") do - expect(page).to have_content "Edit" + expect(page).to have_content "Create" expect(page).to have_content "Rake" end end diff --git a/features/steps/project/team_management.rb b/features/steps/project/team_management.rb index b21d0849ad1..6986c7ede56 100644 --- a/features/steps/project/team_management.rb +++ b/features/steps/project/team_management.rb @@ -65,7 +65,11 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps user = User.find_by(name: 'Dmitriy') project_member = project.project_members.find_by(user_id: user.id) page.within "#project_member_#{project_member.id}" do - select "Reporter", from: "member_access_level_#{project_member.id}" + click_button project_member.human_access + + page.within '.dropdown-menu' do + click_link 'Reporter' + end end end @@ -109,8 +113,10 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps project.team << [user, :reporter] end - step 'I click link "Import team from another project"' do - click_link "Import" + step 'I click link "Import team from another project"' do + page.within '.users-project-form' do + click_link "Import" + end end When 'I submit "Website" project for import team' do @@ -131,7 +137,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps step 'I share project with group "OpenSource"' do project = Project.find_by(name: 'Shop') os_group = create(:group, name: 'OpenSource') - create(:project, group: os_group) + create(:empty_project, group: os_group) @os_user1 = create(:user) @os_user2 = create(:user) os_group.add_owner(@os_user1) @@ -144,7 +150,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps step 'I should see "Opensource" group user listing' do page.within '.project-members-groups' do expect(page).to have_content('OpenSource') - expect(find('select').value).to eq('40') + expect(first('.group_member')).to have_content('Master') end end end diff --git a/features/steps/project/wiki.rb b/features/steps/project/wiki.rb index 07a955b1a14..4cb0a21fbb4 100644 --- a/features/steps/project/wiki.rb +++ b/features/steps/project/wiki.rb @@ -29,7 +29,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps expect(page).to have_content "link test" click_link "link test" - expect(page).to have_content "Edit Page" + expect(page).to have_content "Create Page" end step 'I have an existing Wiki page' do @@ -80,13 +80,9 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps expect(page).to have_content "Page was successfully deleted" end - step 'I click on the "Pages" button' do - click_on "Pages" - end - step 'I should see the existing page in the pages list' do expect(page).to have_content current_user.name - expect(page).to have_content @page.title + expect(find('.wiki-pages')).to have_content @page.title.capitalize end step 'I have an existing Wiki page with images linked on page' do @@ -125,7 +121,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps step 'I should see the new wiki page form' do expect(current_path).to match('wikis/image.jpg') expect(page).to have_content('New Wiki Page') - expect(page).to have_content('Edit Page') + expect(page).to have_content('Create Page') end step 'I create a New page with paths' do @@ -142,8 +138,8 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'I edit the Wiki page with a path' do - expect(page).to have_content('three') - click_on 'three' + expect(find('.wiki-pages')).to have_content('Three') + click_on 'Three' expect(find('.nav-text')).to have_content('Three') click_on 'Edit' end @@ -157,7 +153,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end step 'I view the page history of a Wiki page that has a path' do - click_on 'three' + click_on 'Three' click_on 'Page History' end diff --git a/features/steps/shared/admin.rb b/features/steps/shared/admin.rb index fbaa408226e..ac0a1764147 100644 --- a/features/steps/shared/admin.rb +++ b/features/steps/shared/admin.rb @@ -2,7 +2,7 @@ module SharedAdmin include Spinach::DSL step 'there are projects in system' do - 2.times { create(:project) } + 2.times { create(:project, :repository) } end step 'system has users' do diff --git a/features/steps/shared/authentication.rb b/features/steps/shared/authentication.rb index 735e0ef6108..5c3e724746b 100644 --- a/features/steps/shared/authentication.rb +++ b/features/steps/shared/authentication.rb @@ -33,6 +33,6 @@ module SharedAuthentication end def current_user - @user || User.first + @user || User.reorder(nil).first end end diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index 35b71599708..11fa85ed2fe 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -1,6 +1,11 @@ module SharedDiffNote include Spinach::DSL include RepoHelpers + include WaitForAjax + + after do + wait_for_ajax if javascript_test? + end step 'I cancel the diff comment' do page.within(diff_file_selector) do diff --git a/features/steps/shared/group.rb b/features/steps/shared/group.rb index fe6736dacd4..de119f2c6c0 100644 --- a/features/steps/shared/group.rb +++ b/features/steps/shared/group.rb @@ -40,7 +40,7 @@ module SharedGroup user = User.find_by(name: username) || create(:user, name: username) group = Group.find_by(name: groupname) || create(:group, name: groupname) group.add_user(user, role) - project ||= create(:project, namespace: group, path: "project#{@project_count}") + project ||= create(:project, :repository, namespace: group, path: "project#{@project_count}") create(:closed_issue_event, project: project) project.team << [user, :master] @project_count += 1 diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb index df9845ba569..79dde620265 100644 --- a/features/steps/shared/issuable.rb +++ b/features/steps/shared/issuable.rb @@ -110,14 +110,14 @@ module SharedIssuable end step 'I sort the list by "Oldest updated"' do - find('button.dropdown-toggle.btn').click + find('button.dropdown-toggle').click page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do click_link "Oldest updated" end end step 'I sort the list by "Least popular"' do - find('button.dropdown-toggle.btn').click + find('button.dropdown-toggle').click page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do click_link 'Least popular' @@ -125,7 +125,7 @@ module SharedIssuable end step 'I sort the list by "Most popular"' do - find('button.dropdown-toggle.btn').click + find('button.dropdown-toggle').click page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do click_link 'Most popular' @@ -179,7 +179,7 @@ module SharedIssuable project = Project.find_by(name: from_project_name) expect(page).to have_content(user_name) - expect(page).to have_content("Mentioned in #{issuable.class.to_s.titleize.downcase} #{issuable.to_reference(project)}") + expect(page).to have_content("mentioned in #{issuable.class.to_s.titleize.downcase} #{issuable.to_reference(project)}") end def expect_sidebar_content(content) diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index 56b36f7c46c..a036d9b884f 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -2,7 +2,7 @@ module SharedMarkdown include Spinach::DSL def header_should_have_correct_id_and_link(level, text, id, parent = ".wiki") - node = find("#{parent} h#{level} a##{id}") + node = find("#{parent} h#{level} a#user-content-#{id}") expect(node[:href]).to eq "##{id}" # Work around a weird Capybara behavior where calling `parent` on a node diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index 9dc1fc41b3b..1870f6bc0c3 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -2,6 +2,10 @@ module SharedNote include Spinach::DSL include WaitForAjax + after do + wait_for_ajax if javascript_test? + end + step 'I delete a comment' do page.within('.main-notes-list') do find('.note').hover diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index 2bd8ea745e4..718cf924729 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -168,7 +168,7 @@ module SharedPaths end step 'I visit admin projects page' do - visit admin_namespaces_projects_path + visit admin_projects_path end step 'I visit admin users page' do @@ -191,30 +191,14 @@ module SharedPaths visit admin_background_jobs_path end - step 'I visit admin groups page' do - visit admin_groups_path - end - - step 'I visit admin appearance page' do - visit admin_appearances_path - end - step 'I visit admin teams page' do visit admin_teams_path end - step 'I visit admin settings page' do - visit admin_application_settings_path - end - step 'I visit spam logs page' do visit admin_spam_logs_path end - step 'I visit applications page' do - visit admin_applications_path - end - # ---------------------------------------- # Generic Project # ---------------------------------------- @@ -272,7 +256,7 @@ module SharedPaths end step 'I visit project hooks page' do - visit namespace_project_hooks_path(@project.namespace, @project) + visit namespace_project_settings_integrations_path(@project.namespace, @project) end step 'I visit project deploy keys page' do diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index cab85a48396..7a6707a7dfb 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -3,19 +3,19 @@ module SharedProject # Create a project without caring about what it's called step "I own a project" do - @project = create(:project, namespace: @user.namespace) + @project = create(:project, :repository, namespace: @user.namespace) @project.team << [@user, :master] end step "project exists in some group namespace" do @group = create(:group, name: 'some group') - @project = create(:project, namespace: @group) + @project = create(:project, :repository, namespace: @group, public_builds: false) end # Create a specific project called "Shop" step 'I own project "Shop"' do @project = Project.find_by(name: "Shop") - @project ||= create(:project, name: "Shop", namespace: @user.namespace) + @project ||= create(:project, :repository, name: "Shop", namespace: @user.namespace) @project.team << [@user, :master] end @@ -40,7 +40,7 @@ module SharedProject # Create another specific project called "Forum" step 'I own project "Forum"' do @project = Project.find_by(name: "Forum") - @project ||= create(:project, name: "Forum", namespace: @user.namespace, path: 'forum_project') + @project ||= create(:project, :repository, name: "Forum", namespace: @user.namespace, path: 'forum_project') @project.build_project_feature @project.project_feature.save @project.team << [@user, :master] @@ -97,7 +97,7 @@ module SharedProject step 'I should see project settings' do expect(current_path).to eq edit_namespace_project_path(@project.namespace, @project) expect(page).to have_content("Project name") - expect(page).to have_content("Feature Visibility") + expect(page).to have_content("Sharing & Permissions") end def current_project @@ -121,7 +121,7 @@ module SharedProject # ---------------------------------------- step 'archived project "Archive"' do - create :project, :public, archived: true, name: 'Archive' + create(:project, :archived, :public, :repository, name: 'Archive') end step 'I should not see project "Archive"' do @@ -144,7 +144,7 @@ module SharedProject # ---------------------------------------- step 'private project "Enterprise"' do - create :project, name: 'Enterprise' + create(:project, :private, :repository, name: 'Enterprise') end step 'I should see project "Enterprise"' do @@ -156,7 +156,7 @@ module SharedProject end step 'internal project "Internal"' do - create :project, :internal, name: 'Internal' + create(:project, :internal, :repository, name: 'Internal') end step 'I should see project "Internal"' do @@ -168,7 +168,7 @@ module SharedProject end step 'public project "Community"' do - create :project, :public, name: 'Community' + create(:project, :public, :repository, name: 'Community') end step 'I should see project "Community"' do diff --git a/features/steps/shared/search.rb b/features/steps/shared/search.rb deleted file mode 100644 index 6c3d601763d..00000000000 --- a/features/steps/shared/search.rb +++ /dev/null @@ -1,11 +0,0 @@ -module SharedSearch - include Spinach::DSL - - def search_snippet_contents(query) - visit "/search?search=#{URI::encode(query)}&snippets=true&scope=snippet_blobs" - end - - def search_snippet_titles(query) - visit "/search?search=#{URI::encode(query)}&snippets=true&scope=snippet_titles" - end -end diff --git a/features/steps/snippet_search.rb b/features/steps/snippet_search.rb deleted file mode 100644 index 32e29ffad1e..00000000000 --- a/features/steps/snippet_search.rb +++ /dev/null @@ -1,55 +0,0 @@ -class Spinach::Features::SnippetSearch < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedSnippet - include SharedUser - include SharedSearch - - step 'I search for "snippet" in snippet titles' do - search_snippet_titles 'snippet' - end - - step 'I search for "snippet private" in snippet titles' do - search_snippet_titles 'snippet private' - end - - step 'I search for "line seven" in snippet contents' do - search_snippet_contents 'line seven' - end - - step 'I should see "line seven" in results' do - expect(page).to have_content 'line seven' - end - - step 'I should see "line four" in results' do - expect(page).to have_content 'line four' - end - - step 'I should see "line ten" in results' do - expect(page).to have_content 'line ten' - end - - step 'I should not see "line eleven" in results' do - expect(page).not_to have_content 'line eleven' - end - - step 'I should not see "line three" in results' do - expect(page).not_to have_content 'line three' - end - - step 'I should see "Personal snippet one" in results' do - expect(page).to have_content 'Personal snippet one' - end - - step 'I should see "Personal snippet private" in results' do - expect(page).to have_content 'Personal snippet private' - end - - step 'I should not see "Personal snippet one" in results' do - expect(page).not_to have_content 'Personal snippet one' - end - - step 'I should not see "Personal snippet private" in results' do - expect(page).not_to have_content 'Personal snippet private' - end -end diff --git a/features/steps/snippets/discover.rb b/features/steps/snippets/discover.rb deleted file mode 100644 index 76379d09d02..00000000000 --- a/features/steps/snippets/discover.rb +++ /dev/null @@ -1,21 +0,0 @@ -class Spinach::Features::SnippetsDiscover < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedSnippet - - step 'I should see "Personal snippet one" in snippets' do - expect(page).to have_content "Personal snippet one" - end - - step 'I should see "Personal snippet internal" in snippets' do - expect(page).to have_content "Personal snippet internal" - end - - step 'I should not see "Personal snippet private" in snippets' do - expect(page).not_to have_content "Personal snippet private" - end - - def snippet - @snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one") - end -end diff --git a/features/steps/user.rb b/features/steps/user.rb index 59385a6ab59..271c9b097d4 100644 --- a/features/steps/user.rb +++ b/features/steps/user.rb @@ -38,6 +38,6 @@ class Spinach::Features::User < Spinach::FeatureSteps end def contributed_project - @contributed_project ||= create(:project, :public) + @contributed_project ||= create(:empty_project, :public) end end |