From 5854ab2f7da76804a3221d962979cab67aef65c4 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 16 Jun 2017 23:08:27 -0700 Subject: Convert variants of trigger('click') -> click --- spec/features/boards/sidebar_spec.rb | 4 ++-- spec/features/dashboard/active_tab_spec.rb | 2 +- spec/features/dashboard/group_spec.rb | 2 +- spec/features/dashboard/groups_list_spec.rb | 6 +++--- spec/features/dashboard/issues_spec.rb | 2 +- spec/features/dashboard/merge_requests_spec.rb | 2 +- spec/features/explore/new_menu_spec.rb | 10 +++++----- spec/features/issues/filtered_search/recent_searches_spec.rb | 4 ++-- spec/features/issues/issue_sidebar_spec.rb | 2 +- spec/features/issues_spec.rb | 2 +- spec/features/merge_requests/conflicts_spec.rb | 2 +- spec/features/merge_requests/diff_notes_avatars_spec.rb | 2 +- spec/features/merge_requests/diff_notes_resolve_spec.rb | 2 +- spec/features/merge_requests/mini_pipeline_graph_spec.rb | 2 +- spec/features/merge_requests/user_posts_diff_notes_spec.rb | 4 ++-- spec/features/merge_requests/versions_spec.rb | 4 ++-- spec/features/profiles/preferences_spec.rb | 2 +- spec/features/projects/branches_spec.rb | 4 ++-- spec/features/projects/group_links_spec.rb | 2 +- spec/features/projects/jobs_spec.rb | 2 +- spec/features/projects/pipelines/pipeline_spec.rb | 12 ++++++------ spec/features/projects/pipelines/pipelines_spec.rb | 12 ++++++------ spec/features/projects/services/jira_service_spec.rb | 2 +- spec/features/projects/wiki/markdown_preview_spec.rb | 6 +++--- spec/features/projects/wiki/user_creates_wiki_page_spec.rb | 2 +- spec/features/protected_branches_spec.rb | 2 +- spec/features/search_spec.rb | 8 ++++---- spec/features/tags/master_creates_tag_spec.rb | 2 +- spec/features/todos/todos_spec.rb | 6 +++--- spec/features/user_callout_spec.rb | 2 +- 30 files changed, 58 insertions(+), 58 deletions(-) (limited to 'spec/features') diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index 235e4899707..03b15bef41e 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -51,7 +51,7 @@ describe 'Issue Boards', feature: true, js: true do expect(page).to have_selector('.issue-boards-sidebar') - find('.gutter-toggle').trigger('click') + find('.gutter-toggle').click expect(page).not_to have_selector('.issue-boards-sidebar') end @@ -155,7 +155,7 @@ describe 'Issue Boards', feature: true, js: true do end page.within(find('.board:nth-child(2)')) do - find('.card:nth-child(2)').trigger('click') + find('.card:nth-child(2)').click end page.within('.assignee') do diff --git a/spec/features/dashboard/active_tab_spec.rb b/spec/features/dashboard/active_tab_spec.rb index ae750be4d4a..f4ff9e6813f 100644 --- a/spec/features/dashboard/active_tab_spec.rb +++ b/spec/features/dashboard/active_tab_spec.rb @@ -7,7 +7,7 @@ RSpec.describe 'Dashboard Active Tab', js: true, feature: true do shared_examples 'page has active tab' do |title| it "#{title} tab" do - find('.global-dropdown-toggle').trigger('click') + find('.global-dropdown-toggle').click expect(page).to have_selector('.global-dropdown-menu li.active', count: 1) expect(find('.global-dropdown-menu li.active')).to have_content(title) end diff --git a/spec/features/dashboard/group_spec.rb b/spec/features/dashboard/group_spec.rb index 8e20fdec8ad..78b9da08a36 100644 --- a/spec/features/dashboard/group_spec.rb +++ b/spec/features/dashboard/group_spec.rb @@ -7,7 +7,7 @@ RSpec.describe 'Dashboard Group', feature: true do it 'creates new group', js: true do visit dashboard_groups_path - find('.btn-new').trigger('click') + find('.btn-new').click new_path = 'Samurai' new_description = 'Tokugawa Shogunate' diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index 7eb254f8451..5eb56be6c7c 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -74,14 +74,14 @@ describe 'Dashboard Groups page', js: true, feature: true do expect(page).not_to have_selector("#group-#{group.id} .fa-caret-right") # Collapse - find("#group-#{group.id}").trigger('click') + find("#group-#{group.id}").click expect(page).not_to have_selector("#group-#{group.id} .fa-caret-down") expect(page).to have_selector("#group-#{group.id} .fa-caret-right", count: 1) expect(page).not_to have_selector("#group-#{group.id} #group-#{subgroup.id}") # Expand - find("#group-#{group.id}").trigger('click') + find("#group-#{group.id}").click expect(page).to have_selector("#group-#{group.id} .fa-caret-down", count: 1) expect(page).not_to have_selector("#group-#{group.id} .fa-caret-right") @@ -115,7 +115,7 @@ describe 'Dashboard Groups page', js: true, feature: true do expect(page).not_to have_selector("#group-#{group.id}") # Go to next page - find(".gl-pagination .page:not(.active) a").trigger('click') + find(".gl-pagination .page:not(.active) a").click wait_for_requests diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index 2cea6b1563e..5fb74e0d007 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -65,7 +65,7 @@ RSpec.describe 'Dashboard Issues', feature: true do describe 'new issue dropdown' do it 'shows projects only with issues feature enabled', js: true do - find('.new-project-item-select-button').trigger('click') + find('.new-project-item-select-button').click page.within('.select2-results') do expect(page).to have_content(project.name_with_namespace) diff --git a/spec/features/dashboard/merge_requests_spec.rb b/spec/features/dashboard/merge_requests_spec.rb index bcb52f602b0..3cec2192910 100644 --- a/spec/features/dashboard/merge_requests_spec.rb +++ b/spec/features/dashboard/merge_requests_spec.rb @@ -17,7 +17,7 @@ describe 'Dashboard Merge Requests' do end it 'shows projects only with merge requests feature enabled', js: true do - find('.new-project-item-select-button').trigger('click') + find('.new-project-item-select-button').click page.within('.select2-results') do expect(page).to have_content(project.name_with_namespace) diff --git a/spec/features/explore/new_menu_spec.rb b/spec/features/explore/new_menu_spec.rb index 15a6354211b..b1dbf48b221 100644 --- a/spec/features/explore/new_menu_spec.rb +++ b/spec/features/explore/new_menu_spec.rb @@ -69,9 +69,9 @@ feature 'Top Plus Menu', feature: true, js: true do visit namespace_project_path(project.namespace, project) page.within '.header-content' do - find('.header-new-dropdown-toggle').trigger('click') + find('.header-new-dropdown-toggle').click expect(page).to have_selector('.header-new.dropdown.open', count: 1) - find('.header-new-project-snippet a').trigger('click') + find('.header-new-project-snippet a').click end expect(page).to have_content('New Snippet') @@ -91,9 +91,9 @@ feature 'Top Plus Menu', feature: true, js: true do visit group_path(group) page.within '.header-content' do - find('.header-new-dropdown-toggle').trigger('click') + find('.header-new-dropdown-toggle').click expect(page).to have_selector('.header-new.dropdown.open', count: 1) - find('.header-new-group-project a').trigger('click') + find('.header-new-group-project a').click end expect(page).to have_content('Project path') @@ -160,7 +160,7 @@ feature 'Top Plus Menu', feature: true, js: true do def click_topmenuitem(item_name) page.within '.header-content' do - find('.header-new-dropdown-toggle').trigger('click') + find('.header-new-dropdown-toggle').click expect(page).to have_selector('.header-new.dropdown.open', count: 1) click_link item_name end diff --git a/spec/features/issues/filtered_search/recent_searches_spec.rb b/spec/features/issues/filtered_search/recent_searches_spec.rb index 09f228bcf49..89856fe4739 100644 --- a/spec/features/issues/filtered_search/recent_searches_spec.rb +++ b/spec/features/issues/filtered_search/recent_searches_spec.rb @@ -80,7 +80,7 @@ describe 'Recent searches', js: true, feature: true do set_recent_searches(project_1_local_storage_key, '["foo", "bar"]') visit namespace_project_issues_path(project_1.namespace, project_1) - all('.filtered-search-history-dropdown-item', visible: false)[0].trigger('click') + all('.filtered-search-history-dropdown-item', visible: false)[0].click wait_for_filtered_search('foo') expect(find('.filtered-search').value.strip).to eq('foo') @@ -94,7 +94,7 @@ describe 'Recent searches', js: true, feature: true do expect(items_before.count).to eq(1) - find('.filtered-search-history-clear-button', visible: false).trigger('click') + find('.filtered-search-history-clear-button', visible: false).click items_after = all('.filtered-search-history-dropdown-item', visible: false) expect(items_after.count).to eq(0) diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index 96c24750250..cb3828fd70c 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -184,7 +184,7 @@ feature 'Issue Sidebar', feature: true do end def open_issue_sidebar - find('aside.right-sidebar.right-sidebar-collapsed .js-sidebar-toggle').trigger('click') + find('aside.right-sidebar.right-sidebar-collapsed .js-sidebar-toggle').click find('aside.right-sidebar.right-sidebar-expanded') end end diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 2cff53539f3..17bdcb7d5c5 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -378,7 +378,7 @@ describe 'Issues', feature: true do it 'changes incoming email address token', js: true do find('.issue-email-modal-btn').click previous_token = find('input#issue_email').value - find('.incoming-email-token-reset').trigger('click') + find('.incoming-email-token-reset').click wait_for_requests diff --git a/spec/features/merge_requests/conflicts_spec.rb b/spec/features/merge_requests/conflicts_spec.rb index 9409c32104b..16486118a9e 100644 --- a/spec/features/merge_requests/conflicts_spec.rb +++ b/spec/features/merge_requests/conflicts_spec.rb @@ -18,7 +18,7 @@ feature 'Merge request conflict resolution', js: true, feature: true do within find('.files-wrapper .diff-file', text: 'files/ruby/regex.rb') do all('button', text: 'Use ours').each do |button| - button.trigger('click') + button.click end end diff --git a/spec/features/merge_requests/diff_notes_avatars_spec.rb b/spec/features/merge_requests/diff_notes_avatars_spec.rb index e23dc2cd940..d603e4b1b4a 100644 --- a/spec/features/merge_requests/diff_notes_avatars_spec.rb +++ b/spec/features/merge_requests/diff_notes_avatars_spec.rb @@ -150,7 +150,7 @@ feature 'Diff note avatars', feature: true, js: true do page.within '.js-discussion-note-form' do find('.js-note-text').native.send_keys('Test') - find('.js-comment-button').trigger 'click' + find('.js-comment-button').click wait_for_requests end diff --git a/spec/features/merge_requests/diff_notes_resolve_spec.rb b/spec/features/merge_requests/diff_notes_resolve_spec.rb index 4d549f3bdbb..0e23c3a8849 100644 --- a/spec/features/merge_requests/diff_notes_resolve_spec.rb +++ b/spec/features/merge_requests/diff_notes_resolve_spec.rb @@ -275,7 +275,7 @@ feature 'Diff notes resolve', feature: true, js: true do end page.within '.line-resolve-all-container' do - page.find('.discussion-next-btn').trigger('click') + page.find('.discussion-next-btn').click end expect(page.evaluate_script("$('body').scrollTop()")).to be > 0 diff --git a/spec/features/merge_requests/mini_pipeline_graph_spec.rb b/spec/features/merge_requests/mini_pipeline_graph_spec.rb index 3a11ea3c8b2..207fae605d8 100644 --- a/spec/features/merge_requests/mini_pipeline_graph_spec.rb +++ b/spec/features/merge_requests/mini_pipeline_graph_spec.rb @@ -90,7 +90,7 @@ feature 'Mini Pipeline Graph', :js, :feature do end it 'should close when toggle is clicked again' do - toggle.trigger('click') + toggle.click expect(toggle.find(:xpath, '..')).not_to have_selector('.mini-pipeline-graph-dropdown-menu') end diff --git a/spec/features/merge_requests/user_posts_diff_notes_spec.rb b/spec/features/merge_requests/user_posts_diff_notes_spec.rb index 14bc549c9f9..d1401b2e380 100644 --- a/spec/features/merge_requests/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_diff_notes_spec.rb @@ -221,7 +221,7 @@ feature 'Merge requests > User posts diff notes', :js do def should_allow_dismissing_a_comment(line_holder, diff_side = nil) write_comment_on_line(line_holder, diff_side) - find('.js-close-discussion-note-form').trigger('click') + find('.js-close-discussion-note-form').click assert_comment_dismissal(line_holder) end @@ -259,7 +259,7 @@ feature 'Merge requests > User posts diff notes', :js do expect(line[:num]).to have_css comment_button_class - line[:num].find(comment_button_class).trigger 'click' + line[:num].find(comment_button_class).click end def write_comment_on_line(line_holder, diff_side) diff --git a/spec/features/merge_requests/versions_spec.rb b/spec/features/merge_requests/versions_spec.rb index aad522ee26e..094fd5bf63b 100644 --- a/spec/features/merge_requests/versions_spec.rb +++ b/spec/features/merge_requests/versions_spec.rb @@ -68,7 +68,7 @@ feature 'Merge Request versions', js: true, feature: true do page.within(diff_file_selector) do find(".line_holder[id='#{line_code}'] td:nth-of-type(1)").trigger 'mouseover' - find(".line_holder[id='#{line_code}'] button").trigger 'click' + find(".line_holder[id='#{line_code}'] button").click page.within("form[data-line-code='#{line_code}']") do fill_in "note[note]", with: "Typo, please fix" @@ -139,7 +139,7 @@ feature 'Merge Request versions', js: true, feature: true do page.within(diff_file_selector) do find(".line_holder[id='#{line_code}'] td:nth-of-type(1)").trigger 'mouseover' - find(".line_holder[id='#{line_code}'] button").trigger 'click' + find(".line_holder[id='#{line_code}'] button").click page.within("form[data-line-code='#{line_code}']") do fill_in "note[note]", with: "Typo, please fix" diff --git a/spec/features/profiles/preferences_spec.rb b/spec/features/profiles/preferences_spec.rb index d368bc4d753..49bdf1a0247 100644 --- a/spec/features/profiles/preferences_spec.rb +++ b/spec/features/profiles/preferences_spec.rb @@ -44,7 +44,7 @@ describe 'Profile > Preferences', feature: true do expect(page.current_path).to eq starred_dashboard_projects_path end - find('.shortcuts-activity').trigger('click') + find('.shortcuts-activity').click expect(page).not_to have_content("You don't have starred projects yet") expect(page.current_path).to eq dashboard_projects_path diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index 7668ce5f8be..ac5643b6837 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -55,7 +55,7 @@ describe 'Branches', feature: true do expect(page).to have_content('fix') expect(find('.all-branches')).to have_selector('li', count: 1) - find('.js-branch-fix .btn-remove').trigger(:click) + find('.js-branch-fix .btn-remove').click expect(page).not_to have_content('fix') expect(find('.all-branches')).to have_selector('li', count: 0) @@ -109,7 +109,7 @@ describe 'Branches', feature: true do expect(page).to have_content('fix') expect(find('.all-branches')).to have_selector('li', count: 1) - page.find('[data-target="#modal-delete-branch"]').trigger(:click) + page.find('[data-target="#modal-delete-branch"]').click expect(page).to have_css('.js-delete-branch[disabled]') fill_in 'delete_branch_input', with: 'fix' diff --git a/spec/features/projects/group_links_spec.rb b/spec/features/projects/group_links_spec.rb index 1b680a56492..8796bf7cc6c 100644 --- a/spec/features/projects/group_links_spec.rb +++ b/spec/features/projects/group_links_spec.rb @@ -21,7 +21,7 @@ feature 'Project group links', :feature, :js do select2 group.id, from: '#link_group_id' fill_in 'expires_at_groups', with: (Time.current + 4.5.days).strftime('%Y-%m-%d') page.find('body').click - find('.btn-create').trigger('click') + find('.btn-create').click end it 'shows the expiration time with a warning class' do diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 31c93c75d25..bc8996d6ab1 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -375,7 +375,7 @@ feature 'Jobs', :feature do job.run! visit namespace_project_job_path(project.namespace, project, job) find('.js-cancel-job').click() - find('.js-retry-button').trigger('click') + find('.js-retry-button').click end it 'shows the right status and buttons', :js do diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index 12c5ad45baf..5910daefba6 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -75,7 +75,7 @@ describe 'Pipeline', :feature, :js do end it 'should be possible to cancel the running build' do - find('#ci-badge-deploy .ci-action-icon-container').trigger('click') + find('#ci-badge-deploy .ci-action-icon-container').click expect(page).not_to have_content('Cancel running') end @@ -94,7 +94,7 @@ describe 'Pipeline', :feature, :js do end it 'should be possible to retry the success job' do - find('#ci-badge-build .ci-action-icon-container').trigger('click') + find('#ci-badge-build .ci-action-icon-container').click expect(page).not_to have_content('Retry job') end @@ -113,7 +113,7 @@ describe 'Pipeline', :feature, :js do end it 'should be possible to retry the failed build' do - find('#ci-badge-test .ci-action-icon-container').trigger('click') + find('#ci-badge-test .ci-action-icon-container').click expect(page).not_to have_content('Retry job') end @@ -132,7 +132,7 @@ describe 'Pipeline', :feature, :js do end it 'should be possible to play the manual job' do - find('#ci-badge-manual-build .ci-action-icon-container').trigger('click') + find('#ci-badge-manual-build .ci-action-icon-container').click expect(page).not_to have_content('Play job') end @@ -167,7 +167,7 @@ describe 'Pipeline', :feature, :js do context 'when retrying' do before do - find('.js-retry-button').trigger('click') + find('.js-retry-button').click end it { expect(page).not_to have_content('Retry') } @@ -233,7 +233,7 @@ describe 'Pipeline', :feature, :js do context 'when retrying' do before do - find('.js-retry-button').trigger('click') + find('.js-retry-button').click end it { expect(page).not_to have_content('Retry') } diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index db2d1a100a5..ef49a13903f 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -222,7 +222,7 @@ describe 'Pipelines', :feature, :js do context 'when canceling' do before do - find('.js-pipelines-cancel-button').trigger('click') + find('.js-pipelines-cancel-button').click end it 'indicates that pipeline was canceled' do @@ -335,14 +335,14 @@ describe 'Pipelines', :feature, :js do context 'when clicking a stage badge' do it 'should open a dropdown' do - find('.js-builds-dropdown-button').trigger('click') + find('.js-builds-dropdown-button').click expect(page).to have_link build.name end it 'should be possible to cancel pending build' do - find('.js-builds-dropdown-button').trigger('click') - find('a.js-ci-action-icon').trigger('click') + find('.js-builds-dropdown-button').click + find('a.js-ci-action-icon').click expect(page).to have_content('canceled') expect(build.reload).to be_canceled @@ -351,11 +351,11 @@ describe 'Pipelines', :feature, :js do context 'dropdown jobs list' do it 'should keep the dropdown open when the user ctr/cmd + clicks in the job name' do - find('.js-builds-dropdown-button').trigger('click') + find('.js-builds-dropdown-button').click execute_script('var e = $.Event("keydown", { keyCode: 64 }); $("body").trigger(e);') - find('.mini-pipeline-graph-dropdown-item').trigger('click') + find('.mini-pipeline-graph-dropdown-item').click expect(page).to have_selector('.js-ci-action-icon') end diff --git a/spec/features/projects/services/jira_service_spec.rb b/spec/features/projects/services/jira_service_spec.rb index c96d87e5708..58a05d92789 100644 --- a/spec/features/projects/services/jira_service_spec.rb +++ b/spec/features/projects/services/jira_service_spec.rb @@ -68,7 +68,7 @@ feature 'Setup Jira service', :feature, :js do expect(find('.flash-container-page')).to have_content 'Test failed.' expect(find('.flash-container-page')).to have_content 'Save anyway' - find('.flash-alert .flash-action').trigger('click') + find('.flash-alert .flash-action').click wait_for_requests expect(page).to have_content('JIRA activated.') diff --git a/spec/features/projects/wiki/markdown_preview_spec.rb b/spec/features/projects/wiki/markdown_preview_spec.rb index 94f6bb16730..824b3c81c8a 100644 --- a/spec/features/projects/wiki/markdown_preview_spec.rb +++ b/spec/features/projects/wiki/markdown_preview_spec.rb @@ -19,13 +19,13 @@ feature 'Projects > Wiki > User previews markdown changes', feature: true, js: t login_as(user) visit namespace_project_path(project.namespace, project) - find('.shortcuts-wiki').trigger('click') + find('.shortcuts-wiki').click end context "while creating a new wiki page" do context "when there are no spaces or hyphens in the page name" do it "rewrites relative links as expected" do - find('.add-new-wiki').trigger('click') + find('.add-new-wiki').click page.within '#modal-new-wiki' do fill_in :new_wiki_path, with: 'a/b/c/d' click_button 'Create page' @@ -92,7 +92,7 @@ feature 'Projects > Wiki > User previews markdown changes', feature: true, js: t context "while editing a wiki page" do def create_wiki_page(path) - find('.add-new-wiki').trigger('click') + find('.add-new-wiki').click page.within '#modal-new-wiki' do fill_in :new_wiki_path, with: path diff --git a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb index 8912d575878..971bcab9569 100644 --- a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb @@ -8,7 +8,7 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do login_as(user) visit namespace_project_path(project.namespace, project) - find('.shortcuts-wiki').trigger('click') + find('.shortcuts-wiki').click end context 'in the user namespace' do diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index aa9164dd979..6da1e02747f 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -9,7 +9,7 @@ feature 'Protected Branches', feature: true, js: true do end def set_protected_branch_name(branch_name) - find(".js-protected-branch-select").trigger('click') + find(".js-protected-branch-select").click find(".dropdown-input-field").set(branch_name) click_on("Create wildcard #{branch_name}") end diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb index 89d4f536b20..c80dfc441d0 100644 --- a/spec/features/search_spec.rb +++ b/spec/features/search_spec.rb @@ -27,7 +27,7 @@ describe "Search", feature: true do end it 'shows group name after filtering' do - find('.js-search-group-dropdown').trigger('click') + find('.js-search-group-dropdown').click wait_for_requests page.within '.search-holder' do @@ -38,7 +38,7 @@ describe "Search", feature: true do end it 'filters by group projects after filtering by group' do - find('.js-search-group-dropdown').trigger('click') + find('.js-search-group-dropdown').click wait_for_requests page.within '.search-holder' do @@ -48,7 +48,7 @@ describe "Search", feature: true do expect(find('.js-search-group-dropdown')).to have_content(group.name) page.within('.project-filter') do - find('.js-search-project-dropdown').trigger('click') + find('.js-search-project-dropdown').click wait_for_requests expect(page).to have_link(group_project.name_with_namespace) @@ -57,7 +57,7 @@ describe "Search", feature: true do it 'shows project name after filtering' do page.within('.project-filter') do - find('.js-search-project-dropdown').trigger('click') + find('.js-search-project-dropdown').click wait_for_requests click_link project.name_with_namespace diff --git a/spec/features/tags/master_creates_tag_spec.rb b/spec/features/tags/master_creates_tag_spec.rb index af25eebed13..f5010134883 100644 --- a/spec/features/tags/master_creates_tag_spec.rb +++ b/spec/features/tags/master_creates_tag_spec.rb @@ -59,7 +59,7 @@ feature 'Master creates tag', feature: true do expect(ref_input.value).to eq 'master' expect(find('.dropdown-toggle-text')).to have_content 'master' - find('.js-branch-select').trigger('click') + find('.js-branch-select').click expect(find('.dropdown-menu')).to have_content 'empty-branch' end diff --git a/spec/features/todos/todos_spec.rb b/spec/features/todos/todos_spec.rb index feb2fe8a7d1..b6175673226 100644 --- a/spec/features/todos/todos_spec.rb +++ b/spec/features/todos/todos_spec.rb @@ -251,7 +251,7 @@ describe 'Dashboard Todos', feature: true do describe 'mark all as done', js: true do before do visit dashboard_todos_path - find('.js-todos-mark-all').trigger('click') + find('.js-todos-mark-all').click end it 'shows "All done" message!' do @@ -308,9 +308,9 @@ describe 'Dashboard Todos', feature: true do end def mark_all_and_undo - find('.js-todos-mark-all').trigger('click') + find('.js-todos-mark-all').click wait_for_requests - find('.js-todos-undo-all').trigger('click') + find('.js-todos-undo-all').click wait_for_requests end end diff --git a/spec/features/user_callout_spec.rb b/spec/features/user_callout_spec.rb index b84f834ff1e..848af5e3a4d 100644 --- a/spec/features/user_callout_spec.rb +++ b/spec/features/user_callout_spec.rb @@ -20,7 +20,7 @@ describe 'User Callouts', js: true do visit dashboard_projects_path within('.user-callout') do - find('.close').trigger('click') + find('.close').click end visit dashboard_projects_path -- cgit v1.2.1 From e8aabb07edfb215a9823d236c69d5eaa1348a0fa Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 2 Aug 2017 20:22:16 -0700 Subject: Remove unnecessary files caused by bad merge --- spec/features/todos/todos_spec.rb | 355 -------------------------------------- 1 file changed, 355 deletions(-) delete mode 100644 spec/features/todos/todos_spec.rb (limited to 'spec/features') diff --git a/spec/features/todos/todos_spec.rb b/spec/features/todos/todos_spec.rb deleted file mode 100644 index 320777e97bf..00000000000 --- a/spec/features/todos/todos_spec.rb +++ /dev/null @@ -1,355 +0,0 @@ -require 'spec_helper' - -describe 'Dashboard Todos', feature: true do - let(:user) { create(:user) } - let(:author) { create(:user) } - let(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } - let(:issue) { create(:issue, due_date: Date.today) } - - describe 'GET /dashboard/todos' do - context 'User does not have todos' do - before do - gitlab_sign_in(user) - visit dashboard_todos_path - end - it 'shows "All done" message' do - expect(page).to have_content "Todos let you see what you should do next." - end - end - - context 'User has a todo', js: true do - before do - create(:todo, :mentioned, user: user, project: project, target: issue, author: author) - gitlab_sign_in(user) - visit dashboard_todos_path - end - - it 'has todo present' do - expect(page).to have_selector('.todos-list .todo', count: 1) - end - - it 'shows due date as today' do - within first('.todo') do - expect(page).to have_content 'Due today' - end - end - - shared_examples 'deleting the todo' do - before do - within first('.todo') do - click_link 'Done' - end - end - - it 'is marked as done-reversible in the list' do - expect(page).to have_selector('.todos-list .todo.todo-pending.done-reversible') - end - - it 'shows Undo button' do - expect(page).to have_selector('.js-undo-todo', visible: true) - expect(page).to have_selector('.js-done-todo', visible: false) - end - - it 'updates todo count' do - expect(page).to have_content 'To do 0' - expect(page).to have_content 'Done 1' - end - - it 'has not "All done" message' do - expect(page).not_to have_selector('.todos-all-done') - end - end - - shared_examples 'deleting and restoring the todo' do - before do - within first('.todo') do - click_link 'Done' - wait_for_requests - click_link 'Undo' - end - end - - it 'is marked back as pending in the list' do - expect(page).not_to have_selector('.todos-list .todo.todo-pending.done-reversible') - expect(page).to have_selector('.todos-list .todo.todo-pending') - end - - it 'shows Done button' do - expect(page).to have_selector('.js-undo-todo', visible: false) - expect(page).to have_selector('.js-done-todo', visible: true) - end - - it 'updates todo count' do - expect(page).to have_content 'To do 1' - expect(page).to have_content 'Done 0' - end - end - - it_behaves_like 'deleting the todo' - it_behaves_like 'deleting and restoring the todo' - - context 'todo is stale on the page' do - before do - todos = TodosFinder.new(user, state: :pending).execute - TodoService.new.mark_todos_as_done(todos, user) - end - - it_behaves_like 'deleting the todo' - it_behaves_like 'deleting and restoring the todo' - end - end - - context 'User created todos for themself' do - before do - gitlab_sign_in(user) - end - - context 'issue assigned todo' do - before do - create(:todo, :assigned, user: user, project: project, target: issue, author: user) - visit dashboard_todos_path - end - - it 'shows issue assigned to yourself message' do - page.within('.js-todos-all') do - expect(page).to have_content("You assigned issue #{issue.to_reference(full: true)} to yourself") - end - end - end - - context 'marked todo' do - before do - create(:todo, :marked, user: user, project: project, target: issue, author: user) - visit dashboard_todos_path - end - - it 'shows you added a todo message' do - page.within('.js-todos-all') do - expect(page).to have_content("You added a todo for issue #{issue.to_reference(full: true)}") - expect(page).not_to have_content('to yourself') - end - end - end - - context 'mentioned todo' do - before do - create(:todo, :mentioned, user: user, project: project, target: issue, author: user) - visit dashboard_todos_path - end - - it 'shows you mentioned yourself message' do - page.within('.js-todos-all') do - expect(page).to have_content("You mentioned yourself on issue #{issue.to_reference(full: true)}") - expect(page).not_to have_content('to yourself') - end - end - end - - context 'directly_addressed todo' do - before do - create(:todo, :directly_addressed, user: user, project: project, target: issue, author: user) - visit dashboard_todos_path - end - - it 'shows you directly addressed yourself message' do - page.within('.js-todos-all') do - expect(page).to have_content("You directly addressed yourself on issue #{issue.to_reference(full: true)}") - expect(page).not_to have_content('to yourself') - end - end - end - - context 'approval todo' do - let(:merge_request) { create(:merge_request) } - - before do - create(:todo, :approval_required, user: user, project: project, target: merge_request, author: user) - visit dashboard_todos_path - end - - it 'shows you set yourself as an approver message' do - page.within('.js-todos-all') do - expect(page).to have_content("You set yourself as an approver for merge request #{merge_request.to_reference(full: true)}") - expect(page).not_to have_content('to yourself') - end - end - end - end - - context 'User has done todos', js: true do - before do - create(:todo, :mentioned, :done, user: user, project: project, target: issue, author: author) - gitlab_sign_in(user) - visit dashboard_todos_path(state: :done) - end - - it 'has the done todo present' do - expect(page).to have_selector('.todos-list .todo.todo-done', count: 1) - end - - describe 'restoring the todo' do - before do - within first('.todo') do - click_link 'Add todo' - end - end - - it 'is removed from the list' do - expect(page).not_to have_selector('.todos-list .todo.todo-done') - end - - it 'updates todo count' do - expect(page).to have_content 'To do 1' - expect(page).to have_content 'Done 0' - end - end - end - - context 'User has Todos with labels spanning multiple projects' do - before do - label1 = create(:label, project: project) - note1 = create(:note_on_issue, note: "Hello #{label1.to_reference(format: :name)}", noteable_id: issue.id, noteable_type: 'Issue', project: issue.project) - create(:todo, :mentioned, project: project, target: issue, user: user, note_id: note1.id) - - project2 = create(:project, visibility_level: Gitlab::VisibilityLevel::PUBLIC) - label2 = create(:label, project: project2) - issue2 = create(:issue, project: project2) - note2 = create(:note_on_issue, note: "Test #{label2.to_reference(format: :name)}", noteable_id: issue2.id, noteable_type: 'Issue', project: project2) - create(:todo, :mentioned, project: project2, target: issue2, user: user, note_id: note2.id) - - gitlab_sign_in(user) - visit dashboard_todos_path - end - - it 'shows page with two Todos' do - expect(page).to have_selector('.todos-list .todo', count: 2) - end - end - - context 'User has multiple pages of Todos' do - before do - allow(Todo).to receive(:default_per_page).and_return(1) - - # Create just enough records to cause us to paginate - create_list(:todo, 2, :mentioned, user: user, project: project, target: issue, author: author) - - gitlab_sign_in(user) - end - - it 'is paginated' do - visit dashboard_todos_path - - expect(page).to have_selector('.gl-pagination') - end - - it 'is has the right number of pages' do - visit dashboard_todos_path - - expect(page).to have_selector('.gl-pagination .page', count: 2) - end - - describe 'mark all as done', js: true do - before do - visit dashboard_todos_path - find('.js-todos-mark-all').click - end - - it 'shows "All done" message!' do - expect(page).to have_content 'To do 0' - expect(page).to have_content "You're all done!" - expect(page).not_to have_selector('.gl-pagination') - end - - it 'shows "Undo mark all as done" button' do - expect(page).to have_selector('.js-todos-mark-all', visible: false) - expect(page).to have_selector('.js-todos-undo-all', visible: true) - end - end - - describe 'undo mark all as done', js: true do - before do - visit dashboard_todos_path - end - - it 'shows the restored todo list' do - mark_all_and_undo - - expect(page).to have_selector('.todos-list .todo', count: 1) - expect(page).to have_selector('.gl-pagination') - expect(page).not_to have_content "You're all done!" - end - - it 'updates todo count' do - mark_all_and_undo - - expect(page).to have_content 'To do 2' - expect(page).to have_content 'Done 0' - end - - it 'shows "Mark all as done" button' do - mark_all_and_undo - - expect(page).to have_selector('.js-todos-mark-all', visible: true) - expect(page).to have_selector('.js-todos-undo-all', visible: false) - end - - context 'User has deleted a todo' do - before do - within first('.todo') do - click_link 'Done' - end - end - - it 'shows the restored todo list with the deleted todo' do - mark_all_and_undo - - expect(page).to have_selector('.todos-list .todo.todo-pending', count: 1) - end - end - - def mark_all_and_undo - find('.js-todos-mark-all').click - wait_for_requests - find('.js-todos-undo-all').click - wait_for_requests - end - end - end - - context 'User has a Todo in a project pending deletion' do - before do - deleted_project = create(:project, visibility_level: Gitlab::VisibilityLevel::PUBLIC, pending_delete: true) - create(:todo, :mentioned, user: user, project: deleted_project, target: issue, author: author) - create(:todo, :mentioned, user: user, project: deleted_project, target: issue, author: author, state: :done) - gitlab_sign_in(user) - visit dashboard_todos_path - end - - it 'shows "All done" message' do - within('.todos-count') { expect(page).to have_content '0' } - expect(page).to have_content 'To do 0' - expect(page).to have_content 'Done 0' - expect(page).to have_selector('.todos-all-done', count: 1) - end - end - - context 'User has a Build Failed todo' do - let!(:todo) { create(:todo, :build_failed, user: user, project: project, author: author) } - - before do - gitlab_sign_in user - visit dashboard_todos_path - end - - it 'shows the todo' do - expect(page).to have_content 'The build failed for merge request' - end - - it 'links to the pipelines for the merge request' do - href = pipelines_namespace_project_merge_request_path(project.namespace, project, todo.target) - - expect(page).to have_link "merge request #{todo.target.to_reference(full: true)}", href - end - end - end -end -- cgit v1.2.1 From fa68b81b8ead3c68a278729bfbcb621a9c6197e3 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 2 Aug 2017 22:13:46 -0700 Subject: Change trigger('click') -> click for Chrome Done via: ``` git grep --name-only trigger\(\'click\'\) | xargs sed -i -e "s/trigger('click')/click/g" ``` --- spec/features/dashboard/issues_spec.rb | 2 +- spec/features/dashboard/todos/todos_spec.rb | 6 +++--- spec/features/issues/gfm_autocomplete_spec.rb | 2 +- spec/features/profiles/user_visits_notifications_tab_spec.rb | 2 +- spec/features/projects/environments/environments_spec.rb | 2 +- spec/features/projects/wiki/user_creates_wiki_page_spec.rb | 8 ++++---- spec/features/tags/master_creates_tag_spec.rb | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) (limited to 'spec/features') diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index a11499ba191..c53b8bdc002 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -80,7 +80,7 @@ RSpec.describe 'Dashboard Issues' do end it 'shows the new issue page', :js do - find('.new-project-item-select-button').trigger('click') + find('.new-project-item-select-button').click wait_for_requests find('.select2-results li').click diff --git a/spec/features/dashboard/todos/todos_spec.rb b/spec/features/dashboard/todos/todos_spec.rb index c2a61cf5aff..e6795c8470f 100644 --- a/spec/features/dashboard/todos/todos_spec.rb +++ b/spec/features/dashboard/todos/todos_spec.rb @@ -252,7 +252,7 @@ feature 'Dashboard Todos' do describe 'mark all as done', js: true do before do visit dashboard_todos_path - find('.js-todos-mark-all').trigger('click') + find('.js-todos-mark-all').click end it 'shows "All done" message!' do @@ -309,9 +309,9 @@ feature 'Dashboard Todos' do end def mark_all_and_undo - find('.js-todos-mark-all').trigger('click') + find('.js-todos-mark-all').click wait_for_requests - find('.js-todos-undo-all').trigger('click') + find('.js-todos-undo-all').click wait_for_requests end end diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 1b36f16e8b6..2f69e299326 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -19,7 +19,7 @@ feature 'GFM autocomplete', js: true do find('#issue-description').native.send_keys("@#{user.name[0...3]}") - find('.atwho-view .cur').trigger('click') + find('.atwho-view .cur').click click_button 'Save changes' diff --git a/spec/features/profiles/user_visits_notifications_tab_spec.rb b/spec/features/profiles/user_visits_notifications_tab_spec.rb index e98cec79d87..c2c17df67fb 100644 --- a/spec/features/profiles/user_visits_notifications_tab_spec.rb +++ b/spec/features/profiles/user_visits_notifications_tab_spec.rb @@ -13,7 +13,7 @@ feature 'User visits the notifications tab', js: true do it 'changes the project notifications setting' do expect(page).to have_content('Notifications') - first('#notifications-button').trigger('click') + first('#notifications-button').click click_link('On mention') expect(page).to have_content('On mention') diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index 36cf307fbe2..70e6a1ff1cc 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -151,7 +151,7 @@ feature 'Environments page', :js do find('.js-dropdown-play-icon-container').click expect(page).to have_content(action.name.humanize) - expect { find('.js-manual-action-link').trigger('click') } + expect { find('.js-manual-action-link').click } .not_to change { Ci::Pipeline.count } end diff --git a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb index 78c619f6301..c1e28752c99 100644 --- a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb @@ -15,7 +15,7 @@ feature 'Projects > Wiki > User creates wiki page', :js do context 'when wiki is empty' do before do - find('.shortcuts-wiki').trigger('click') + find('.shortcuts-wiki').click end scenario 'commit message field has value "Create home"' do @@ -70,7 +70,7 @@ feature 'Projects > Wiki > User creates wiki page', :js do context 'when wiki is not empty' do before do WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute - find('.shortcuts-wiki').trigger('click') + find('.shortcuts-wiki').click end context 'via the "new wiki page" page' do @@ -161,7 +161,7 @@ feature 'Projects > Wiki > User creates wiki page', :js do context 'when wiki is empty' do before do - find('.shortcuts-wiki').trigger('click') + find('.shortcuts-wiki').click end scenario 'commit message field has value "Create home"' do @@ -183,7 +183,7 @@ feature 'Projects > Wiki > User creates wiki page', :js do context 'when wiki is not empty' do before do WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute - find('.shortcuts-wiki').trigger('click') + find('.shortcuts-wiki').click end scenario 'via the "new wiki page" page' do diff --git a/spec/features/tags/master_creates_tag_spec.rb b/spec/features/tags/master_creates_tag_spec.rb index 35e1ca32f67..ed7c5bd6592 100644 --- a/spec/features/tags/master_creates_tag_spec.rb +++ b/spec/features/tags/master_creates_tag_spec.rb @@ -63,7 +63,7 @@ feature 'Master creates tag' do expect(ref_input.value).to eq 'master' expect(find('.dropdown-toggle-text')).to have_content 'master' - find('.js-branch-select').trigger('click') + find('.js-branch-select').click expect(find('.dropdown-menu')).to have_content 'empty-branch' end -- cgit v1.2.1 From 4b5483321a7b1c1d9eb2f473bfded433feb5c64b Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 9 Aug 2017 23:06:28 -0700 Subject: Change trigger('focus') -> click --- spec/features/admin/admin_users_impersonation_tokens_spec.rb | 2 +- spec/features/profiles/personal_access_tokens_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb index 034682dae27..e36ead6667f 100644 --- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb +++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb @@ -24,7 +24,7 @@ describe 'Admin > Users > Impersonation Tokens', js: true do fill_in "Name", with: name # Set date to 1st of next month - find_field("Expires at").trigger('focus') + find_field("Expires at").click find(".pika-next").click click_on "1" diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb index f3124bbf29e..2db8c6dadc6 100644 --- a/spec/features/profiles/personal_access_tokens_spec.rb +++ b/spec/features/profiles/personal_access_tokens_spec.rb @@ -34,7 +34,7 @@ describe 'Profile > Personal Access Tokens', js: true do fill_in "Name", with: name # Set date to 1st of next month - find_field("Expires at").trigger('focus') + find_field("Expires at").click find(".pika-next").click click_on "1" -- cgit v1.2.1 From 7b70d01279ea7de784b63ce41c52d460b93afbf9 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 11 Aug 2017 23:16:49 -0700 Subject: Add return value in form input to make add member specs pass --- .../projects/members/master_adds_member_with_expiration_date_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb index cd621b6b3ce..3ae5af80606 100644 --- a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb +++ b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb @@ -20,7 +20,7 @@ feature 'Projects > Members > Master adds member with expiration date', js: true page.within '.users-project-form' do select2(new_member.id, from: '#user_ids', multiple: true) - fill_in 'expires_at', with: date.to_s(:medium) + fill_in 'expires_at', with: date.to_s(:medium) + "\n" click_on 'Add to project' end @@ -37,7 +37,7 @@ feature 'Projects > Members > Master adds member with expiration date', js: true visit project_project_members_path(project) page.within "#project_member_#{new_member.project_members.first.id}" do - find('.js-access-expiration-date').set date.to_s(:medium) + find('.js-access-expiration-date').set date.to_s(:medium) + "\n" wait_for_requests expect(page).to have_content('Expires in 3 days') end -- cgit v1.2.1 From 2901fc1390370a38944cd2c1ea88bf0fd3839a5a Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 12 Aug 2017 21:49:56 -0700 Subject: Make protected branches spec work in headless Chrome This needs two patches in Capybara: * https://github.com/teamcapybara/capybara/pull/1902 * https://github.com/teamcapybara/capybara/pull/1903 --- spec/features/projects/branches_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index b7ceac79c40..26902589c33 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -93,7 +93,11 @@ describe 'Branches' do expect(page).to have_content('fix') expect(find('.all-branches')).to have_selector('li', count: 1) - find('.js-branch-fix .btn-remove').click + # To work with Chrome headless, this needs an updated version of + # Capybara with two bug fixes: + # * https://github.com/teamcapybara/capybara/pull/1902/ + # * https://github.com/teamcapybara/capybara/pull/1903/ + accept_alert { find('.js-branch-fix .btn-remove').click } expect(page).not_to have_content('fix') expect(find('.all-branches')).to have_selector('li', count: 0) -- cgit v1.2.1 From 1eade5854a5cbf5fc9e8a326e976c55006e100de Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 12 Aug 2017 22:48:02 -0700 Subject: Fix trigger spec by surrounding the accept_confirm in the right place --- spec/features/triggers_spec.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/triggers_spec.rb b/spec/features/triggers_spec.rb index 47664de469a..477798e3826 100644 --- a/spec/features/triggers_spec.rb +++ b/spec/features/triggers_spec.rb @@ -94,12 +94,13 @@ feature 'Triggers', js: true do scenario 'take trigger ownership' do # See if "Take ownership" on trigger works post trigger creation - find('a.btn-trigger-take-ownership').click page.accept_confirm do - expect(page.find('.flash-notice')).to have_content 'Trigger was re-assigned.' - expect(page.find('.triggers-list')).to have_content trigger_title - expect(page.find('.triggers-list .trigger-owner')).to have_content user.name + find('a.btn-trigger-take-ownership').click end + + expect(page.find('.flash-notice')).to have_content 'Trigger was re-assigned.' + expect(page.find('.triggers-list')).to have_content trigger_title + expect(page.find('.triggers-list .trigger-owner')).to have_content user.name end end -- cgit v1.2.1 From f64f06f6516bea10a0ac738c21961db033daa978 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 12 Aug 2017 22:51:35 -0700 Subject: Change trigger('click') calls to click --- spec/features/issues/issue_sidebar_spec.rb | 8 ++++---- spec/features/merge_requests/form_spec.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index 396cca6a3e2..a8983a016dc 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -130,8 +130,8 @@ feature 'Issue Sidebar' do it 'adds new label' do page.within('.block.labels') do fill_in 'new_label_name', with: 'wontfix' - page.find('.suggest-colors a', match: :first).trigger('click') - page.find('button', text: 'Create').trigger('click') + page.find('.suggest-colors a', match: :first).click + page.find('button', text: 'Create').click page.within('.dropdown-page-one') do expect(page).to have_content 'wontfix' @@ -142,8 +142,8 @@ feature 'Issue Sidebar' do it 'shows error message if label title is taken' do page.within('.block.labels') do fill_in 'new_label_name', with: label.title - page.find('.suggest-colors a', match: :first).trigger('click') - page.find('button', text: 'Create').trigger('click') + page.find('.suggest-colors a', match: :first).click + page.find('button', text: 'Create').click page.within('.dropdown-page-two') do expect(page).to have_content 'Title has already been taken' diff --git a/spec/features/merge_requests/form_spec.rb b/spec/features/merge_requests/form_spec.rb index 89410b0e90f..75988cfceae 100644 --- a/spec/features/merge_requests/form_spec.rb +++ b/spec/features/merge_requests/form_spec.rb @@ -41,7 +41,7 @@ describe 'New/edit merge request', :js do expect(page).to have_content user2.name end - find('a', text: 'Assign to me').trigger('click') + find('a', text: 'Assign to me').click expect(find('input[name="merge_request[assignee_id]"]', visible: false).value).to match(user.id.to_s) page.within '.js-assignee-search' do expect(page).to have_content user.name -- cgit v1.2.1 From 1ddfe8ca33ab2ccd7badc5ef52ea7d88da46b32f Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 12 Aug 2017 23:01:24 -0700 Subject: Remove a few HTTP status checks as these are not supported in Selenium --- spec/features/projects/environments/environment_spec.rb | 1 - spec/features/projects/pipelines/pipelines_spec.rb | 1 - 2 files changed, 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index 56addd64056..c9f12e877b3 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -198,7 +198,6 @@ feature 'Environment' do end it 'renders a correct environment folder' do - expect(page).to have_http_status(:ok) expect(page).to have_content('Environments / staging-1.0') end end diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 92479558553..b6a66a6d0c8 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -515,7 +515,6 @@ describe 'Pipelines', :js do let(:project) { create(:project, :public, :repository) } it { expect(page).to have_content 'Build with confidence' } - it { expect(page).to have_http_status(:success) } end context 'when project is private' do -- cgit v1.2.1 From b03fe23d536cda3f65965f31c4e3965e66858616 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 12 Aug 2017 23:01:45 -0700 Subject: Remove unsupported `network_traffic` in specs --- spec/features/snippets/notes_on_personal_snippets_spec.rb | 3 --- 1 file changed, 3 deletions(-) (limited to 'spec/features') diff --git a/spec/features/snippets/notes_on_personal_snippets_spec.rb b/spec/features/snippets/notes_on_personal_snippets_spec.rb index f1d0905738b..b7245c1d92b 100644 --- a/spec/features/snippets/notes_on_personal_snippets_spec.rb +++ b/spec/features/snippets/notes_on_personal_snippets_spec.rb @@ -74,18 +74,15 @@ describe 'Comments on personal snippets', :js do it 'should not have autocomplete' do wait_for_requests - request_count_before = page.driver.network_traffic.count find('#note_note').native.send_keys('') fill_in 'note[note]', with: '@' wait_for_requests - request_count_after = page.driver.network_traffic.count # This selector probably won't be in place even if autocomplete was enabled # but we want to make sure expect(page).not_to have_selector('.atwho-view') - expect(request_count_before).to eq(request_count_after) end end -- cgit v1.2.1 From 12e6cb71c6ef3fbbad6961eb06ebf6d41e9eb26a Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 12 Aug 2017 23:08:47 -0700 Subject: Fix pipelines spec by surrounding click with accept_confirm --- spec/features/projects/pipelines/pipelines_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index b6a66a6d0c8..2d5407747af 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -103,7 +103,7 @@ describe 'Pipelines', :js do context 'when canceling' do before do - find('.js-pipelines-cancel-button').click + accept_confirm { find('.js-pipelines-cancel-button').click } wait_for_requests end -- cgit v1.2.1 From 3e644d4b065defc3ebf8cb6d1fc6198b0b366c9e Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 13 Aug 2017 22:30:37 -0700 Subject: Fix U2F spec in headless Chrome There were a number of issues with this spec: 1. The deletion of the U2F device needed an `accept_confirm` block 2. The "We heard back from your U2F device" message is shown only briefly before the JavaScript handler submits the form. The only way to fix this is to put a delay in the submission. 3. The "Remember Me" field can't be checked in step 2 for the same reason. --- spec/features/u2f_spec.rb | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'spec/features') diff --git a/spec/features/u2f_spec.rb b/spec/features/u2f_spec.rb index f3662cb184f..915d90859ba 100644 --- a/spec/features/u2f_spec.rb +++ b/spec/features/u2f_spec.rb @@ -79,7 +79,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do first_u2f_device = register_u2f_device second_u2f_device = register_u2f_device(name: 'My other device') - click_on "Delete", match: :first + accept_confirm { click_on "Delete", match: :first } expect(page).to have_content('Successfully deleted') expect(page.body).not_to match(first_u2f_device.name) @@ -162,7 +162,6 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do @u2f_device.respond_to_u2f_authentication - expect(page).to have_content('We heard back from your U2F device') expect(page).to have_css('.sign-out-link', visible: false) end end @@ -174,23 +173,10 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do @u2f_device.respond_to_u2f_authentication - expect(page).to have_content('We heard back from your U2F device') expect(page).to have_css('.sign-out-link', visible: false) end end - it 'persists remember_me value via hidden field' do - gitlab_sign_in(user, remember: true) - - @u2f_device.respond_to_u2f_authentication - expect(page).to have_content('We heard back from your U2F device') - - within 'div#js-authenticate-u2f' do - field = first('input#user_remember_me', visible: false) - expect(field.value).to eq '1' - end - end - describe "when a given U2F device has already been registered by another user" do describe "but not the current user" do it "does not allow logging in with that particular device" do -- cgit v1.2.1 From 767dffcc34f5088ea472160380a84c093aa02c73 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 15 Aug 2017 13:44:57 -0700 Subject: Fix a few failing specs due to missing accept_confirm --- spec/features/merge_requests/diff_notes_avatars_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/diff_notes_avatars_spec.rb b/spec/features/merge_requests/diff_notes_avatars_spec.rb index 737045413bf..a3737b30721 100644 --- a/spec/features/merge_requests/diff_notes_avatars_spec.rb +++ b/spec/features/merge_requests/diff_notes_avatars_spec.rb @@ -115,7 +115,7 @@ feature 'Diff note avatars', js: true do open_more_actions_dropdown(note) page.within find(".note-row-#{note.id}") do - find('.js-note-delete').click + accept_confirm { find('.js-note-delete').click } end wait_for_requests -- cgit v1.2.1 From 541a082c9fdfdf8f3999fda894e5e1feb10158a8 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 16 Aug 2017 02:20:39 -0700 Subject: Rename find('.ace_editor') -> find('.ace_text-input') to make Chrome happy --- spec/features/projects/snippets/create_snippet_spec.rb | 2 +- spec/features/snippets/user_creates_snippet_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/snippets/create_snippet_spec.rb b/spec/features/projects/snippets/create_snippet_spec.rb index 3e79dba3f19..7dc779fa573 100644 --- a/spec/features/projects/snippets/create_snippet_spec.rb +++ b/spec/features/projects/snippets/create_snippet_spec.rb @@ -10,7 +10,7 @@ feature 'Create Snippet', :js do fill_in 'project_snippet_title', with: 'My Snippet Title' fill_in 'project_snippet_description', with: 'My Snippet **Description**' page.within('.file-editor') do - find('.ace_editor').native.send_keys('Hello World!') + find('.ace_text-input').native.send_keys('Hello World!') end end diff --git a/spec/features/snippets/user_creates_snippet_spec.rb b/spec/features/snippets/user_creates_snippet_spec.rb index d732383a1e1..0b9ad37f0e9 100644 --- a/spec/features/snippets/user_creates_snippet_spec.rb +++ b/spec/features/snippets/user_creates_snippet_spec.rb @@ -14,7 +14,7 @@ feature 'User creates snippet', :js do fill_in 'personal_snippet_title', with: 'My Snippet Title' fill_in 'personal_snippet_description', with: 'My Snippet **Description**' page.within('.file-editor') do - find('.ace_editor').native.send_keys 'Hello World!' + find('.ace_text-input').native.send_keys 'Hello World!' end end @@ -94,7 +94,7 @@ feature 'User creates snippet', :js do fill_in 'personal_snippet_title', with: 'My Snippet Title' page.within('.file-editor') do find(:xpath, "//input[@id='personal_snippet_file_name']").set 'snippet+file+name' - find('.ace_editor').native.send_keys 'Hello World!' + find('.ace_text-input').native.send_keys 'Hello World!' end click_button 'Create snippet' -- cgit v1.2.1 From 3e4b7e987668068b716ff4b702db07edcfb0f424 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 22 Aug 2017 05:00:37 -0700 Subject: Use find_link instead of incorrect jQuery to make Selenium test pass --- spec/features/issues/filtered_search/filter_issues_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb index 2070043d842..1029a5787b8 100644 --- a/spec/features/issues/filtered_search/filter_issues_spec.rb +++ b/spec/features/issues/filtered_search/filter_issues_spec.rb @@ -848,7 +848,7 @@ describe 'Filter issues', js: true do it 'updates atom feed link for group issues' do visit issues_group_path(group, milestone_title: milestone.title, assignee_id: user.id) - link = find('.nav-controls a', text: 'Subscribe') + link = find_link('Subscribe') params = CGI.parse(URI.parse(link[:href]).query) auto_discovery_link = find('link[type="application/atom+xml"]', visible: false) auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query) -- cgit v1.2.1 From 1899d543a6a18e8aa59abdc19a47d38bbb3cc487 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 23 Aug 2017 23:38:09 -0700 Subject: Change trigger('click') and trigger('mouseover') -> click --- spec/features/merge_requests/diff_notes_avatars_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/diff_notes_avatars_spec.rb b/spec/features/merge_requests/diff_notes_avatars_spec.rb index 09aab8195e1..13721b72584 100644 --- a/spec/features/merge_requests/diff_notes_avatars_spec.rb +++ b/spec/features/merge_requests/diff_notes_avatars_spec.rb @@ -54,7 +54,7 @@ feature 'Diff note avatars', js: true do end it 'does not render avatar after commenting' do - first('.diff-line-num').trigger('mouseover') + first('.diff-line-num').click find('.js-add-diff-note-button').click page.within('.js-discussion-note-form') do @@ -157,7 +157,7 @@ feature 'Diff note avatars', js: true do end page.within find("[id='#{position.line_code(project.repository)}']") do - find('.diff-notes-collapse').trigger('click') + find('.diff-notes-collapse').click expect(page).to have_selector('img.js-diff-comment-avatar', count: 3) expect(find('.diff-comments-more-count')).to have_content '+1' -- cgit v1.2.1 From 07e95212d2b9fe0e96501221fe639cc0d74a7cea Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 23 Aug 2017 23:57:51 -0700 Subject: Fix recent_searches_spec.rb by clicking on buttons instead of relying on hidden elements --- spec/features/issues/filtered_search/recent_searches_spec.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/filtered_search/recent_searches_spec.rb b/spec/features/issues/filtered_search/recent_searches_spec.rb index 4fc1f3209b3..e9cb2850496 100644 --- a/spec/features/issues/filtered_search/recent_searches_spec.rb +++ b/spec/features/issues/filtered_search/recent_searches_spec.rb @@ -80,7 +80,8 @@ describe 'Recent searches', js: true do set_recent_searches(project_1_local_storage_key, '["foo", "bar"]') visit project_issues_path(project_1) - all('.filtered-search-history-dropdown-item', visible: false)[0].click + find('.filtered-search-history-dropdown-toggle-button').click + all('.filtered-search-history-dropdown-item')[0].click wait_for_filtered_search('foo') expect(find('.filtered-search').value.strip).to eq('foo') @@ -90,12 +91,14 @@ describe 'Recent searches', js: true do set_recent_searches(project_1_local_storage_key, '["foo"]') visit project_issues_path(project_1) - items_before = all('.filtered-search-history-dropdown-item', visible: false) + find('.filtered-search-history-dropdown-toggle-button').click + items_before = all('.filtered-search-history-dropdown-item') expect(items_before.count).to eq(1) - find('.filtered-search-history-clear-button', visible: false).click - items_after = all('.filtered-search-history-dropdown-item', visible: false) + find('.filtered-search-history-clear-button').click + find('.filtered-search-history-dropdown-toggle-button').click + items_after = all('.filtered-search-history-dropdown-item') expect(items_after.count).to eq(0) end -- cgit v1.2.1 From a319418d9c050097a797fbf4f890cebd5256ed43 Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" Date: Thu, 14 Sep 2017 12:01:07 +0100 Subject: Merge FE --- spec/features/issues_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 5c284a1fe5f..5a8aed6a0fd 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -725,14 +725,14 @@ describe 'Issues' do visit project_issue_path(project, issue) - expect(page).to have_css('.confidential-issue-warning') - expect(page).to have_css('.is-confidential') - expect(page).not_to have_css('.is-not-confidential') + expect(page).to have_css('.issuable-note-warning') + expect(find('.issuable-sidebar-item.confidentiality')).to have_css('.is-active') + expect(find('.issuable-sidebar-item.confidentiality')).not_to have_css('.not-active') find('.confidential-edit').click - expect(page).to have_css('.confidential-warning-message') + expect(page).to have_css('.sidebar-item-warning-message') - within('.confidential-warning-message') do + within('.sidebar-item-warning-message') do find('.btn-close').click end @@ -740,7 +740,7 @@ describe 'Issues' do visit project_issue_path(project, issue) - expect(page).not_to have_css('.is-confidential') + expect(page).not_to have_css('.is-active') end end end -- cgit v1.2.1 From d7b48eb0e94af4648a4cc13bcc789ad66d83dab8 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Tue, 19 Sep 2017 12:51:16 -0500 Subject: Replaced trigger calls for click --- spec/features/issues/move_spec.rb | 6 +++--- spec/features/merge_requests/diffs_spec.rb | 2 +- spec/features/search/user_searches_for_wiki_pages_spec.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/move_spec.rb b/spec/features/issues/move_spec.rb index b2724945da4..77e04f46b93 100644 --- a/spec/features/issues/move_spec.rb +++ b/spec/features/issues/move_spec.rb @@ -38,7 +38,7 @@ feature 'issue move to another project' do end scenario 'moving issue to another project', js: true do - find('.js-move-issue').trigger('click') + find('.js-move-issue').click wait_for_requests all('.js-move-issue-dropdown-item')[0].click find('.js-move-issue-confirmation-button').click @@ -52,7 +52,7 @@ feature 'issue move to another project' do scenario 'searching project dropdown', js: true do new_project_search.team << [user, :reporter] - find('.js-move-issue').trigger('click') + find('.js-move-issue').click wait_for_requests page.within '.js-sidebar-move-issue-block' do @@ -69,7 +69,7 @@ feature 'issue move to another project' do background { another_project.team << [user, :guest] } scenario 'browsing projects in projects select' do - find('.js-move-issue').trigger('click') + find('.js-move-issue').click wait_for_requests page.within '.js-sidebar-move-issue-block' do diff --git a/spec/features/merge_requests/diffs_spec.rb b/spec/features/merge_requests/diffs_spec.rb index e9068f722d5..a8f5dc275e4 100644 --- a/spec/features/merge_requests/diffs_spec.rb +++ b/spec/features/merge_requests/diffs_spec.rb @@ -88,7 +88,7 @@ feature 'Diffs URL', js: true do visit diffs_project_merge_request_path(project, merge_request) # Throws `Capybara::Poltergeist::InvalidSelector` if we try to use `#hash` syntax - find("[id=\"#{changelog_id}\"] .js-edit-blob").trigger('click') + find("[id=\"#{changelog_id}\"] .js-edit-blob").click expect(page).to have_selector('.js-fork-suggestion-button', count: 1) expect(page).to have_selector('.js-cancel-fork-suggestion-button', count: 1) diff --git a/spec/features/search/user_searches_for_wiki_pages_spec.rb b/spec/features/search/user_searches_for_wiki_pages_spec.rb index 1ea56479ecc..00af625dc86 100644 --- a/spec/features/search/user_searches_for_wiki_pages_spec.rb +++ b/spec/features/search/user_searches_for_wiki_pages_spec.rb @@ -15,14 +15,14 @@ describe 'User searches for wiki pages', :js do include_examples 'top right search form' it 'finds a page' do - find('.js-search-project-dropdown').trigger('click') + find('.js-search-project-dropdown').click page.within('.project-filter') do click_link(project.name_with_namespace) end fill_in('dashboard_search', with: 'content') - find('.btn-search').trigger('click') + find('.btn-search').click page.within('.search-filter') do click_link('Wiki') -- cgit v1.2.1 From 1849336a221ba21f9d7c052e5cd8938499a98476 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 19 Sep 2017 01:03:44 -0500 Subject: Port fast-forward widget_spec test from EE --- spec/features/merge_requests/widget_spec.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'spec/features') diff --git a/spec/features/merge_requests/widget_spec.rb b/spec/features/merge_requests/widget_spec.rb index 443b596b3c6..791cfa308c3 100644 --- a/spec/features/merge_requests/widget_spec.rb +++ b/spec/features/merge_requests/widget_spec.rb @@ -202,6 +202,28 @@ describe 'Merge request', :js do end end + context 'view merge request where fast-forward merge is not possible' do + before do + project.update(merge_requests_ff_only_enabled: true) + + merge_request.update( + merge_user: merge_request.author, + merge_status: :cannot_be_merged + ) + + visit project_merge_request_path(project, merge_request) + end + + it 'shows information about the merge error' do + # Wait for the `ci_status` and `merge_check` requests + wait_for_requests + + page.within('.mr-widget-body') do + expect(page).to have_content('Fast-forward merge is not possible') + end + end + end + context 'merge error' do before do allow_any_instance_of(Repository).to receive(:merge).and_return(false) -- cgit v1.2.1 From f68b3aaaadac6658f8c2b5c330873582e44b87f8 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Wed, 20 Sep 2017 13:24:24 -0500 Subject: Added defaults for the protected branches dropdowns for the repository settings --- spec/features/protected_branches_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'spec/features') diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index 3677bf38724..a28bc8f952f 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -90,4 +90,22 @@ feature 'Protected Branches', js: true do describe "access control" do include_examples "protected branches > access control > CE" end + + describe "saved defaults" do + it "keeps the allowed to merge and push dropdowns defaults based on the previous selection" do + visit project_protected_branches_path(project) + set_protected_branch_name('some-branch') + find(".js-allowed-to-merge").trigger('click') + click_link 'No one' + find(".js-allowed-to-push").trigger('click') + click_link 'Developers + Masters' + visit project_protected_branches_path(project) + page.within(".js-allowed-to-merge") do + expect(page.find(".dropdown-toggle-text")).to have_content("No one") + end + page.within(".js-allowed-to-push") do + expect(page.find(".dropdown-toggle-text")).to have_content("Developers + Masters") + end + end + end end -- cgit v1.2.1 From d4f3fca93bf31680b7cb23f6e68e809b864b27e8 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 20 Sep 2017 11:09:49 -0500 Subject: fix broken add_cookies --- spec/features/merge_requests/user_posts_diff_notes_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/user_posts_diff_notes_spec.rb b/spec/features/merge_requests/user_posts_diff_notes_spec.rb index c298f1927f1..0f31799f083 100644 --- a/spec/features/merge_requests/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_diff_notes_spec.rb @@ -6,7 +6,8 @@ feature 'Merge requests > User posts diff notes', :js do let(:project) { merge_request.source_project } before do - page.driver.set_cookie('sidebar_collapsed', 'true') + visit '/' + page.driver.browser.manage.add_cookie(name: 'sidebar_collapsed', value: 'true') project.add_developer(user) sign_in(user) -- cgit v1.2.1 From 9f3227645442017e3518e2b0ba3e9270ebabfa06 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 19 Sep 2017 13:43:04 +0100 Subject: Add context tabs to dashboard/projects This allows users to quickly switch between all projects they have access to & there own namespace projects. These tabs also keep the same filtering/search options selected so the user can quickly switch between the two different contexts. Closes #29045 --- spec/features/dashboard/projects_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'spec/features') diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index 9a7b8e3ba6b..4da95ccc169 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -50,6 +50,25 @@ feature 'Dashboard Projects' do end end + context 'when on Your projects tab' do + it 'shows all projects by default' do + visit dashboard_projects_path + + expect(page).to have_content(project.name) + end + + it 'shows personal projects on personal projects tab', :js do + project3 = create(:project, namespace: user.namespace) + + visit dashboard_projects_path + + click_link 'Personal' + + expect(page).not_to have_content(project.name) + expect(page).to have_content(project3.name) + end + end + context 'when on Starred projects tab' do it 'shows only starred projects' do user.toggle_star(project2) -- cgit v1.2.1 From 7a8514c3a1806f44d7602c7a6602c116b4264adb Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 22 Sep 2017 13:15:43 -0500 Subject: add set_cookie helper --- spec/features/boards/boards_spec.rb | 3 ++- spec/features/issues/filtered_search/visual_tokens_spec.rb | 3 ++- spec/features/merge_requests/diff_notes_avatars_spec.rb | 3 ++- spec/features/merge_requests/user_posts_diff_notes_spec.rb | 5 +++-- 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 33aca6cb527..cfff6025459 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -1,6 +1,7 @@ require 'rails_helper' describe 'Issue Boards', js: true do + include CookieHelper include DragTo let(:group) { create(:group, :nested) } @@ -13,7 +14,7 @@ describe 'Issue Boards', js: true do project.team << [user, :master] project.team << [user2, :master] - page.driver.set_cookie('sidebar_collapsed', 'true') + set_cookie('sidebar_collapsed', 'true') sign_in(user) end diff --git a/spec/features/issues/filtered_search/visual_tokens_spec.rb b/spec/features/issues/filtered_search/visual_tokens_spec.rb index 2b624f4842d..949def43690 100644 --- a/spec/features/issues/filtered_search/visual_tokens_spec.rb +++ b/spec/features/issues/filtered_search/visual_tokens_spec.rb @@ -1,6 +1,7 @@ require 'rails_helper' describe 'Visual tokens', js: true do + include CookieHelper include FilteredSearchHelpers include WaitForRequests @@ -28,7 +29,7 @@ describe 'Visual tokens', js: true do sign_in(user) create(:issue, project: project) - page.driver.set_cookie('sidebar_collapsed', 'true') + set_cookie('sidebar_collapsed', 'true') visit project_issues_path(project) end diff --git a/spec/features/merge_requests/diff_notes_avatars_spec.rb b/spec/features/merge_requests/diff_notes_avatars_spec.rb index ce82c5cd1dc..6f025fdc855 100644 --- a/spec/features/merge_requests/diff_notes_avatars_spec.rb +++ b/spec/features/merge_requests/diff_notes_avatars_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' feature 'Diff note avatars', js: true do + include CookieHelper include NoteInteractionHelpers let(:user) { create(:user) } @@ -22,7 +23,7 @@ feature 'Diff note avatars', js: true do project.team << [user, :master] sign_in user - page.driver.set_cookie('sidebar_collapsed', 'true') + set_cookie('sidebar_collapsed', 'true') end context 'discussion tab' do diff --git a/spec/features/merge_requests/user_posts_diff_notes_spec.rb b/spec/features/merge_requests/user_posts_diff_notes_spec.rb index 0f31799f083..3b873d6f53c 100644 --- a/spec/features/merge_requests/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_diff_notes_spec.rb @@ -1,13 +1,14 @@ require 'spec_helper' feature 'Merge requests > User posts diff notes', :js do + include CookieHelper + let(:user) { create(:user) } let(:merge_request) { create(:merge_request) } let(:project) { merge_request.source_project } before do - visit '/' - page.driver.browser.manage.add_cookie(name: 'sidebar_collapsed', value: 'true') + set_cookie('sidebar_collapsed', 'true') project.add_developer(user) sign_in(user) -- cgit v1.2.1 From 0d236638b683d368d5384e95dd75772a68c727c2 Mon Sep 17 00:00:00 2001 From: "Vitaliy @blackst0ne Klachkov" Date: Sat, 23 Sep 2017 11:46:53 +1100 Subject: Improve list of sorting options --- spec/features/dashboard/issues_filter_spec.rb | 8 ++-- spec/features/dashboard/merge_requests_spec.rb | 8 ++-- spec/features/issuables/default_sort_order_spec.rb | 38 +++++----------- .../issues/filtered_search/filter_issues_spec.rb | 16 +++---- spec/features/issues_spec.rb | 52 +++++----------------- .../merge_requests/filter_merge_requests_spec.rb | 4 +- .../user_lists_merge_requests_spec.rb | 40 ++++------------- 7 files changed, 49 insertions(+), 117 deletions(-) (limited to 'spec/features') diff --git a/spec/features/dashboard/issues_filter_spec.rb b/spec/features/dashboard/issues_filter_spec.rb index facb67ae787..8759950e013 100644 --- a/spec/features/dashboard/issues_filter_spec.rb +++ b/spec/features/dashboard/issues_filter_spec.rb @@ -90,17 +90,17 @@ feature 'Dashboard Issues filtering', :js do context 'sorting' do it 'shows sorted issues' do - sorting_by('Oldest updated') + sorting_by('Created date') visit_issues - expect(find('.issues-filters')).to have_content('Oldest updated') + expect(find('.issues-filters')).to have_content('Created date') end it 'keeps sorting issues after visiting Projects Issues page' do - sorting_by('Oldest updated') + sorting_by('Created date') visit project_issues_path(project) - expect(find('.issues-filters')).to have_content('Oldest updated') + expect(find('.issues-filters')).to have_content('Created date') end end diff --git a/spec/features/dashboard/merge_requests_spec.rb b/spec/features/dashboard/merge_requests_spec.rb index b4992dd54a1..8204828b5b9 100644 --- a/spec/features/dashboard/merge_requests_spec.rb +++ b/spec/features/dashboard/merge_requests_spec.rb @@ -112,19 +112,19 @@ feature 'Dashboard Merge Requests' do end it 'shows sorted merge requests' do - sorting_by('Oldest updated') + sorting_by('Created date') visit merge_requests_dashboard_path(assignee_id: current_user.id) - expect(find('.issues-filters')).to have_content('Oldest updated') + expect(find('.issues-filters')).to have_content('Created date') end it 'keeps sorting merge requests after visiting Projects MR page' do - sorting_by('Oldest updated') + sorting_by('Created date') visit project_merge_requests_path(project) - expect(find('.issues-filters')).to have_content('Oldest updated') + expect(find('.issues-filters')).to have_content('Created date') end end end diff --git a/spec/features/issuables/default_sort_order_spec.rb b/spec/features/issuables/default_sort_order_spec.rb index b72b690110f..925d026ed61 100644 --- a/spec/features/issuables/default_sort_order_spec.rb +++ b/spec/features/issuables/default_sort_order_spec.rb @@ -40,10 +40,10 @@ describe 'Projects > Issuables > Default sort order' do context 'in the "merge requests / open" tab', js: true do let(:issuable_type) { :merge_request } - it 'is "last created"' do + it 'is "created date"' do visit_merge_requests_with_state(project, 'open') - expect(selected_sort_order).to eq('last created') + expect(selected_sort_order).to eq('created date') expect(first_merge_request).to include(last_created_issuable.title) expect(last_merge_request).to include(first_created_issuable.title) end @@ -76,10 +76,10 @@ describe 'Projects > Issuables > Default sort order' do context 'in the "merge requests / all" tab', js: true do let(:issuable_type) { :merge_request } - it 'is "last created"' do + it 'is "created date"' do visit_merge_requests_with_state(project, 'all') - expect(find('.issues-other-filters')).to have_content('Last created') + expect(find('.issues-other-filters')).to have_content('Created date') expect(first_merge_request).to include(last_created_issuable.title) expect(last_merge_request).to include(first_created_issuable.title) end @@ -105,10 +105,10 @@ describe 'Projects > Issuables > Default sort order' do context 'in the "issues" tab', js: true do let(:issuable_type) { :issue } - it 'is "last created"' do + it 'is "created date"' do visit_issues project - expect(find('.issues-other-filters')).to have_content('Last created') + expect(find('.issues-other-filters')).to have_content('Created date') expect(first_issue).to include(last_created_issuable.title) expect(last_issue).to include(first_created_issuable.title) end @@ -117,10 +117,10 @@ describe 'Projects > Issuables > Default sort order' do context 'in the "issues / open" tab', js: true do let(:issuable_type) { :issue } - it 'is "last created"' do + it 'is "created date"' do visit_issues_with_state(project, 'open') - expect(find('.issues-other-filters')).to have_content('Last created') + expect(find('.issues-other-filters')).to have_content('Created date') expect(first_issue).to include(last_created_issuable.title) expect(last_issue).to include(first_created_issuable.title) end @@ -141,10 +141,10 @@ describe 'Projects > Issuables > Default sort order' do context 'in the "issues / all" tab', js: true do let(:issuable_type) { :issue } - it 'is "last created"' do + it 'is "created date"' do visit_issues_with_state(project, 'all') - expect(find('.issues-other-filters')).to have_content('Last created') + expect(find('.issues-other-filters')).to have_content('Created date') expect(first_issue).to include(last_created_issuable.title) expect(last_issue).to include(first_created_issuable.title) end @@ -157,26 +157,12 @@ describe 'Projects > Issuables > Default sort order' do visit_issues(project, sort: 'id_desc') end - it 'shows the sort order as last created' do - expect(find('.issues-other-filters')).to have_content('Last created') + it 'shows the sort order as created date' do + expect(find('.issues-other-filters')).to have_content('Created date') expect(first_issue).to include(last_created_issuable.title) expect(last_issue).to include(first_created_issuable.title) end end - - context 'when the sort in the URL is id_asc' do - let(:issuable_type) { :issue } - - before do - visit_issues(project, sort: 'id_asc') - end - - it 'shows the sort order as oldest created' do - expect(find('.issues-other-filters')).to have_content('Oldest created') - expect(first_issue).to include(first_created_issuable.title) - expect(last_issue).to include(last_created_issuable.title) - end - end end def selected_sort_order diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb index 3ea6e1c8863..630d6a10c9c 100644 --- a/spec/features/issues/filtered_search/filter_issues_spec.rb +++ b/spec/features/issues/filtered_search/filter_issues_spec.rb @@ -405,20 +405,18 @@ describe 'Filter issues', js: true do end context 'sorting' do - it 'sorts by oldest updated' do - create(:issue, + it 'sorts by created date' do + new_issue = create(:issue, title: '3 days ago', project: project, author: user, - created_at: 3.days.ago, - updated_at: 3.days.ago) + created_at: 3.days.ago) - old_issue = create(:issue, + create(:issue, title: '5 days ago', project: project, author: user, - created_at: 5.days.ago, - updated_at: 5.days.ago) + created_at: 5.days.ago) input_filtered_search('days ago') @@ -427,10 +425,10 @@ describe 'Filter issues', js: true do sort_toggle = find('.filtered-search-wrapper .dropdown-toggle') sort_toggle.click - find('.filtered-search-wrapper .dropdown-menu li a', text: 'Oldest updated').click + find('.filtered-search-wrapper .dropdown-menu li a', text: 'Created date').click wait_for_requests - expect(find('.issues-list .issue:first-of-type .issue-title-text a')).to have_content(old_issue.title) + expect(find('.issues-list .issue:first-of-type .issue-title-text a')).to have_content(new_issue.title) end end end diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 5c284a1fe5f..fb763c93c66 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -190,19 +190,12 @@ describe 'Issues' do let(:later_due_milestone) { create(:milestone, due_date: '2013-12-12') } it 'sorts by newest' do - visit project_issues_path(project, sort: sort_value_recently_created) + visit project_issues_path(project, sort: sort_value_created_date) expect(first_issue).to include('foo') expect(last_issue).to include('baz') end - it 'sorts by oldest' do - visit project_issues_path(project, sort: sort_value_oldest_created) - - expect(first_issue).to include('baz') - expect(last_issue).to include('foo') - end - it 'sorts by most recently updated' do baz.updated_at = Time.now + 100 baz.save @@ -211,36 +204,22 @@ describe 'Issues' do expect(first_issue).to include('baz') end - it 'sorts by least recently updated' do - baz.updated_at = Time.now - 100 - baz.save - visit project_issues_path(project, sort: sort_value_oldest_updated) - - expect(first_issue).to include('baz') - end - describe 'sorting by due date' do before do foo.update(due_date: 1.day.from_now) bar.update(due_date: 6.days.from_now) end - it 'sorts by recently due date' do - visit project_issues_path(project, sort: sort_value_due_date_soon) + it 'sorts by due date' do + visit project_issues_path(project, sort: sort_value_due_date) expect(first_issue).to include('foo') end - it 'sorts by least recently due date' do - visit project_issues_path(project, sort: sort_value_due_date_later) - - expect(first_issue).to include('bar') - end - - it 'sorts by least recently due date by excluding nil due dates' do + it 'sorts by due date by excluding nil due dates' do bar.update(due_date: nil) - visit project_issues_path(project, sort: sort_value_due_date_later) + visit project_issues_path(project, sort: sort_value_due_date) expect(first_issue).to include('foo') end @@ -339,19 +318,12 @@ describe 'Issues' do bar.save end - it 'sorts by recently due milestone' do - visit project_issues_path(project, sort: sort_value_milestone_soon) + it 'sorts by milestone' do + visit project_issues_path(project, sort: sort_value_milestone) expect(first_issue).to include('foo') expect(last_issue).to include('baz') end - - it 'sorts by least recently due milestone' do - visit project_issues_path(project, sort: sort_value_milestone_later) - - expect(first_issue).to include('bar') - expect(last_issue).to include('baz') - end end describe 'combine filter and sort' do @@ -365,13 +337,11 @@ describe 'Issues' do end it 'sorts with a filter applied' do - visit project_issues_path(project, - sort: sort_value_oldest_created, - assignee_id: user2.id) + visit project_issues_path(project, sort: sort_value_created_date, assignee_id: user2.id) - expect(first_issue).to include('bar') - expect(last_issue).to include('foo') - expect(page).not_to have_content 'baz' + expect(first_issue).to include('foo') + expect(last_issue).to include('bar') + expect(page).not_to have_content('baz') end end end diff --git a/spec/features/merge_requests/filter_merge_requests_spec.rb b/spec/features/merge_requests/filter_merge_requests_spec.rb index b51ae0890e4..16703bc1c01 100644 --- a/spec/features/merge_requests/filter_merge_requests_spec.rb +++ b/spec/features/merge_requests/filter_merge_requests_spec.rb @@ -277,9 +277,9 @@ describe 'Filter merge requests' do expect_mr_list_count(2) - click_button 'Last created' + click_button 'Created date' page.within '.dropdown-menu-sort' do - click_link 'Oldest created' + click_link 'Priority' end wait_for_requests diff --git a/spec/features/merge_requests/user_lists_merge_requests_spec.rb b/spec/features/merge_requests/user_lists_merge_requests_spec.rb index 20008b4e7f9..416a0f78a45 100644 --- a/spec/features/merge_requests/user_lists_merge_requests_spec.rb +++ b/spec/features/merge_requests/user_lists_merge_requests_spec.rb @@ -52,21 +52,13 @@ describe 'Projects > Merge requests > User lists merge requests' do end it 'sorts by newest' do - visit_merge_requests(project, sort: sort_value_recently_created) + visit_merge_requests(project, sort: sort_value_created_date) expect(first_merge_request).to include('fix') expect(last_merge_request).to include('merge-test') expect(count_merge_requests).to eq(3) end - it 'sorts by oldest' do - visit_merge_requests(project, sort: sort_value_oldest_created) - - expect(first_merge_request).to include('merge-test') - expect(last_merge_request).to include('fix') - expect(count_merge_requests).to eq(3) - end - it 'sorts by last updated' do visit_merge_requests(project, sort: sort_value_recently_updated) @@ -74,33 +66,19 @@ describe 'Projects > Merge requests > User lists merge requests' do expect(count_merge_requests).to eq(3) end - it 'sorts by oldest updated' do - visit_merge_requests(project, sort: sort_value_oldest_updated) - - expect(first_merge_request).to include('markdown') - expect(count_merge_requests).to eq(3) - end - - it 'sorts by milestone due soon' do - visit_merge_requests(project, sort: sort_value_milestone_soon) + it 'sorts by milestone' do + visit_merge_requests(project, sort: sort_value_milestone) expect(first_merge_request).to include('fix') expect(count_merge_requests).to eq(3) end - it 'sorts by milestone due later' do - visit_merge_requests(project, sort: sort_value_milestone_later) - - expect(first_merge_request).to include('markdown') - expect(count_merge_requests).to eq(3) - end - - it 'filters on one label and sorts by due soon' do + it 'filters on one label and sorts by due date' do label = create(:label, project: project) create(:label_link, label: label, target: @fix) visit_merge_requests(project, label_name: [label.name], - sort: sort_value_due_date_soon) + sort: sort_value_due_date) expect(first_merge_request).to include('fix') expect(count_merge_requests).to eq(1) @@ -115,9 +93,9 @@ describe 'Projects > Merge requests > User lists merge requests' do create(:label_link, label: label2, target: @fix) end - it 'sorts by due soon' do + it 'sorts by due date' do visit_merge_requests(project, label_name: [label.name, label2.name], - sort: sort_value_due_date_soon) + sort: sort_value_due_date) expect(first_merge_request).to include('fix') expect(count_merge_requests).to eq(1) @@ -127,7 +105,7 @@ describe 'Projects > Merge requests > User lists merge requests' do it 'sorts by due soon' do visit_merge_requests(project, label_name: [label.name, label2.name], assignee_id: user.id, - sort: sort_value_due_date_soon) + sort: sort_value_due_date) expect(first_merge_request).to include('fix') expect(count_merge_requests).to eq(1) @@ -137,7 +115,7 @@ describe 'Projects > Merge requests > User lists merge requests' do visit project_merge_requests_path(project, label_name: [label.name, label2.name], assignee_id: user.id, - sort: sort_value_milestone_soon) + sort: sort_value_milestone) expect(first_merge_request).to include('fix') end -- cgit v1.2.1 From f5937926f22095b68ae8bf363e737730df1848ce Mon Sep 17 00:00:00 2001 From: Brett Walker Date: Sat, 9 Sep 2017 15:10:34 +0200 Subject: refactored the Spinach feature `features/profile/emails.feature` into an rspec feature --- spec/features/profiles/emails_spec.rb | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 spec/features/profiles/emails_spec.rb (limited to 'spec/features') diff --git a/spec/features/profiles/emails_spec.rb b/spec/features/profiles/emails_spec.rb new file mode 100644 index 00000000000..98b8c607cb0 --- /dev/null +++ b/spec/features/profiles/emails_spec.rb @@ -0,0 +1,56 @@ +require 'rails_helper' + +feature 'Profile > Emails' do + let(:user) { create(:user) } + + before do + login_as(user) + end + + describe 'User adds an email' do + before do + visit profile_emails_path + end + + scenario 'saves the new email' do + fill_in('Email', with: 'my@email.com') + click_button('Add email address') + + expect(page).to have_content('my@email.com Unverified') + expect(page).to have_content('user1@example.org Verified') + expect(page).to have_content('Resend Confirmation Email') + end + + scenario 'does not add a duplicate email' do + fill_in('Email', with: user.email) + click_button('Add email address') + + email = user.emails.find_by(email: user.email) + expect(email).to be_nil + expect(page).to have_content('Email has already been taken') + end + end + + scenario 'User removes email' do + user.emails.create(email: 'my@email.com') + visit profile_emails_path + expect(page).to have_content("my@email.com") + + click_link('Remove') + expect(page).to_not have_content("my@email.com") + end + + scenario 'User confirms email' do + email = user.emails.create(email: 'my@email.com') + visit profile_emails_path + expect(page).to have_content("my@email.com Unverified") + + email.confirm + expect(email.confirmed?).to be_truthy + + visit profile_emails_path + expect(page).to have_content("my@email.com Verified") + end + + scenario '' +end -- cgit v1.2.1 From cf8a5bcaec99cc197ff556793febb8317e1db220 Mon Sep 17 00:00:00 2001 From: Brett Walker Date: Sat, 9 Sep 2017 15:55:07 +0200 Subject: add verified/unverified labels to profile emails. added "Resend confirmation email" for unverified emails --- spec/features/profiles/emails_spec.rb | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/profiles/emails_spec.rb b/spec/features/profiles/emails_spec.rb index 98b8c607cb0..a3e3ea4e7a2 100644 --- a/spec/features/profiles/emails_spec.rb +++ b/spec/features/profiles/emails_spec.rb @@ -17,8 +17,8 @@ feature 'Profile > Emails' do click_button('Add email address') expect(page).to have_content('my@email.com Unverified') - expect(page).to have_content('user1@example.org Verified') - expect(page).to have_content('Resend Confirmation Email') + expect(page).to have_content("#{user.email} Verified") + expect(page).to have_content('Resend confirmation email') end scenario 'does not add a duplicate email' do @@ -43,14 +43,30 @@ feature 'Profile > Emails' do scenario 'User confirms email' do email = user.emails.create(email: 'my@email.com') visit profile_emails_path - expect(page).to have_content("my@email.com Unverified") + expect(page).to have_content("#{email.email} Unverified") email.confirm expect(email.confirmed?).to be_truthy visit profile_emails_path - expect(page).to have_content("my@email.com Verified") + expect(page).to have_content("#{email.email} Verified") + end + + scenario 'User re-sends confirmation email' do + email = user.emails.create(email: 'my@email.com') + visit profile_emails_path + + expect { click_link("Resend confirmation email") }.to change { ActionMailer::Base.deliveries.size } + expect(page).to have_content("Confirmation email sent to #{email.email}") + end + + scenario 'old unconfirmed emails show Send Confirmation button' do + email = user.emails.create(email: 'my@email.com') + email.update_attribute(:confirmation_sent_at, nil) + visit profile_emails_path + + expect(page).to_not have_content('Resend confirmation email') + expect(page).to have_content('Send confirmation email') end - scenario '' end -- cgit v1.2.1 From d2267beb8916de5003e06b8764f209508fca989f Mon Sep 17 00:00:00 2001 From: Brett Walker Date: Sat, 9 Sep 2017 18:32:27 +0200 Subject: tweaks for rubocop --- spec/features/profiles/emails_spec.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'spec/features') diff --git a/spec/features/profiles/emails_spec.rb b/spec/features/profiles/emails_spec.rb index a3e3ea4e7a2..3085e1ee7bc 100644 --- a/spec/features/profiles/emails_spec.rb +++ b/spec/features/profiles/emails_spec.rb @@ -37,7 +37,7 @@ feature 'Profile > Emails' do expect(page).to have_content("my@email.com") click_link('Remove') - expect(page).to_not have_content("my@email.com") + expect(page).not_to have_content("my@email.com") end scenario 'User confirms email' do @@ -51,22 +51,21 @@ feature 'Profile > Emails' do visit profile_emails_path expect(page).to have_content("#{email.email} Verified") end - + scenario 'User re-sends confirmation email' do email = user.emails.create(email: 'my@email.com') visit profile_emails_path - + expect { click_link("Resend confirmation email") }.to change { ActionMailer::Base.deliveries.size } expect(page).to have_content("Confirmation email sent to #{email.email}") end - + scenario 'old unconfirmed emails show Send Confirmation button' do email = user.emails.create(email: 'my@email.com') email.update_attribute(:confirmation_sent_at, nil) visit profile_emails_path - expect(page).to_not have_content('Resend confirmation email') + expect(page).not_to have_content('Resend confirmation email') expect(page).to have_content('Send confirmation email') end - end -- cgit v1.2.1 From ed99c899a28134e8d9a1a8a8c4677a6ee65bbd2b Mon Sep 17 00:00:00 2001 From: Brett Walker Date: Mon, 18 Sep 2017 19:00:38 +0200 Subject: allow a verified secondary email to be use as the primary without a reconfirmation --- spec/features/profiles/emails_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/profiles/emails_spec.rb b/spec/features/profiles/emails_spec.rb index 3085e1ee7bc..11cc8aae6f3 100644 --- a/spec/features/profiles/emails_spec.rb +++ b/spec/features/profiles/emails_spec.rb @@ -4,7 +4,7 @@ feature 'Profile > Emails' do let(:user) { create(:user) } before do - login_as(user) + sign_in(user) end describe 'User adds an email' do -- cgit v1.2.1 From de9fb43f49689b947a3e7f3c47151e7d8b1dc30c Mon Sep 17 00:00:00 2001 From: Brett Walker Date: Wed, 20 Sep 2017 13:24:42 +0200 Subject: fix to make gpg_keys_spec start passing --- spec/features/profiles/gpg_keys_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/profiles/gpg_keys_spec.rb b/spec/features/profiles/gpg_keys_spec.rb index 623e4f341c5..b0f6848bc4b 100644 --- a/spec/features/profiles/gpg_keys_spec.rb +++ b/spec/features/profiles/gpg_keys_spec.rb @@ -4,7 +4,7 @@ feature 'Profile > GPG Keys' do let(:user) { create(:user, email: GpgHelpers::User2.emails.first) } before do - login_as(user) + sign_in(user) end describe 'User adds a key' do -- cgit v1.2.1 From bea18efad3f1ea0462d57f53984df8e98cdb4636 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Mon, 25 Sep 2017 11:14:19 -0500 Subject: Replaced trigger calls for click --- spec/features/projects/members/share_with_group_spec.rb | 4 ++-- spec/features/projects/wiki/user_views_wiki_page_spec.rb | 2 +- spec/features/search/user_searches_for_code_spec.rb | 4 ++-- spec/features/search/user_searches_for_issues_spec.rb | 8 ++++---- spec/features/search/user_searches_for_merge_requests_spec.rb | 6 +++--- spec/features/search/user_searches_for_milestones_spec.rb | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/members/share_with_group_spec.rb b/spec/features/projects/members/share_with_group_spec.rb index 3b368f8e25d..a52fc316474 100644 --- a/spec/features/projects/members/share_with_group_spec.rb +++ b/spec/features/projects/members/share_with_group_spec.rb @@ -41,7 +41,7 @@ feature 'Project > Members > Share with Group', :js do select2 group_to_share_with.id, from: '#link_group_id' page.find('body').click - find('.btn-create').trigger('click') + find('.btn-create').click page.within('.project-members-groups') do expect(page).to have_content(group_to_share_with.name) @@ -123,7 +123,7 @@ feature 'Project > Members > Share with Group', :js do fill_in 'expires_at_groups', with: (Time.now + 4.5.days).strftime('%Y-%m-%d') page.find('body').click - find('.btn-create').trigger('click') + find('.btn-create').click end scenario 'the group link shows the expiration time with a warning class' do diff --git a/spec/features/projects/wiki/user_views_wiki_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_page_spec.rb index d201d4f6b98..9790337985d 100644 --- a/spec/features/projects/wiki/user_views_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_page_spec.rb @@ -133,7 +133,7 @@ describe 'User views a wiki page' do it 'opens a default wiki page', :js do visit(project_path(project)) - find('.shortcuts-wiki').trigger('click') + find('.shortcuts-wiki').click expect(page).to have_content('Home · Create Page') end diff --git a/spec/features/search/user_searches_for_code_spec.rb b/spec/features/search/user_searches_for_code_spec.rb index 0ed797a62ea..77212fb105b 100644 --- a/spec/features/search/user_searches_for_code_spec.rb +++ b/spec/features/search/user_searches_for_code_spec.rb @@ -32,14 +32,14 @@ describe 'User searches for code' do include_examples 'top right search form' it 'finds code' do - find('.js-search-project-dropdown').trigger('click') + find('.js-search-project-dropdown').click page.within('.project-filter') do click_link(project.name_with_namespace) end fill_in('dashboard_search', with: 'rspec') - find('.btn-search').trigger('click') + find('.btn-search').click page.within('.results') do expect(find(:css, '.search-results')).to have_content('Update capybara, rspec-rails, poltergeist to recent versions') diff --git a/spec/features/search/user_searches_for_issues_spec.rb b/spec/features/search/user_searches_for_issues_spec.rb index 630a81b1c5e..ef9553f2a91 100644 --- a/spec/features/search/user_searches_for_issues_spec.rb +++ b/spec/features/search/user_searches_for_issues_spec.rb @@ -18,7 +18,7 @@ describe 'User searches for issues', :js do it 'finds an issue' do fill_in('dashboard_search', with: issue1.title) - find('.btn-search').trigger('click') + find('.btn-search').click page.within('.search-filter') do click_link('Issues') @@ -31,14 +31,14 @@ describe 'User searches for issues', :js do context 'when on a project page' do it 'finds an issue' do - find('.js-search-project-dropdown').trigger('click') + find('.js-search-project-dropdown').click page.within('.project-filter') do click_link(project.name_with_namespace) end fill_in('dashboard_search', with: issue1.title) - find('.btn-search').trigger('click') + find('.btn-search').click page.within('.search-filter') do click_link('Issues') @@ -62,7 +62,7 @@ describe 'User searches for issues', :js do it 'finds an issue' do fill_in('dashboard_search', with: issue1.title) - find('.btn-search').trigger('click') + find('.btn-search').click page.within('.search-filter') do click_link('Issues') diff --git a/spec/features/search/user_searches_for_merge_requests_spec.rb b/spec/features/search/user_searches_for_merge_requests_spec.rb index 116256682f4..3b6739aecbd 100644 --- a/spec/features/search/user_searches_for_merge_requests_spec.rb +++ b/spec/features/search/user_searches_for_merge_requests_spec.rb @@ -17,7 +17,7 @@ describe 'User searches for merge requests', :js do it 'finds a merge request' do fill_in('dashboard_search', with: merge_request1.title) - find('.btn-search').trigger('click') + find('.btn-search').click page.within('.search-filter') do click_link('Merge requests') @@ -30,14 +30,14 @@ describe 'User searches for merge requests', :js do context 'when on a project page' do it 'finds a merge request' do - find('.js-search-project-dropdown').trigger('click') + find('.js-search-project-dropdown').click page.within('.project-filter') do click_link(project.name_with_namespace) end fill_in('dashboard_search', with: merge_request1.title) - find('.btn-search').trigger('click') + find('.btn-search').click page.within('.search-filter') do click_link('Merge requests') diff --git a/spec/features/search/user_searches_for_milestones_spec.rb b/spec/features/search/user_searches_for_milestones_spec.rb index 4fa9fe9ce8c..6e197aee498 100644 --- a/spec/features/search/user_searches_for_milestones_spec.rb +++ b/spec/features/search/user_searches_for_milestones_spec.rb @@ -17,7 +17,7 @@ describe 'User searches for milestones', :js do it 'finds a milestone' do fill_in('dashboard_search', with: milestone1.title) - find('.btn-search').trigger('click') + find('.btn-search').click page.within('.search-filter') do click_link('Milestones') @@ -30,14 +30,14 @@ describe 'User searches for milestones', :js do context 'when on a project page' do it 'finds a milestone' do - find('.js-search-project-dropdown').trigger('click') + find('.js-search-project-dropdown').click page.within('.project-filter') do click_link(project.name_with_namespace) end fill_in('dashboard_search', with: milestone1.title) - find('.btn-search').trigger('click') + find('.btn-search').click page.within('.search-filter') do click_link('Milestones') -- cgit v1.2.1 From 8dd750e4f7bf599e5a65f14c14aec9236cae4220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 15 Sep 2017 13:25:12 +0200 Subject: Fix the default branches sorting to actually be 'Last updated' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- .../projects/branches/download_buttons_spec.rb | 2 +- spec/features/projects/branches_spec.rb | 96 ++--------- spec/features/protected_branches_spec.rb | 184 ++++++++++++++------- 3 files changed, 136 insertions(+), 146 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/branches/download_buttons_spec.rb b/spec/features/projects/branches/download_buttons_spec.rb index ad06cee4e81..2f407b13c2f 100644 --- a/spec/features/projects/branches/download_buttons_spec.rb +++ b/spec/features/projects/branches/download_buttons_spec.rb @@ -29,7 +29,7 @@ feature 'Download buttons in branches page' do describe 'when checking branches' do context 'with artifacts' do before do - visit project_branches_path(project) + visit project_branches_path(project, search: 'binary-encoding') end scenario 'shows download artifacts button' do diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index ad4527a0b74..d1f5623554d 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -5,12 +5,6 @@ describe 'Branches' do let(:project) { create(:project, :public, :repository) } let(:repository) { project.repository } - def set_protected_branch_name(branch_name) - find(".js-protected-branch-select").click - find(".dropdown-input-field").set(branch_name) - click_on("Create wildcard #{branch_name}") - end - context 'logged in as developer' do before do sign_in(user) @@ -18,12 +12,10 @@ describe 'Branches' do end describe 'Initial branches page' do - it 'shows all the branches' do + it 'shows all the branches sorted by last updated by default' do visit project_branches_path(project) - repository.branches_sorted_by(:name).first(20).each do |branch| - expect(page).to have_content("#{branch.name}") - end + expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :updated_desc)) end it 'sorts the branches by name' do @@ -32,22 +24,7 @@ describe 'Branches' do click_button "Last updated" # Open sorting dropdown click_link "Name" - sorted = repository.branches_sorted_by(:name).first(20).map do |branch| - Regexp.escape(branch.name) - end - expect(page).to have_content(/#{sorted.join(".*")}/) - end - - it 'sorts the branches by last updated' do - visit project_branches_path(project) - - click_button "Last updated" # Open sorting dropdown - click_link "Last updated" - - sorted = repository.branches_sorted_by(:updated_desc).first(20).map do |branch| - Regexp.escape(branch.name) - end - expect(page).to have_content(/#{sorted.join(".*")}/) + expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :name)) end it 'sorts the branches by oldest updated' do @@ -56,10 +33,7 @@ describe 'Branches' do click_button "Last updated" # Open sorting dropdown click_link "Oldest updated" - sorted = repository.branches_sorted_by(:updated_asc).first(20).map do |branch| - Regexp.escape(branch.name) - end - expect(page).to have_content(/#{sorted.join(".*")}/) + expect(page).to have_content(sorted_branches(repository, count: 20, sort_by: :updated_asc)) end it 'avoids a N+1 query in branches index' do @@ -99,28 +73,6 @@ describe 'Branches' do expect(find('.all-branches')).to have_selector('li', count: 0) end end - - describe 'Delete protected branch' do - before do - project.add_user(user, :master) - visit project_protected_branches_path(project) - set_protected_branch_name('fix') - click_on "Protect" - - within(".protected-branches-list") { expect(page).to have_content('fix') } - expect(ProtectedBranch.count).to eq(1) - project.add_user(user, :developer) - end - - it 'does not allow devleoper to removes protected branch', js: true do - visit project_branches_path(project) - - fill_in 'branch-search', with: 'fix' - find('#branch-search').native.send_keys(:enter) - - expect(page).to have_css('.btn-remove.disabled') - end - end end context 'logged in as master' do @@ -136,37 +88,6 @@ describe 'Branches' do expect(page).to have_content("Protected branches can be managed in project settings") end end - - describe 'Delete protected branch' do - before do - visit project_protected_branches_path(project) - set_protected_branch_name('fix') - click_on "Protect" - - within(".protected-branches-list") { expect(page).to have_content('fix') } - expect(ProtectedBranch.count).to eq(1) - end - - it 'removes branch after modal confirmation', js: true do - visit project_branches_path(project) - - fill_in 'branch-search', with: 'fix' - find('#branch-search').native.send_keys(:enter) - - expect(page).to have_content('fix') - expect(find('.all-branches')).to have_selector('li', count: 1) - page.find('[data-target="#modal-delete-branch"]').trigger(:click) - - expect(page).to have_css('.js-delete-branch[disabled]') - fill_in 'delete_branch_input', with: 'fix' - click_link 'Delete protected branch' - - fill_in 'branch-search', with: 'fix' - find('#branch-search').native.send_keys(:enter) - - expect(page).to have_content('No branches to show') - end - end end context 'logged out' do @@ -180,4 +101,13 @@ describe 'Branches' do end end end + + def sorted_branches(repository, count:, sort_by:) + sorted_branches = + repository.branches_sorted_by(sort_by).first(count).map do |branch| + Regexp.escape(branch.name) + end + + Regexp.new(sorted_branches.join('.*')) + end end diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index 3677bf38724..bf9885f73bd 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -1,93 +1,153 @@ require 'spec_helper' -feature 'Protected Branches', js: true do - let(:user) { create(:user, :admin) } +feature 'Protected Branches', :js do + let(:user) { create(:user) } + let(:admin) { create(:admin) } let(:project) { create(:project, :repository) } - before do - sign_in(user) - end + context 'logged in as developer' do + before do + project.add_developer(user) + sign_in(user) + end - def set_protected_branch_name(branch_name) - find(".js-protected-branch-select").trigger('click') - find(".dropdown-input-field").set(branch_name) - click_on("Create wildcard #{branch_name}") - end + describe 'Delete protected branch' do + before do + create(:protected_branch, project: project, name: 'fix') + expect(ProtectedBranch.count).to eq(1) + end + + it 'does not allow developer to removes protected branch' do + visit project_branches_path(project) + + fill_in 'branch-search', with: 'fix' + find('#branch-search').native.send_keys(:enter) - describe "explicit protected branches" do - it "allows creating explicit protected branches" do - visit project_protected_branches_path(project) - set_protected_branch_name('some-branch') - click_on "Protect" + expect(page).to have_css('.btn-remove.disabled') + end + end + end - within(".protected-branches-list") { expect(page).to have_content('some-branch') } - expect(ProtectedBranch.count).to eq(1) - expect(ProtectedBranch.last.name).to eq('some-branch') + context 'logged in as master' do + before do + project.add_master(user) + sign_in(user) end - it "displays the last commit on the matching branch if it exists" do - commit = create(:commit, project: project) - project.repository.add_branch(user, 'some-branch', commit.id) + describe 'Delete protected branch' do + before do + create(:protected_branch, project: project, name: 'fix') + expect(ProtectedBranch.count).to eq(1) + end - visit project_protected_branches_path(project) - set_protected_branch_name('some-branch') - click_on "Protect" + it 'removes branch after modal confirmation' do + visit project_branches_path(project) - within(".protected-branches-list") { expect(page).to have_content(commit.id[0..7]) } - end + fill_in 'branch-search', with: 'fix' + find('#branch-search').native.send_keys(:enter) - it "displays an error message if the named branch does not exist" do - visit project_protected_branches_path(project) - set_protected_branch_name('some-branch') - click_on "Protect" + expect(page).to have_content('fix') + expect(find('.all-branches')).to have_selector('li', count: 1) + page.find('[data-target="#modal-delete-branch"]').trigger(:click) - within(".protected-branches-list") { expect(page).to have_content('branch was removed') } + expect(page).to have_css('.js-delete-branch[disabled]') + fill_in 'delete_branch_input', with: 'fix' + click_link 'Delete protected branch' + + fill_in 'branch-search', with: 'fix' + find('#branch-search').native.send_keys(:enter) + + expect(page).to have_content('No branches to show') + end end end - describe "wildcard protected branches" do - it "allows creating protected branches with a wildcard" do - visit project_protected_branches_path(project) - set_protected_branch_name('*-stable') - click_on "Protect" - - within(".protected-branches-list") { expect(page).to have_content('*-stable') } - expect(ProtectedBranch.count).to eq(1) - expect(ProtectedBranch.last.name).to eq('*-stable') + context 'logged in as admin' do + before do + sign_in(admin) end - it "displays the number of matching branches" do - project.repository.add_branch(user, 'production-stable', 'master') - project.repository.add_branch(user, 'staging-stable', 'master') + describe "explicit protected branches" do + it "allows creating explicit protected branches" do + visit project_protected_branches_path(project) + set_protected_branch_name('some-branch') + click_on "Protect" - visit project_protected_branches_path(project) - set_protected_branch_name('*-stable') - click_on "Protect" + within(".protected-branches-list") { expect(page).to have_content('some-branch') } + expect(ProtectedBranch.count).to eq(1) + expect(ProtectedBranch.last.name).to eq('some-branch') + end - within(".protected-branches-list") { expect(page).to have_content("2 matching branches") } + it "displays the last commit on the matching branch if it exists" do + commit = create(:commit, project: project) + project.repository.add_branch(admin, 'some-branch', commit.id) + + visit project_protected_branches_path(project) + set_protected_branch_name('some-branch') + click_on "Protect" + + within(".protected-branches-list") { expect(page).to have_content(commit.id[0..7]) } + end + + it "displays an error message if the named branch does not exist" do + visit project_protected_branches_path(project) + set_protected_branch_name('some-branch') + click_on "Protect" + + within(".protected-branches-list") { expect(page).to have_content('branch was removed') } + end end - it "displays all the branches matching the wildcard" do - project.repository.add_branch(user, 'production-stable', 'master') - project.repository.add_branch(user, 'staging-stable', 'master') - project.repository.add_branch(user, 'development', 'master') + describe "wildcard protected branches" do + it "allows creating protected branches with a wildcard" do + visit project_protected_branches_path(project) + set_protected_branch_name('*-stable') + click_on "Protect" + + within(".protected-branches-list") { expect(page).to have_content('*-stable') } + expect(ProtectedBranch.count).to eq(1) + expect(ProtectedBranch.last.name).to eq('*-stable') + end - visit project_protected_branches_path(project) - set_protected_branch_name('*-stable') - click_on "Protect" + it "displays the number of matching branches" do + project.repository.add_branch(admin, 'production-stable', 'master') + project.repository.add_branch(admin, 'staging-stable', 'master') - visit project_protected_branches_path(project) - click_on "2 matching branches" + visit project_protected_branches_path(project) + set_protected_branch_name('*-stable') + click_on "Protect" - within(".protected-branches-list") do - expect(page).to have_content("production-stable") - expect(page).to have_content("staging-stable") - expect(page).not_to have_content("development") + within(".protected-branches-list") { expect(page).to have_content("2 matching branches") } end + + it "displays all the branches matching the wildcard" do + project.repository.add_branch(admin, 'production-stable', 'master') + project.repository.add_branch(admin, 'staging-stable', 'master') + project.repository.add_branch(admin, 'development', 'master') + + visit project_protected_branches_path(project) + set_protected_branch_name('*-stable') + click_on "Protect" + + visit project_protected_branches_path(project) + click_on "2 matching branches" + + within(".protected-branches-list") do + expect(page).to have_content("production-stable") + expect(page).to have_content("staging-stable") + expect(page).not_to have_content("development") + end + end + end + + describe "access control" do + include_examples "protected branches > access control > CE" end end - describe "access control" do - include_examples "protected branches > access control > CE" + def set_protected_branch_name(branch_name) + find(".js-protected-branch-select").trigger('click') + find(".dropdown-input-field").set(branch_name) + click_on("Create wildcard #{branch_name}") end end -- cgit v1.2.1 From ca980de374d078ceb4baea257b1bdc6224b13c30 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Thu, 21 Sep 2017 21:18:43 -0700 Subject: Fix specs --- spec/features/issues/bulk_assignment_labels_spec.rb | 2 +- spec/features/issues/update_issues_spec.rb | 2 +- spec/features/merge_requests/update_merge_requests_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/bulk_assignment_labels_spec.rb b/spec/features/issues/bulk_assignment_labels_spec.rb index b2229b44f99..a89dcdf41dc 100644 --- a/spec/features/issues/bulk_assignment_labels_spec.rb +++ b/spec/features/issues/bulk_assignment_labels_spec.rb @@ -405,7 +405,7 @@ feature 'Issues > Labels bulk assignment' do end def update_issues - click_button 'Update all' + find('.update-selected-issues').trigger('click') wait_for_requests end diff --git a/spec/features/issues/update_issues_spec.rb b/spec/features/issues/update_issues_spec.rb index bcc6e9bab0f..1f57c110c11 100644 --- a/spec/features/issues/update_issues_spec.rb +++ b/spec/features/issues/update_issues_spec.rb @@ -118,7 +118,7 @@ feature 'Multiple issue updating from issues#index', :js do end def click_update_issues_button - find('.update-selected-issues').click + find('.update-selected-issues').trigger('click') wait_for_requests end end diff --git a/spec/features/merge_requests/update_merge_requests_spec.rb b/spec/features/merge_requests/update_merge_requests_spec.rb index e6dc284cba7..9cb8a357309 100644 --- a/spec/features/merge_requests/update_merge_requests_spec.rb +++ b/spec/features/merge_requests/update_merge_requests_spec.rb @@ -127,7 +127,7 @@ feature 'Multiple merge requests updating from merge_requests#index' do end def click_update_merge_requests_button - find('.update-selected-issues').click + find('.update-selected-issues').trigger('click') wait_for_requests end end -- cgit v1.2.1 From 4971b85a52ccbca3ebd7ac3516d78b2fd94b0aec Mon Sep 17 00:00:00 2001 From: Jarka Kadlecova Date: Thu, 7 Sep 2017 17:53:52 +0200 Subject: add feature specs for discussion lock --- spec/features/issuables/discussion_lock_spec.rb | 106 +++++++++++++++++++++ .../merge_requests/discussion_lock_spec.rb | 49 ++++++++++ 2 files changed, 155 insertions(+) create mode 100644 spec/features/issuables/discussion_lock_spec.rb create mode 100644 spec/features/merge_requests/discussion_lock_spec.rb (limited to 'spec/features') diff --git a/spec/features/issuables/discussion_lock_spec.rb b/spec/features/issuables/discussion_lock_spec.rb new file mode 100644 index 00000000000..1c54293de93 --- /dev/null +++ b/spec/features/issuables/discussion_lock_spec.rb @@ -0,0 +1,106 @@ +require 'spec_helper' + +describe 'Discussion Lock', :js do + let(:user) { create(:user) } + let(:issue) { create(:issue, project: project, author: user) } + let(:project) { create(:project, :public) } + + before do + sign_in(user) + end + + context 'when a user is a team member' do + before do + project.add_developer(user) + end + + context 'when the discussion is unlocked' do + it 'the user can lock the issue' do + visit project_issue_path(project, issue) + + expect(find('.issuable-sidebar')).to have_content('Unlocked') + + page.within('.issuable-sidebar') do + find('.lock-edit').click + click_button('Lock') + end + + expect(find('#notes')).to have_content('locked this issue') + end + end + + context 'when the discussion is locked' do + before do + issue.update_attribute(:discussion_locked, true) + visit project_issue_path(project, issue) + end + + it 'the user can unlock the issue' do + expect(find('.issuable-sidebar')).to have_content('Locked') + + page.within('.issuable-sidebar') do + find('.lock-edit').click + click_button('Unlock') + end + + expect(find('#notes')).to have_content('unlocked this issue') + expect(find('.issuable-sidebar')).to have_content('Unlocked') + end + + it 'the user can create a comment' do + page.within('#notes .js-main-target-form') do + fill_in 'note[note]', with: 'Some new comment' + click_button 'Comment' + end + + wait_for_requests + + expect(find('div#notes')).to have_content('Some new comment') + end + end + end + + context 'when a user is not a team member' do + context 'when the discussion is unlocked' do + before do + visit project_issue_path(project, issue) + end + + it 'the user can not lock the issue' do + expect(find('.issuable-sidebar')).to have_content('Unlocked') + expect(find('.issuable-sidebar')).not_to have_selector('.lock-edit') + end + + it 'the user can create a comment' do + page.within('#notes .js-main-target-form') do + fill_in 'note[note]', with: 'Some new comment' + click_button 'Comment' + end + + wait_for_requests + + expect(find('div#notes')).to have_content('Some new comment') + end + end + + context 'when the discussion is locked' do + before do + issue.update_attribute(:discussion_locked, true) + visit project_issue_path(project, issue) + end + + it 'the user can not unlock the issue' do + expect(find('.issuable-sidebar')).to have_content('Locked') + expect(find('.issuable-sidebar')).not_to have_selector('.lock-edit') + end + + it 'the user can not create a comment' do + page.within('#notes') do + expect(page).not_to have_selector('js-main-target-form') + expect(page.find('.disabled-comment')). + to have_content('This issue is locked. Only project members can comment.') + end + end + end + end +end diff --git a/spec/features/merge_requests/discussion_lock_spec.rb b/spec/features/merge_requests/discussion_lock_spec.rb new file mode 100644 index 00000000000..85fd221a567 --- /dev/null +++ b/spec/features/merge_requests/discussion_lock_spec.rb @@ -0,0 +1,49 @@ +require 'spec_helper' + +describe 'Discussion Lock', :js do + let(:user) { create(:user) } + let(:merge_request) { create(:merge_request, source_project: project, author: user) } + let(:project) { create(:project, :public, :repository) } + + before do + sign_in(user) + end + + context 'when the discussion is locked' do + before do + merge_request.update_attribute(:discussion_locked, true) + end + + context 'when a user is a team member' do + before do + project.add_developer(user) + visit project_merge_request_path(project, merge_request) + end + + it 'the user can create a comment' do + page.within('.issuable-discussion #notes .js-main-target-form') do + fill_in 'note[note]', with: 'Some new comment' + click_button 'Comment' + end + + wait_for_requests + + expect(find('.issuable-discussion #notes')).to have_content('Some new comment') + end + end + + context 'when a user is not a team member' do + before do + visit project_merge_request_path(project, merge_request) + end + + it 'the user can not create a comment' do + page.within('.issuable-discussion #notes') do + expect(page).not_to have_selector('js-main-target-form') + expect(page.find('.disabled-comment')). + to have_content('This merge request is locked. Only project members can comment.') + end + end + end + end +end -- cgit v1.2.1 From 0ed23790a43a0fd5001773937c66a06533f60c6c Mon Sep 17 00:00:00 2001 From: James Ramsay Date: Mon, 25 Sep 2017 16:02:08 -0400 Subject: Fix spelling of occurred --- spec/features/issues/filtered_search/recent_searches_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/issues/filtered_search/recent_searches_spec.rb b/spec/features/issues/filtered_search/recent_searches_spec.rb index 5eeecaeda47..447281ed19d 100644 --- a/spec/features/issues/filtered_search/recent_searches_spec.rb +++ b/spec/features/issues/filtered_search/recent_searches_spec.rb @@ -104,6 +104,6 @@ describe 'Recent searches', js: true do set_recent_searches(project_1_local_storage_key, 'fail') visit project_issues_path(project_1) - expect(find('.flash-alert')).to have_text('An error occured while parsing recent searches') + expect(find('.flash-alert')).to have_text('An error occurred while parsing recent searches') end end -- cgit v1.2.1 From 299213dd01b959b82952284194ea844c33b5a691 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Tue, 26 Sep 2017 10:30:26 -0500 Subject: Replaced trigger calls for click, fixed click_on call --- spec/features/projects/features_visibility_spec.rb | 4 ++-- spec/features/search/user_uses_search_filters_spec.rb | 6 +++--- spec/features/snippets/notes_on_personal_snippets_spec.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index 57722276d79..e05b1ce225a 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -22,7 +22,7 @@ describe 'Edit Project Settings' do # disable by clicking toggle toggle_feature_off("project[project_feature_attributes][#{tool_name}_access_level]") page.within('.sharing-permissions') do - click_button 'Save changes' + find('input[value="Save changes"]').click end wait_for_requests expect(page).not_to have_selector(".shortcuts-#{shortcut_name}") @@ -30,7 +30,7 @@ describe 'Edit Project Settings' do # re-enable by clicking toggle again toggle_feature_on("project[project_feature_attributes][#{tool_name}_access_level]") page.within('.sharing-permissions') do - click_button 'Save changes' + find('input[value="Save changes"]').click end wait_for_requests expect(page).to have_selector(".shortcuts-#{shortcut_name}") diff --git a/spec/features/search/user_uses_search_filters_spec.rb b/spec/features/search/user_uses_search_filters_spec.rb index 95f3eb5e805..aa883c964d2 100644 --- a/spec/features/search/user_uses_search_filters_spec.rb +++ b/spec/features/search/user_uses_search_filters_spec.rb @@ -16,7 +16,7 @@ describe 'User uses search filters', :js do context' when filtering by group' do it 'shows group projects' do - find('.js-search-group-dropdown').trigger('click') + find('.js-search-group-dropdown').click wait_for_requests @@ -27,7 +27,7 @@ describe 'User uses search filters', :js do expect(find('.js-search-group-dropdown')).to have_content(group.name) page.within('.project-filter') do - find('.js-search-project-dropdown').trigger('click') + find('.js-search-project-dropdown').click wait_for_requests @@ -39,7 +39,7 @@ describe 'User uses search filters', :js do context' when filtering by project' do it 'shows a project' do page.within('.project-filter') do - find('.js-search-project-dropdown').trigger('click') + find('.js-search-project-dropdown').click wait_for_requests diff --git a/spec/features/snippets/notes_on_personal_snippets_spec.rb b/spec/features/snippets/notes_on_personal_snippets_spec.rb index e842af39376..d089fb5b730 100644 --- a/spec/features/snippets/notes_on_personal_snippets_spec.rb +++ b/spec/features/snippets/notes_on_personal_snippets_spec.rb @@ -88,7 +88,7 @@ describe 'Comments on personal snippets', :js do context 'when editing a note' do it 'changes the text' do - find('.js-note-edit').trigger('click') + find('.js-note-edit').click page.within('.current-note-edit-form') do fill_in 'note[note]', with: 'new content' -- cgit v1.2.1 From 7fb477325eb7f1215a6ae128c9a3a300606d7fbe Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Tue, 26 Sep 2017 12:11:22 -0500 Subject: fixed users_spec --- spec/features/users_spec.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'spec/features') diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index 15b89dac572..bf1dd7cc073 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -24,6 +24,7 @@ feature 'Users', js: true do user.reload expect(user.reset_password_token).not_to be_nil + find('a[href="#login-pane"]').click gitlab_sign_in(user) expect(current_path).to eq root_path -- cgit v1.2.1 From 59d631371ce22e702791504a544c1be61fceb676 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 26 Sep 2017 15:03:24 -0500 Subject: Add test to check for project settings merge strategies --- spec/features/projects/project_settings_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'spec/features') diff --git a/spec/features/projects/project_settings_spec.rb b/spec/features/projects/project_settings_spec.rb index 5d77cd1ccd5..8dc94b3d549 100644 --- a/spec/features/projects/project_settings_spec.rb +++ b/spec/features/projects/project_settings_spec.rb @@ -32,6 +32,24 @@ describe 'Edit Project Settings' do end end + describe 'Merge request settings section' do + it 'shows "Merge commit" strategy' do + visit edit_project_path(project) + + page.within '.merge-requests-feature' do + expect(page).to have_content 'Merge commit' + end + end + + it 'shows "Fast-forward merge" strategy' do + visit edit_project_path(project) + + page.within '.merge-requests-feature' do + expect(page).to have_content 'Fast-forward merge' + end + end + end + describe 'Rename repository section' do context 'with invalid characters' do it 'shows errors for invalid project path/name' do -- cgit v1.2.1 From eb0c7092869ac2eb0782f60d6935f0dc3fe33501 Mon Sep 17 00:00:00 2001 From: Jarka Kadlecova Date: Wed, 27 Sep 2017 08:30:40 +0200 Subject: fix code style --- spec/features/issuables/discussion_lock_spec.rb | 4 ++-- spec/features/merge_requests/discussion_lock_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issuables/discussion_lock_spec.rb b/spec/features/issuables/discussion_lock_spec.rb index 1c54293de93..7ea29ff252b 100644 --- a/spec/features/issuables/discussion_lock_spec.rb +++ b/spec/features/issuables/discussion_lock_spec.rb @@ -97,8 +97,8 @@ describe 'Discussion Lock', :js do it 'the user can not create a comment' do page.within('#notes') do expect(page).not_to have_selector('js-main-target-form') - expect(page.find('.disabled-comment')). - to have_content('This issue is locked. Only project members can comment.') + expect(page.find('.disabled-comment')) + .to have_content('This issue is locked. Only project members can comment.') end end end diff --git a/spec/features/merge_requests/discussion_lock_spec.rb b/spec/features/merge_requests/discussion_lock_spec.rb index 85fd221a567..7bbd3b1e69e 100644 --- a/spec/features/merge_requests/discussion_lock_spec.rb +++ b/spec/features/merge_requests/discussion_lock_spec.rb @@ -40,8 +40,8 @@ describe 'Discussion Lock', :js do it 'the user can not create a comment' do page.within('.issuable-discussion #notes') do expect(page).not_to have_selector('js-main-target-form') - expect(page.find('.disabled-comment')). - to have_content('This merge request is locked. Only project members can comment.') + expect(page.find('.disabled-comment')) + .to have_content('This merge request is locked. Only project members can comment.') end end end -- cgit v1.2.1 From c01338cba55ae6e32c4f8801d727e4c2c52ec1c9 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 11:10:58 +0100 Subject: fixed spec/features/u2f_spec.rb a lot of failures where because everything happens faster than rspec can detect on the page --- spec/features/u2f_spec.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/u2f_spec.rb b/spec/features/u2f_spec.rb index 915d90859ba..8178e4144f1 100644 --- a/spec/features/u2f_spec.rb +++ b/spec/features/u2f_spec.rb @@ -191,7 +191,6 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do # Try authenticating user with the old U2F device gitlab_sign_in(current_user) @u2f_device.respond_to_u2f_authentication - expect(page).to have_content('We heard back from your U2F device') expect(page).to have_content('Authentication via U2F device failed') end end @@ -209,7 +208,6 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do # Try authenticating user with the same U2F device gitlab_sign_in(current_user) @u2f_device.respond_to_u2f_authentication - expect(page).to have_content('We heard back from your U2F device') expect(page).to have_css('.sign-out-link', visible: false) end @@ -221,7 +219,6 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do unregistered_device = FakeU2fDevice.new(page, 'My device') gitlab_sign_in(user) unregistered_device.respond_to_u2f_authentication - expect(page).to have_content('We heard back from your U2F device') expect(page).to have_content('Authentication via U2F device failed') end @@ -246,7 +243,6 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do [first_device, second_device].each do |device| gitlab_sign_in(user) device.respond_to_u2f_authentication - expect(page).to have_content('We heard back from your U2F device') expect(page).to have_css('.sign-out-link', visible: false) @@ -269,7 +265,9 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do it "deletes u2f registrations" do visit profile_account_path - expect { click_on "Disable" }.to change { U2fRegistration.count }.by(-1) + expect do + accept_confirm { click_on "Disable" } + end.to change{ U2fRegistration.count }.by(-1) end end end -- cgit v1.2.1 From 54a6bcae954c08c890c66452d7d34d5393227e7d Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 12:08:31 +0100 Subject: fixed spec/features/projects/files/edit_file_soft_wrap_spec.rb --- .../projects/files/edit_file_soft_wrap_spec.rb | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/files/edit_file_soft_wrap_spec.rb b/spec/features/projects/files/edit_file_soft_wrap_spec.rb index c7e3f657639..5639be19364 100644 --- a/spec/features/projects/files/edit_file_soft_wrap_spec.rb +++ b/spec/features/projects/files/edit_file_soft_wrap_spec.rb @@ -7,18 +7,18 @@ feature 'User uses soft wrap whilst editing file', js: true do project.team << [user, :master] sign_in user visit project_new_blob_path(project, 'master', file_name: 'test_file-name') - editor = find('.file-editor.code') - editor.click - editor.send_keys 'Touch water with paw then recoil in horror chase dog then - run away chase the pig around the house eat owner\'s food, and knock - dish off table head butt cant eat out of my own dish. Cat is love, cat - is life rub face on everything poop on grasses so meow. Playing with - balls of wool flee in terror at cucumber discovered on floor run in - circles tuxedo cats always looking dapper, but attack dog, run away - and pretend to be victim so all of a sudden cat goes crazy, yet chase - laser. Make muffins sit in window and stare ooo, a bird! yum lick yarn - hanging out of own butt jump off balcony, onto stranger\'s head yet - chase laser. Purr for no reason stare at ceiling hola te quiero.'.squish + page.within('.file-editor.code') do + find('.ace_text-input', visible: false).send_keys 'Touch water with paw then recoil in horror chase dog then + run away chase the pig around the house eat owner\'s food, and knock + dish off table head butt cant eat out of my own dish. Cat is love, cat + is life rub face on everything poop on grasses so meow. Playing with + balls of wool flee in terror at cucumber discovered on floor run in + circles tuxedo cats always looking dapper, but attack dog, run away + and pretend to be victim so all of a sudden cat goes crazy, yet chase + laser. Make muffins sit in window and stare ooo, a bird! yum lick yarn + hanging out of own butt jump off balcony, onto stranger\'s head yet + chase laser. Purr for no reason stare at ceiling hola te quiero.'.squish + end end let(:toggle_button) { find('.soft-wrap-toggle') } @@ -36,6 +36,6 @@ feature 'User uses soft wrap whilst editing file', js: true do end def get_content_width - find('.ace_content')[:style].slice!(/width: \d+/).slice!(/\d+/) + find('.ace_content')[:style].slice!(/width: \d+/).slice!(/\d+/).to_i end end -- cgit v1.2.1 From d770b633ebcf3b5378031af6e02aebf1a75b8468 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 12:23:38 +0100 Subject: fixed spec/features/projects/settings/repository_settings_spec.rb --- spec/features/projects/settings/repository_settings_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 15180d4b498..3caf68dced4 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -34,7 +34,6 @@ feature 'Repository settings' do visit project_settings_repository_path(project) - expect(page.status_code).to eq(200) expect(page).to have_content('private_deploy_key') expect(page).to have_content('public_deploy_key') end @@ -86,7 +85,7 @@ feature 'Repository settings' do project.deploy_keys << private_deploy_key visit project_settings_repository_path(project) - find('li', text: private_deploy_key.title).click_button('Remove') + accept_confirm { find('li', text: private_deploy_key.title).click_button('Remove') } expect(page).not_to have_content(private_deploy_key.title) end -- cgit v1.2.1 From 92a3887c9a2977881c63a8e9eb9b85c1361f3d2d Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 12:28:34 +0100 Subject: fixed spec/features/issues/filtered_search/dropdown_assignee_spec.rb spec runs too fast so it doesn't match the first text. I think testing that the loading indicator is hidden is enough --- spec/features/issues/filtered_search/dropdown_assignee_spec.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb index 1c4649d0ba9..550a778bda1 100644 --- a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb @@ -51,7 +51,6 @@ describe 'Dropdown assignee', :js do it 'should hide loading indicator when loaded' do filtered_search.set('assignee:') - expect(find(js_dropdown_assignee)).to have_css('.filter-dropdown-loading') expect(find(js_dropdown_assignee)).not_to have_css('.filter-dropdown-loading') end -- cgit v1.2.1 From 9d48177c8e43a338e72d07d1fd92805f8e3313b4 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 12:34:41 +0100 Subject: fixed spec/features/admin/admin_users_spec.rb --- spec/features/admin/admin_users_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index e2e2b13cf8a..a4a9516a3e4 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -290,7 +290,7 @@ describe "Admin::Users" do it 'allows group membership to be revoked', js: true do page.within(first('.group_member')) do - find('.btn-remove').click + accept_confirm { find('.btn-remove').click } end wait_for_requests @@ -319,7 +319,7 @@ describe "Admin::Users" do expect(page).to have_content("Secondary email: #{secondary_email.email}") - find("#remove_email_#{secondary_email.id}").click + accept_confirm { find("#remove_email_#{secondary_email.id}").click } expect(page).not_to have_content(secondary_email.email) end -- cgit v1.2.1 From 7a090d59a347aa1daf44a20e0fba327bf47b0dce Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 12:36:05 +0100 Subject: fixed spec/features/admin/admin_groups_spec.rb --- spec/features/admin/admin_groups_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb index 3768727d8ae..cddd8d2a166 100644 --- a/spec/features/admin/admin_groups_spec.rb +++ b/spec/features/admin/admin_groups_spec.rb @@ -152,7 +152,7 @@ feature 'Admin Groups' do expect(page).to have_content('Developer') end - find(:css, 'li', text: current_user.name).find(:css, 'a.btn-remove').click + accept_confirm { find(:css, 'li', text: current_user.name).find(:css, 'a.btn-remove').click } visit group_group_members_path(group) -- cgit v1.2.1 From 27c00d2ed39eca9543502427380abc46ed7a8193 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 12:40:24 +0100 Subject: fixed spec/features/dashboard/groups_list_spec.rb --- spec/features/dashboard/groups_list_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index bb4f3d9ecb4..4c120b09345 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -74,14 +74,14 @@ feature 'Dashboard Groups page', :js do expect(page).not_to have_selector("#group-#{group.id} .fa-caret-right") # Collapse - find("#group-#{group.id}").click + find("#group-#{group.id} .folder-caret").click expect(page).not_to have_selector("#group-#{group.id} .fa-caret-down") expect(page).to have_selector("#group-#{group.id} .fa-caret-right", count: 1) expect(page).not_to have_selector("#group-#{group.id} #group-#{subgroup.id}") # Expand - find("#group-#{group.id}").click + find("#group-#{group.id} .folder-caret").click expect(page).to have_selector("#group-#{group.id} .fa-caret-down", count: 1) expect(page).not_to have_selector("#group-#{group.id} .fa-caret-right") -- cgit v1.2.1 From 1ec2486c83c55042caf1f8006187f6abde0056a4 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 12:50:38 +0100 Subject: fixed spec/features/projects/deploy_keys_spec.rb --- spec/features/projects/deploy_keys_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/deploy_keys_spec.rb b/spec/features/projects/deploy_keys_spec.rb index 2d1a9b931b5..1c1c25c932e 100644 --- a/spec/features/projects/deploy_keys_spec.rb +++ b/spec/features/projects/deploy_keys_spec.rb @@ -20,7 +20,7 @@ describe 'Project deploy keys', :js do page.within(find('.deploy-keys')) do expect(page).to have_selector('.deploy-keys li', count: 1) - click_on 'Remove' + accept_confirm { find(:button, text: 'Remove').click } expect(page).not_to have_selector('.fa-spinner', count: 0) expect(page).to have_selector('.deploy-keys li', count: 0) -- cgit v1.2.1 From 15b976c6141424d891e304d13be0a126c5e1265b Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 13:34:30 +0100 Subject: some fixes in spec/features/projects/jobs_spec.rb not sure how to fix the ones with headers :thinking: --- spec/features/projects/jobs_spec.rb | 4 ---- 1 file changed, 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 4848159c1f7..a0d36203366 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -380,7 +380,6 @@ feature 'Jobs' do end it 'loads the page and shows all needed controls' do - expect(page.status_code).to eq(200) expect(page).to have_content 'Retry' end end @@ -396,7 +395,6 @@ feature 'Jobs' do end it 'shows the right status and buttons', :js do - expect(page).to have_http_status(200) page.within('aside.right-sidebar') do expect(page).to have_content 'Cancel' end @@ -450,7 +448,6 @@ feature 'Jobs' do end it 'sends the right headers' do - expect(page.status_code).to eq(200) expect(page.response_headers['Content-Type']).to eq('text/plain; charset=utf-8') expect(page.response_headers['X-Sendfile']).to eq(job.trace.send(:current_path)) end @@ -490,7 +487,6 @@ feature 'Jobs' do end it 'sends the right headers' do - expect(page.status_code).to eq(200) expect(page.response_headers['Content-Type']).to eq('text/plain; charset=utf-8') expect(page.response_headers['X-Sendfile']).to eq(existing_file) end -- cgit v1.2.1 From 4a6133620779e997b1e3759f68ecfd7fddc4af2f Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 13:36:08 +0100 Subject: fixed spec/features/issues/filtered_search/dropdown_milestone_spec.rb --- spec/features/issues/filtered_search/dropdown_milestone_spec.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb index f6c2e952bea..8536686e611 100644 --- a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb @@ -58,7 +58,6 @@ describe 'Dropdown milestone', :js do it 'should hide loading indicator when loaded' do filtered_search.set('milestone:') - expect(find(js_dropdown_milestone)).to have_css('.filter-dropdown-loading') expect(find(js_dropdown_milestone)).not_to have_css('.filter-dropdown-loading') end -- cgit v1.2.1 From d2561680d04e18669f08182d3d03512d99310c97 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 13:43:44 +0100 Subject: fixed spec/features/merge_requests/versions_spec.rb --- spec/features/merge_requests/versions_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/versions_spec.rb b/spec/features/merge_requests/versions_spec.rb index 6669522dd7a..1de277fe4f9 100644 --- a/spec/features/merge_requests/versions_spec.rb +++ b/spec/features/merge_requests/versions_spec.rb @@ -67,7 +67,7 @@ feature 'Merge Request versions', js: true do line_code = '7445606fbf8f3683cd42bdc54b05d7a0bc2dfc44_2_2' page.within(diff_file_selector) do - find(".line_holder[id='#{line_code}'] td:nth-of-type(1)").trigger 'mouseover' + find(".line_holder[id='#{line_code}'] td:nth-of-type(1)").hover find(".line_holder[id='#{line_code}'] button").click page.within("form[data-line-code='#{line_code}']") do @@ -137,7 +137,7 @@ feature 'Merge Request versions', js: true do line_code = '7445606fbf8f3683cd42bdc54b05d7a0bc2dfc44_4_4' page.within(diff_file_selector) do - find(".line_holder[id='#{line_code}'] td:nth-of-type(1)").trigger 'mouseover' + find(".line_holder[id='#{line_code}'] td:nth-of-type(1)").hover find(".line_holder[id='#{line_code}'] button").click page.within("form[data-line-code='#{line_code}']") do -- cgit v1.2.1 From 45da02f9abb0406130e7c3b6a480fa847e4e6ad9 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 13:46:48 +0100 Subject: fixed spec/features/merge_requests/user_posts_notes_spec.rb --- spec/features/merge_requests/user_posts_notes_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/user_posts_notes_spec.rb b/spec/features/merge_requests/user_posts_notes_spec.rb index d7cda73ab40..f4c75a2f265 100644 --- a/spec/features/merge_requests/user_posts_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_notes_spec.rb @@ -141,7 +141,7 @@ describe 'Merge requests > User posts notes', :js do end it 'removes the attachment div and resets the edit form' do - find('.js-note-attachment-delete').click + accept_confirm { find('.js-note-attachment-delete').click } is_expected.not_to have_css('.note-attachment') is_expected.not_to have_css('.current-note-edit-form') wait_for_requests -- cgit v1.2.1 From fe24c0a875fa1d6f561a5b228cf71d0c9da671af Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 15:38:13 +0100 Subject: Fixes commit comments in side-by-side diff view This was caused by the `notes` global class not existing when the `file_comment_button` code is run. The notes class was used to check if the diff is currently in parallel view or not. To get around this I've added a check into the `file_comment_button` JS to check if the view is currently parallel or not. Closes #38117 --- spec/features/projects/commit/diff_notes_spec.rb | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 spec/features/projects/commit/diff_notes_spec.rb (limited to 'spec/features') diff --git a/spec/features/projects/commit/diff_notes_spec.rb b/spec/features/projects/commit/diff_notes_spec.rb new file mode 100644 index 00000000000..f0fe4e00acc --- /dev/null +++ b/spec/features/projects/commit/diff_notes_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +feature 'Commit diff', :js do + include RepoHelpers + + let(:user) { create(:user) } + let(:project) { create(:project, :public, :repository) } + + before do + project.add_master(user) + sign_in user + end + + %w(inline parallel).each do |view| + context "#{view} view" do + before do + visit project_commit_path(project, sample_commit.id, view: view) + end + + it "adds comment to diff" do + diff_line_num = first('.diff-line-num.new') + + diff_line_num.trigger('mouseover') + diff_line_num.find('.js-add-diff-note-button').trigger('click') + + page.within(first('.diff-viewer')) do + find('.js-note-text').set 'test comment' + + click_button 'Comment' + + expect(page).to have_content('test comment') + end + end + end + end +end -- cgit v1.2.1 From 05844d8b471b98c6b3251006aebfc78b97d88ac6 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 16:22:12 +0100 Subject: Fixed breadcrumb title not linking This fixes the breadcrumb titles not having links. This was a regression in the updated breadcrumbs introduced in 10.0. This introduces the link for all pages rather than selectively doing it. This will cover issues, merge requests, pipelines, jobs etc. Closes #38059 --- spec/features/issues_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/features') diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index fb763c93c66..b4222edbcd0 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -131,6 +131,14 @@ describe 'Issues' do end describe 'Issue info' do + it 'links to current issue in breadcrubs' do + issue = create(:issue, project: project) + + visit project_issue_path(project, issue) + + expect(find('.breadcrumbs-sub-title a')[:href]).to end_with(issue_path(issue)) + end + it 'excludes award_emoji from comment count' do issue = create(:issue, author: user, assignees: [user], project: project, title: 'foobar') create(:award_emoji, awardable: issue) -- cgit v1.2.1 From 5072ecc67b8f20cfa9f212883674c732d3ea8dd6 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Wed, 27 Sep 2017 13:13:07 -0500 Subject: Replaced trigger click calls for click, also fixed ace_editor-input test --- spec/features/issues/update_issues_spec.rb | 2 +- spec/features/merge_requests/update_merge_requests_spec.rb | 2 +- spec/features/snippets/user_creates_snippet_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/update_issues_spec.rb b/spec/features/issues/update_issues_spec.rb index 1f57c110c11..bcc6e9bab0f 100644 --- a/spec/features/issues/update_issues_spec.rb +++ b/spec/features/issues/update_issues_spec.rb @@ -118,7 +118,7 @@ feature 'Multiple issue updating from issues#index', :js do end def click_update_issues_button - find('.update-selected-issues').trigger('click') + find('.update-selected-issues').click wait_for_requests end end diff --git a/spec/features/merge_requests/update_merge_requests_spec.rb b/spec/features/merge_requests/update_merge_requests_spec.rb index 9cb8a357309..e6dc284cba7 100644 --- a/spec/features/merge_requests/update_merge_requests_spec.rb +++ b/spec/features/merge_requests/update_merge_requests_spec.rb @@ -127,7 +127,7 @@ feature 'Multiple merge requests updating from merge_requests#index' do end def click_update_merge_requests_button - find('.update-selected-issues').trigger('click') + find('.update-selected-issues').click wait_for_requests end end diff --git a/spec/features/snippets/user_creates_snippet_spec.rb b/spec/features/snippets/user_creates_snippet_spec.rb index 0b9ad37f0e9..1c73b86c5fb 100644 --- a/spec/features/snippets/user_creates_snippet_spec.rb +++ b/spec/features/snippets/user_creates_snippet_spec.rb @@ -14,7 +14,7 @@ feature 'User creates snippet', :js do fill_in 'personal_snippet_title', with: 'My Snippet Title' fill_in 'personal_snippet_description', with: 'My Snippet **Description**' page.within('.file-editor') do - find('.ace_text-input').native.send_keys 'Hello World!' + find('.ace_text-input', visible: false).send_keys 'Hello World!' end end @@ -94,7 +94,7 @@ feature 'User creates snippet', :js do fill_in 'personal_snippet_title', with: 'My Snippet Title' page.within('.file-editor') do find(:xpath, "//input[@id='personal_snippet_file_name']").set 'snippet+file+name' - find('.ace_text-input').native.send_keys 'Hello World!' + find('.ace_text-input', visible: false).send_keys 'Hello World!' end click_button 'Create snippet' -- cgit v1.2.1 From d0737b18856170d054c9235cd285d3eb5e45056b Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 28 Sep 2017 09:30:33 +0100 Subject: spec fixes --- spec/features/projects/wiki/user_updates_wiki_page_spec.rb | 2 +- spec/features/projects/wiki/user_views_wiki_page_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb index 1cf14204159..949d90a50ff 100644 --- a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb @@ -40,7 +40,7 @@ describe 'User updates wiki page' do expect(current_path).to include('one/two/three-test') expect(find('.wiki-pages')).to have_content('Three') - click_on('Three') + first(:link, text: 'Three').click expect(find('.nav-text')).to have_content('Three') diff --git a/spec/features/projects/wiki/user_views_wiki_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_page_spec.rb index d201d4f6b98..49ba2969ef0 100644 --- a/spec/features/projects/wiki/user_views_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_page_spec.rb @@ -34,7 +34,7 @@ describe 'User views a wiki page' do it 'shows the history of a page that has a path', :js do expect(current_path).to include('one/two/three-test') - click_on('Three') + first(:link, text: 'Three').click click_on('Page history') expect(current_path).to include('one/two/three-test') @@ -48,7 +48,7 @@ describe 'User views a wiki page' do expect(current_path).to include('one/two/three-test') expect(find('.wiki-pages')).to have_content('Three') - click_on('Three') + first(:link, text: 'Three').click expect(find('.nav-text')).to have_content('Three') -- cgit v1.2.1 From 3944e16b4bd716fd1f317c89c2c0910de76a2c33 Mon Sep 17 00:00:00 2001 From: Ahmad Sherif Date: Wed, 20 Sep 2017 12:11:51 +0200 Subject: Migrate Git::Repository#rm_tag to Gitaly Closes gitaly#562 --- spec/features/tags/master_deletes_tag_spec.rb | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'spec/features') diff --git a/spec/features/tags/master_deletes_tag_spec.rb b/spec/features/tags/master_deletes_tag_spec.rb index d6a6b8fc7d5..80750c904b5 100644 --- a/spec/features/tags/master_deletes_tag_spec.rb +++ b/spec/features/tags/master_deletes_tag_spec.rb @@ -35,15 +35,30 @@ feature 'Master deletes tag' do end context 'when pre-receive hook fails', js: true do - before do - allow_any_instance_of(Gitlab::Git::HooksService).to receive(:execute) - .and_raise(Gitlab::Git::HooksService::PreReceiveError, 'Do not delete tags') + context 'when Gitaly operation_user_delete_tag feature is enabled' do + before do + allow_any_instance_of(Gitlab::GitalyClient::OperationService).to receive(:rm_tag) + .and_raise(Gitlab::Git::HooksService::PreReceiveError, 'Do not delete tags') + end + + scenario 'shows the error message' do + delete_first_tag + + expect(page).to have_content('Do not delete tags') + end end - scenario 'shows the error message' do - delete_first_tag + context 'when Gitaly operation_user_delete_tag feature is disabled', skip_gitaly_mock: true do + before do + allow_any_instance_of(Gitlab::Git::HooksService).to receive(:execute) + .and_raise(Gitlab::Git::HooksService::PreReceiveError, 'Do not delete tags') + end + + scenario 'shows the error message' do + delete_first_tag - expect(page).to have_content('Do not delete tags') + expect(page).to have_content('Do not delete tags') + end end end -- cgit v1.2.1 From 8585ae61e730a48fc0688417b24279c48b59dada Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 28 Sep 2017 11:44:33 +0100 Subject: Fix fork button being disabled for users who can fork to group Previously the fork button was disabled for all users if they have exceeded their project limit. This fixes that by changing the check to see if the user can fork to a group instead of their own namespace. This behaviour is already possible by visiting the new fork page directly, so this just fixes the button being disabled. Closes #38462 --- spec/features/projects/fork_spec.rb | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 spec/features/projects/fork_spec.rb (limited to 'spec/features') diff --git a/spec/features/projects/fork_spec.rb b/spec/features/projects/fork_spec.rb new file mode 100644 index 00000000000..e10d29e5eea --- /dev/null +++ b/spec/features/projects/fork_spec.rb @@ -0,0 +1,57 @@ +require 'spec_helper' + +describe 'Project fork' do + let(:user) { create(:user) } + let(:project) { create(:project, :public, :repository) } + + before do + sign_in user + end + + it 'allows user to fork project' do + visit project_path(project) + + expect(page).not_to have_css('a.disabled', text: 'Fork') + end + + it 'disables fork button when user has exceeded project limit' do + user.projects_limit = 0 + user.save! + + visit project_path(project) + + expect(page).to have_css('a.disabled', text: 'Fork') + end + + context 'master in group' do + before do + group = create(:group) + group.add_master(user) + end + + it 'allows user to fork project to group or to user namespace' do + visit project_path(project) + + expect(page).not_to have_css('a.disabled', text: 'Fork') + + click_link 'Fork' + + expect(page).to have_css('.fork-thumbnail', count: 2) + expect(page).not_to have_css('.fork-thumbnail.disabled') + end + + it 'allows user to fork project to group and not user when exceeded project limit' do + user.projects_limit = 0 + user.save! + + visit project_path(project) + + expect(page).not_to have_css('a.disabled', text: 'Fork') + + click_link 'Fork' + + expect(page).to have_css('.fork-thumbnail', count: 2) + expect(page).to have_css('.fork-thumbnail.disabled') + end + end +end -- cgit v1.2.1 From b452b0c7056e481778bfc5838d47dca813bf12ed Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Fri, 29 Sep 2017 13:07:04 -0500 Subject: Used send_keys(:return) for elements that are not clickable at one point --- .../projects/import_export/namespace_export_file_spec.rb | 2 +- spec/features/triggers_spec.rb | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/import_export/namespace_export_file_spec.rb b/spec/features/projects/import_export/namespace_export_file_spec.rb index 691b0e1e4ca..23b5febf243 100644 --- a/spec/features/projects/import_export/namespace_export_file_spec.rb +++ b/spec/features/projects/import_export/namespace_export_file_spec.rb @@ -52,7 +52,7 @@ feature 'Import/Export - Namespace export file cleanup', js: true do expect(page).to have_content('Export project') - click_link 'Export project' + find(:link, 'Export project').send_keys(:return) visit edit_project_path(project) diff --git a/spec/features/triggers_spec.rb b/spec/features/triggers_spec.rb index 477798e3826..a6ec1a1a96a 100644 --- a/spec/features/triggers_spec.rb +++ b/spec/features/triggers_spec.rb @@ -45,7 +45,7 @@ feature 'Triggers', js: true do visit project_settings_ci_cd_path(@project) # See if edit page has correct descrption - find('a[title="Edit"]').click + find('a[title="Edit"]').send_keys(:return) expect(page.find('#trigger_description').value).to have_content 'trigger desc' end @@ -54,7 +54,7 @@ feature 'Triggers', js: true do visit project_settings_ci_cd_path(@project) # See if edit page opens, then fill in new description and save - find('a[title="Edit"]').click + find('a[title="Edit"]').send_keys(:return) fill_in 'trigger_description', with: new_trigger_title click_button 'Save trigger' @@ -70,7 +70,7 @@ feature 'Triggers', js: true do visit project_settings_ci_cd_path(@project) # See if the trigger can be edited and description is blank - find('a[title="Edit"]').click + find('a[title="Edit"]').send_keys(:return) expect(page.find('#trigger_description').value).to have_content '' # See if trigger can be updated with description and saved successfully @@ -95,7 +95,7 @@ feature 'Triggers', js: true do scenario 'take trigger ownership' do # See if "Take ownership" on trigger works post trigger creation page.accept_confirm do - find('a.btn-trigger-take-ownership').click + first(:link, "Take ownership").send_keys(:return) end expect(page.find('.flash-notice')).to have_content 'Trigger was re-assigned.' @@ -117,11 +117,12 @@ feature 'Triggers', js: true do scenario 'revoke trigger' do # See if "Revoke" on trigger works post trigger creation - find('a.btn-trigger-revoke').click page.accept_confirm do - expect(page.find('.flash-notice')).to have_content 'Trigger removed' - expect(page).to have_selector('p.settings-message.text-center.append-bottom-default') + find('a.btn-trigger-revoke').send_keys(:return) end + + expect(page.find('.flash-notice')).to have_content 'Trigger removed' + expect(page).to have_selector('p.settings-message.text-center.append-bottom-default') end end -- cgit v1.2.1 From 439e3f073591b41ef9926a4b8c33000ae1b068f7 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 29 Sep 2017 14:13:35 -0500 Subject: Port semi-linear merge strategy to CE (mostly FE) --- spec/features/projects/project_settings_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/features') diff --git a/spec/features/projects/project_settings_spec.rb b/spec/features/projects/project_settings_spec.rb index 8dc94b3d549..06568817757 100644 --- a/spec/features/projects/project_settings_spec.rb +++ b/spec/features/projects/project_settings_spec.rb @@ -41,6 +41,14 @@ describe 'Edit Project Settings' do end end + it 'shows "Merge commit with semi-linear history " strategy' do + visit edit_project_path(project) + + page.within '.merge-requests-feature' do + expect(page).to have_content 'Merge commit with semi-linear history' + end + end + it 'shows "Fast-forward merge" strategy' do visit edit_project_path(project) -- cgit v1.2.1 From b2232f74129173f8d67340267d31962a82c1e37c Mon Sep 17 00:00:00 2001 From: robdel12 Date: Sat, 30 Sep 2017 18:33:12 -0500 Subject: Create failing test case --- spec/features/signup_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'spec/features') diff --git a/spec/features/signup_spec.rb b/spec/features/signup_spec.rb index b6367b88e17..917fad74ef1 100644 --- a/spec/features/signup_spec.rb +++ b/spec/features/signup_spec.rb @@ -24,6 +24,24 @@ feature 'Signup' do end end + context "when sigining up with different cased emails" do + it "creates the user successfully" do + user = build(:user) + + visit root_path + + fill_in 'new_user_name', with: user.name + fill_in 'new_user_username', with: user.username + fill_in 'new_user_email', with: user.email + fill_in 'new_user_email_confirmation', with: user.email.capitalize + fill_in 'new_user_password', with: user.password + click_button "Register" + + expect(current_path).to eq dashboard_projects_path + expect(page).to have_content("Welcome! You have signed up successfully.") + end + end + context "when not sending confirmation email" do before do stub_application_setting(send_user_confirmation_email: false) -- cgit v1.2.1 From b74c643c66fd15c95ad148231ebcf4f85283ca16 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 28 Sep 2017 16:55:25 +0200 Subject: Only copy old/new code when selecting left/right side of parallel diff --- spec/features/copy_as_gfm_spec.rb | 128 +++++++++++++++------ .../merge_requests/diff_notes_avatars_spec.rb | 22 ++-- 2 files changed, 109 insertions(+), 41 deletions(-) (limited to 'spec/features') diff --git a/spec/features/copy_as_gfm_spec.rb b/spec/features/copy_as_gfm_spec.rb index dfeba722ac6..ebcd0ba0dcd 100644 --- a/spec/features/copy_as_gfm_spec.rb +++ b/spec/features/copy_as_gfm_spec.rb @@ -446,7 +446,7 @@ describe 'Copy as GFM', js: true do def verify(label, *gfms) aggregate_failures(label) do gfms.each do |gfm| - html = gfm_to_html(gfm) + html = gfm_to_html(gfm).gsub(/\A | \z/, '') output_gfm = html_to_gfm(html) expect(output_gfm.strip).to eq(gfm.strip) end @@ -463,42 +463,98 @@ describe 'Copy as GFM', js: true do let(:project) { create(:project, :repository) } context 'from a diff' do - before do - visit project_commit_path(project, sample_commit.id) - end + shared_examples 'copying code from a diff' do + context 'selecting one word of text' do + it 'copies as inline code' do + verify( + '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"] .line .no', - context 'selecting one word of text' do - it 'copies as inline code' do - verify( - '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"] .line .no', + '`RuntimeError`', - '`RuntimeError`' - ) + target: '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]' + ) + end end - end - context 'selecting one line of text' do - it 'copies as inline code' do - verify( - '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"] .line', + context 'selecting one line of text' do + it 'copies as inline code' do + verify( + '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]', - '`raise RuntimeError, "System commands must be given as an array of strings"`' - ) + '`raise RuntimeError, "System commands must be given as an array of strings"`', + + target: '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]' + ) + end + end + + context 'selecting multiple lines of text' do + it 'copies as a code block' do + verify( + '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"], [id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_10"]', + + <<-GFM.strip_heredoc, + ```ruby + raise RuntimeError, "System commands must be given as an array of strings" + end + ``` + GFM + + target: '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]' + ) + end end end - context 'selecting multiple lines of text' do - it 'copies as a code block' do - verify( - '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"], [id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_10"]', + context 'inline diff' do + before do + visit project_commit_path(project, sample_commit.id, view: 'inline') + end - <<-GFM.strip_heredoc, - ```ruby - raise RuntimeError, "System commands must be given as an array of strings" - end - ``` - GFM - ) + it_behaves_like 'copying code from a diff' + end + + context 'parallel diff' do + before do + visit project_commit_path(project, sample_commit.id, view: 'parallel') + end + + it_behaves_like 'copying code from a diff' + + context 'selecting code on the left' do + it 'copies as a code block' do + verify( + '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_8_8"], [id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_9_9"], [id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"], [id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_10"]', + + <<-GFM.strip_heredoc, + ```ruby + unless cmd.is_a?(Array) + raise "System commands must be given as an array of strings" + end + ``` + GFM + + target: '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_8_8"].left-side' + ) + end + end + + context 'selecting code on the right' do + it 'copies as a code block' do + verify( + '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_8_8"], [id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_9_9"], [id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"], [id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_10"]', + + <<-GFM.strip_heredoc, + ```ruby + unless cmd.is_a?(Array) + raise RuntimeError, "System commands must be given as an array of strings" + end + ``` + GFM + + target: '[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_8_8"].right-side' + ) + end end end end @@ -587,9 +643,9 @@ describe 'Copy as GFM', js: true do end end - def verify(selector, gfm) + def verify(selector, gfm, target: nil) html = html_for_selector(selector) - output_gfm = html_to_gfm(html, 'transformCodeSelection') + output_gfm = html_to_gfm(html, 'transformCodeSelection', target: target) expect(output_gfm.strip).to eq(gfm.strip) end end @@ -605,15 +661,21 @@ describe 'Copy as GFM', js: true do page.evaluate_script(js) end - def html_to_gfm(html, transformer = 'transformGFMSelection') + def html_to_gfm(html, transformer = 'transformGFMSelection', target: nil) js = <<-JS.strip_heredoc (function(html) { var transformer = window.gl.CopyAsGFM[#{transformer.inspect}]; var node = document.createElement('div'); - node.innerHTML = html; + $(html).each(function() { node.appendChild(this) }); + + var targetSelector = #{target.to_json}; + var target; + if (targetSelector) { + target = document.querySelector(targetSelector); + } - node = transformer(node); + node = transformer(node, target); if (!node) return null; return window.gl.CopyAsGFM.nodeToGFM(node); diff --git a/spec/features/merge_requests/diff_notes_avatars_spec.rb b/spec/features/merge_requests/diff_notes_avatars_spec.rb index 9bcb78d5206..4766cdf716f 100644 --- a/spec/features/merge_requests/diff_notes_avatars_spec.rb +++ b/spec/features/merge_requests/diff_notes_avatars_spec.rb @@ -84,7 +84,7 @@ feature 'Diff note avatars', js: true do end it 'shows note avatar' do - page.within find("[id='#{position.line_code(project.repository)}']") do + page.within find_line(position.line_code(project.repository)) do find('.diff-notes-collapse').click expect(page).to have_selector('img.js-diff-comment-avatar', count: 1) @@ -92,7 +92,7 @@ feature 'Diff note avatars', js: true do end it 'shows comment on note avatar' do - page.within find("[id='#{position.line_code(project.repository)}']") do + page.within find_line(position.line_code(project.repository)) do find('.diff-notes-collapse').click expect(first('img.js-diff-comment-avatar')["data-original-title"]).to eq("#{note.author.name}: #{note.note.truncate(17)}") @@ -100,13 +100,13 @@ feature 'Diff note avatars', js: true do end it 'toggles comments when clicking avatar' do - page.within find("[id='#{position.line_code(project.repository)}']") do + page.within find_line(position.line_code(project.repository)) do find('.diff-notes-collapse').click end expect(page).to have_selector('.notes_holder', visible: false) - page.within find("[id='#{position.line_code(project.repository)}']") do + page.within find_line(position.line_code(project.repository)) do first('img.js-diff-comment-avatar').click end @@ -122,7 +122,7 @@ feature 'Diff note avatars', js: true do wait_for_requests - page.within find("[id='#{position.line_code(project.repository)}']") do + page.within find_line(position.line_code(project.repository)) do expect(page).not_to have_selector('img.js-diff-comment-avatar') end end @@ -138,7 +138,7 @@ feature 'Diff note avatars', js: true do wait_for_requests end - page.within find("[id='#{position.line_code(project.repository)}']") do + page.within find_line(position.line_code(project.repository)) do find('.diff-notes-collapse').trigger('click') expect(page).to have_selector('img.js-diff-comment-avatar', count: 2) @@ -158,7 +158,7 @@ feature 'Diff note avatars', js: true do end end - page.within find("[id='#{position.line_code(project.repository)}']") do + page.within find_line(position.line_code(project.repository)) do find('.diff-notes-collapse').trigger('click') expect(page).to have_selector('img.js-diff-comment-avatar', count: 3) @@ -176,7 +176,7 @@ feature 'Diff note avatars', js: true do end it 'shows extra comment count' do - page.within find("[id='#{position.line_code(project.repository)}']") do + page.within find_line(position.line_code(project.repository)) do find('.diff-notes-collapse').click expect(find('.diff-comments-more-count')).to have_content '+1' @@ -185,4 +185,10 @@ feature 'Diff note avatars', js: true do end end end + + def find_line(line_code) + line = find("[id='#{line_code}']") + line = line.find(:xpath, 'preceding-sibling::*[1][self::td]') if line.tag_name == 'td' + line + end end -- cgit v1.2.1 From 800a5f8ee9a73476a75ff04af2180e294db3a32d Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Mon, 2 Oct 2017 22:53:14 +0200 Subject: Add serializer matchers --- spec/features/container_registry_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/container_registry_spec.rb b/spec/features/container_registry_spec.rb index ae39ba4da6b..ffcd0f483b9 100644 --- a/spec/features/container_registry_spec.rb +++ b/spec/features/container_registry_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Container Registry" do +describe "Container Registry", js: true do let(:user) { create(:user) } let(:project) { create(:project) } -- cgit v1.2.1 From 7a5c2d5eff6cd13f6971140294c395e877eafacf Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Mon, 2 Oct 2017 12:51:16 -0500 Subject: Fix Element is not clickable at this point --- spec/features/issues/bulk_assignment_labels_spec.rb | 2 +- spec/features/merge_requests/conflicts_spec.rb | 6 +++--- spec/features/merge_requests/diff_notes_avatars_spec.rb | 14 +++++++------- .../projects/settings/merge_requests_settings_spec.rb | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/bulk_assignment_labels_spec.rb b/spec/features/issues/bulk_assignment_labels_spec.rb index a89dcdf41dc..2cf32e492a0 100644 --- a/spec/features/issues/bulk_assignment_labels_spec.rb +++ b/spec/features/issues/bulk_assignment_labels_spec.rb @@ -405,7 +405,7 @@ feature 'Issues > Labels bulk assignment' do end def update_issues - find('.update-selected-issues').trigger('click') + find('.update-selected-issues').send_keys(:return) wait_for_requests end diff --git a/spec/features/merge_requests/conflicts_spec.rb b/spec/features/merge_requests/conflicts_spec.rb index 70937666334..5e6220c5b1c 100644 --- a/spec/features/merge_requests/conflicts_spec.rb +++ b/spec/features/merge_requests/conflicts_spec.rb @@ -23,11 +23,11 @@ feature 'Merge request conflict resolution', js: true do within find('.files-wrapper .diff-file', text: 'files/ruby/regex.rb') do all('button', text: 'Use ours').each do |button| - button.click + button.send_keys(:return) end end - click_button 'Commit conflict resolution' + find_button('Commit conflict resolution').send_keys(:return) expect(page).to have_content('All merge conflicts were resolved') merge_request.reload_diff @@ -69,7 +69,7 @@ feature 'Merge request conflict resolution', js: true do execute_script('ace.edit($(".files-wrapper .diff-file pre")[1]).setValue("Gregor Samsa woke from troubled dreams");') end - click_button 'Commit conflict resolution' + find_button('Commit conflict resolution').send_keys(:return) expect(page).to have_content('All merge conflicts were resolved') merge_request.reload_diff diff --git a/spec/features/merge_requests/diff_notes_avatars_spec.rb b/spec/features/merge_requests/diff_notes_avatars_spec.rb index 6f025fdc855..362a526db0d 100644 --- a/spec/features/merge_requests/diff_notes_avatars_spec.rb +++ b/spec/features/merge_requests/diff_notes_avatars_spec.rb @@ -86,7 +86,7 @@ feature 'Diff note avatars', js: true do it 'shows note avatar' do page.within find("[id='#{position.line_code(project.repository)}']") do - find('.diff-notes-collapse').click + find('.diff-notes-collapse').send_keys(:return) expect(page).to have_selector('img.js-diff-comment-avatar', count: 1) end @@ -94,7 +94,7 @@ feature 'Diff note avatars', js: true do it 'shows comment on note avatar' do page.within find("[id='#{position.line_code(project.repository)}']") do - find('.diff-notes-collapse').click + find('.diff-notes-collapse').send_keys(:return) expect(first('img.js-diff-comment-avatar')["data-original-title"]).to eq("#{note.author.name}: #{note.note.truncate(17)}") end @@ -102,13 +102,13 @@ feature 'Diff note avatars', js: true do it 'toggles comments when clicking avatar' do page.within find("[id='#{position.line_code(project.repository)}']") do - find('.diff-notes-collapse').click + find('.diff-notes-collapse').send_keys(:return) end expect(page).to have_selector('.notes_holder', visible: false) page.within find("[id='#{position.line_code(project.repository)}']") do - first('img.js-diff-comment-avatar').click + first('img.js-diff-comment-avatar').send_keys(:return) end expect(page).to have_selector('.notes_holder') @@ -140,7 +140,7 @@ feature 'Diff note avatars', js: true do end page.within find("[id='#{position.line_code(project.repository)}']") do - find('.diff-notes-collapse').trigger('click') + find('.diff-notes-collapse').send_keys(:return) expect(page).to have_selector('img.js-diff-comment-avatar', count: 2) end @@ -160,7 +160,7 @@ feature 'Diff note avatars', js: true do end page.within find("[id='#{position.line_code(project.repository)}']") do - find('.diff-notes-collapse').click + find('.diff-notes-collapse').send_keys(:return) expect(page).to have_selector('img.js-diff-comment-avatar', count: 3) expect(find('.diff-comments-more-count')).to have_content '+1' @@ -178,7 +178,7 @@ feature 'Diff note avatars', js: true do it 'shows extra comment count' do page.within find("[id='#{position.line_code(project.repository)}']") do - find('.diff-notes-collapse').click + find('.diff-notes-collapse').send_keys(:return) expect(find('.diff-comments-more-count')).to have_content '+1' end diff --git a/spec/features/projects/settings/merge_requests_settings_spec.rb b/spec/features/projects/settings/merge_requests_settings_spec.rb index b1ec556bf16..ac76c30cc7c 100644 --- a/spec/features/projects/settings/merge_requests_settings_spec.rb +++ b/spec/features/projects/settings/merge_requests_settings_spec.rb @@ -21,7 +21,7 @@ feature 'Project settings > Merge Requests', :js do within('.sharing-permissions-form') do find('.project-feature-controls[data-for="project[project_feature_attributes][merge_requests_access_level]"] .project-feature-toggle').click - click_on('Save changes') + find('input[value="Save changes"]').send_keys(:return) end expect(page).not_to have_content('Only allow merge requests to be merged if the pipeline succeeds') @@ -41,7 +41,7 @@ feature 'Project settings > Merge Requests', :js do within('.sharing-permissions-form') do find('.project-feature-controls[data-for="project[project_feature_attributes][builds_access_level]"] .project-feature-toggle').click - click_on('Save changes') + find('input[value="Save changes"]').send_keys(:return) end expect(page).to have_content('Only allow merge requests to be merged if the pipeline succeeds') @@ -62,7 +62,7 @@ feature 'Project settings > Merge Requests', :js do within('.sharing-permissions-form') do find('.project-feature-controls[data-for="project[project_feature_attributes][merge_requests_access_level]"] .project-feature-toggle').click - click_on('Save changes') + find('input[value="Save changes"]').send_keys(:return) end expect(page).to have_content('Only allow merge requests to be merged if the pipeline succeeds') -- cgit v1.2.1 From bca86c858b361f3b5a19abcfc03972c95f4b2d2a Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 3 Oct 2017 00:33:13 -0500 Subject: Add test for external HTML artifact --- spec/features/projects/artifacts/browse_spec.rb | 28 +++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/artifacts/browse_spec.rb b/spec/features/projects/artifacts/browse_spec.rb index 42b47cb3301..40af0247bce 100644 --- a/spec/features/projects/artifacts/browse_spec.rb +++ b/spec/features/projects/artifacts/browse_spec.rb @@ -1,19 +1,20 @@ require 'spec_helper' feature 'Browse artifact', :js do + include ArtifactHelper + let(:project) { create(:project, :public) } let(:pipeline) { create(:ci_empty_pipeline, project: project) } let(:job) { create(:ci_build, :artifacts, pipeline: pipeline) } + let(:browse_url) do + browse_path('other_artifacts_0.1.2') + end def browse_path(path) browse_project_job_artifacts_path(project, job, path) end context 'when visiting old URL' do - let(:browse_url) do - browse_path('other_artifacts_0.1.2') - end - before do visit browse_url.sub('/-/jobs', '/builds') end @@ -22,4 +23,23 @@ feature 'Browse artifact', :js do expect(page.current_path).to eq(browse_url) end end + + context 'when browsing a directory with an HTML file' do + let(:html_entry) { job.artifacts_metadata_entry("other_artifacts_0.1.2/index.html") } + + before do + allow(Gitlab.config.pages).to receive(:enabled).and_return(true) + allow(Gitlab.config.pages).to receive(:artifacts_server).and_return(true) + + visit browse_url + end + + it "shows external link icon and styles" do + link = first('.tree-item-file-external-link') + + expect(link).to have_content('index.html') + expect(link[:href]).to eq(html_artifact_url(project, job, html_entry.blob)) + expect(page).to have_selector('.js-artifact-tree-external-icon') + end + end end -- cgit v1.2.1 From 7f69659a5d932ef6cac72001b19b89a103535bd9 Mon Sep 17 00:00:00 2001 From: Jarka Kadlecova Date: Tue, 19 Sep 2017 10:30:18 +0200 Subject: Remove edit action for issues --- spec/features/issues/form_spec.rb | 49 +--------- spec/features/issues_spec.rb | 108 ++------------------- spec/features/projects/issuable_templates_spec.rb | 46 +++++---- .../security/project/internal_access_spec.rb | 15 --- .../security/project/private_access_spec.rb | 15 --- .../security/project/public_access_spec.rb | 15 --- 6 files changed, 34 insertions(+), 214 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/form_spec.rb b/spec/features/issues/form_spec.rb index 2db6f9a2982..8ce470fc288 100644 --- a/spec/features/issues/form_spec.rb +++ b/spec/features/issues/form_spec.rb @@ -218,54 +218,15 @@ describe 'New/edit issue', :js do context 'edit issue' do before do - visit edit_project_issue_path(project, issue) - end - - it 'allows user to update issue' do - expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match(user.id.to_s) - expect(find('input[name="issue[milestone_id]"]', visible: false).value).to match(milestone.id.to_s) - expect(find('a', text: 'Assign to me', visible: false)).not_to be_visible - - page.within '.js-user-search' do - expect(page).to have_content user.name - end - - page.within '.js-milestone-select' do - expect(page).to have_content milestone.title - end - - click_button 'Labels' - page.within '.dropdown-menu-labels' do - click_link label.title - click_link label2.title - end - page.within '.js-label-select' do - expect(page).to have_content label.title - end - expect(page.all('input[name="issue[label_ids][]"]', visible: false)[1].value).to match(label.id.to_s) - expect(page.all('input[name="issue[label_ids][]"]', visible: false)[2].value).to match(label2.id.to_s) - - click_button 'Save changes' - - page.within '.issuable-sidebar' do - page.within '.assignee' do - expect(page).to have_content user.name - end - - page.within '.milestone' do - expect(page).to have_content milestone.title - end - - page.within '.labels' do - expect(page).to have_content label.title - expect(page).to have_content label2.title - end + visit project_issue_path(project, issue) + page.within('.content .issuable-actions') do + click_on 'Edit' end end it 'description has autocomplete' do - find('#issue_description').native.send_keys('') - fill_in 'issue_description', with: '@' + find_field('issue-description').native.send_keys('') + fill_in 'issue-description', with: '@' expect(page).to have_selector('.atwho-view') end diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index fb763c93c66..30310055dc5 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Issues' do +describe 'Issues', :js do include DropzoneHelper include IssueHelpers include SortingHelper @@ -24,109 +24,15 @@ describe 'Issues' do end before do - visit edit_project_issue_path(project, issue) - find('.js-zen-enter').click - end - - it 'opens new issue popup' do - expect(page).to have_content("Issue ##{issue.iid}") - end - end - - describe 'Editing issue assignee' do - let!(:issue) do - create(:issue, - author: user, - assignees: [user], - project: project) - end - - it 'allows user to select unassigned', js: true do - visit edit_project_issue_path(project, issue) - - expect(page).to have_content "Assignee #{user.name}" - - first('.js-user-search').click - click_link 'Unassigned' - - click_button 'Save changes' - - page.within('.assignee') do - expect(page).to have_content 'No assignee - assign yourself' - end - - expect(issue.reload.assignees).to be_empty - end - end - - describe 'due date', js: true do - context 'on new form' do - before do - visit new_project_issue_path(project) - end - - it 'saves with due date' do - date = Date.today.at_beginning_of_month - - fill_in 'issue_title', with: 'bug 345' - fill_in 'issue_description', with: 'bug description' - find('#issuable-due-date').click - - page.within '.pika-single' do - click_button date.day - end - - expect(find('#issuable-due-date').value).to eq date.to_s - - click_button 'Submit issue' - - page.within '.issuable-sidebar' do - expect(page).to have_content date.to_s(:medium) - end + visit project_issue_path(project, issue) + page.within('.content .issuable-actions') do + find('.issuable-edit').click end + find('.issue-details .content-block .js-zen-enter').click end - context 'on edit form' do - let(:issue) { create(:issue, author: user, project: project, due_date: Date.today.at_beginning_of_month.to_s) } - - before do - visit edit_project_issue_path(project, issue) - end - - it 'saves with due date' do - date = Date.today.at_beginning_of_month - - expect(find('#issuable-due-date').value).to eq date.to_s - - date = date.tomorrow - - fill_in 'issue_title', with: 'bug 345' - fill_in 'issue_description', with: 'bug description' - find('#issuable-due-date').click - - page.within '.pika-single' do - click_button date.day - end - - expect(find('#issuable-due-date').value).to eq date.to_s - - click_button 'Save changes' - - page.within '.issuable-sidebar' do - expect(page).to have_content date.to_s(:medium) - end - end - - it 'warns about version conflict' do - issue.update(title: "New title") - - fill_in 'issue_title', with: 'bug 345' - fill_in 'issue_description', with: 'bug description' - - click_button 'Save changes' - - expect(page).to have_content 'Someone edited the issue the same time you did' - end + it 'opens new issue popup' do + expect(page).to have_content(issue.description) end end diff --git a/spec/features/projects/issuable_templates_spec.rb b/spec/features/projects/issuable_templates_spec.rb index d2789d0aa52..1f9b52dd998 100644 --- a/spec/features/projects/issuable_templates_spec.rb +++ b/spec/features/projects/issuable_templates_spec.rb @@ -3,6 +3,7 @@ require 'spec_helper' feature 'issuable templates', js: true do let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } + let(:issue_form_location) { '#content-body .issuable-details .detail-page-description' } before do project.team << [user, :master] @@ -28,14 +29,17 @@ feature 'issuable templates', js: true do longtemplate_content, message: 'added issue template', branch_name: 'master') - visit edit_project_issue_path project, issue - fill_in :'issue[title]', with: 'test issue title' + visit project_issue_path project, issue + page.within('.content .issuable-actions') do + click_on 'Edit' + end + fill_in :'issue-title', with: 'test issue title' end scenario 'user selects "bug" template' do select_template 'bug' wait_for_requests - assert_template + assert_template(page_part: issue_form_location) save_changes end @@ -43,30 +47,19 @@ feature 'issuable templates', js: true do select_template 'bug' wait_for_requests select_option 'No template' - assert_template('') + assert_template(expected_content: '', page_part: issue_form_location) save_changes('') end scenario 'user selects "bug" template, edits description and then selects "reset template"' do select_template 'bug' wait_for_requests - find_field('issue_description').send_keys(description_addition) - assert_template(template_content + description_addition) + find_field('issue-description').send_keys(description_addition) + assert_template(expected_content: template_content + description_addition, page_part: issue_form_location) select_option 'Reset template' - assert_template + assert_template(page_part: issue_form_location) save_changes end - - it 'updates height of markdown textarea' do - start_height = page.evaluate_script('$(".markdown-area").outerHeight()') - - select_template 'test' - wait_for_requests - - end_height = page.evaluate_script('$(".markdown-area").outerHeight()') - - expect(end_height).not_to eq(start_height) - end end context 'user creates an issue using templates, with a prior description' do @@ -81,15 +74,18 @@ feature 'issuable templates', js: true do template_content, message: 'added issue template', branch_name: 'master') - visit edit_project_issue_path project, issue - fill_in :'issue[title]', with: 'test issue title' - fill_in :'issue[description]', with: prior_description + visit project_issue_path project, issue + page.within('.content .issuable-actions') do + click_on 'Edit' + end + fill_in :'issue-title', with: 'test issue title' + fill_in :'issue-description', with: prior_description end scenario 'user selects "bug" template' do select_template 'bug' wait_for_requests - assert_template("#{template_content}") + assert_template(page_part: issue_form_location) save_changes end end @@ -154,8 +150,10 @@ feature 'issuable templates', js: true do end end - def assert_template(expected_content = template_content) - expect(find('textarea')['value']).to eq(expected_content) + def assert_template(expected_content: template_content, page_part: '#content-body') + page.within(page_part) do + expect(find('textarea')['value']).to eq(expected_content) + end end def save_changes(expected_content = template_content) diff --git a/spec/features/security/project/internal_access_spec.rb b/spec/features/security/project/internal_access_spec.rb index a7928857b7d..d70cf1527e7 100644 --- a/spec/features/security/project/internal_access_spec.rb +++ b/spec/features/security/project/internal_access_spec.rb @@ -181,21 +181,6 @@ describe "Internal Project Access" do it { is_expected.to be_denied_for(:visitor) } end - describe "GET /:project_path/issues/:id/edit" do - let(:issue) { create(:issue, project: project) } - subject { edit_project_issue_path(project, issue) } - - it { is_expected.to be_allowed_for(:admin) } - it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } - it { is_expected.to be_allowed_for(:developer).of(project) } - it { is_expected.to be_allowed_for(:reporter).of(project) } - it { is_expected.to be_denied_for(:guest).of(project) } - it { is_expected.to be_denied_for(:user) } - it { is_expected.to be_denied_for(:external) } - it { is_expected.to be_denied_for(:visitor) } - end - describe "GET /:project_path/snippets" do subject { project_snippets_path(project) } diff --git a/spec/features/security/project/private_access_spec.rb b/spec/features/security/project/private_access_spec.rb index a4396b20afd..ea130606545 100644 --- a/spec/features/security/project/private_access_spec.rb +++ b/spec/features/security/project/private_access_spec.rb @@ -181,21 +181,6 @@ describe "Private Project Access" do it { is_expected.to be_denied_for(:visitor) } end - describe "GET /:project_path/issues/:id/edit" do - let(:issue) { create(:issue, project: project) } - subject { edit_project_issue_path(project, issue) } - - it { is_expected.to be_allowed_for(:admin) } - it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } - it { is_expected.to be_allowed_for(:developer).of(project) } - it { is_expected.to be_allowed_for(:reporter).of(project) } - it { is_expected.to be_denied_for(:guest).of(project) } - it { is_expected.to be_denied_for(:user) } - it { is_expected.to be_denied_for(:external) } - it { is_expected.to be_denied_for(:visitor) } - end - describe "GET /:project_path/snippets" do subject { project_snippets_path(project) } diff --git a/spec/features/security/project/public_access_spec.rb b/spec/features/security/project/public_access_spec.rb index fccdeb0e5b7..d15f5af66c9 100644 --- a/spec/features/security/project/public_access_spec.rb +++ b/spec/features/security/project/public_access_spec.rb @@ -394,21 +394,6 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:visitor) } end - describe "GET /:project_path/issues/:id/edit" do - let(:issue) { create(:issue, project: project) } - subject { edit_project_issue_path(project, issue) } - - it { is_expected.to be_allowed_for(:admin) } - it { is_expected.to be_allowed_for(:owner).of(project) } - it { is_expected.to be_allowed_for(:master).of(project) } - it { is_expected.to be_allowed_for(:developer).of(project) } - it { is_expected.to be_allowed_for(:reporter).of(project) } - it { is_expected.to be_denied_for(:guest).of(project) } - it { is_expected.to be_denied_for(:user) } - it { is_expected.to be_denied_for(:external) } - it { is_expected.to be_denied_for(:visitor) } - end - describe "GET /:project_path/snippets" do subject { project_snippets_path(project) } -- cgit v1.2.1 From 5e5d5934eaff2d7254c5f57b6a5e262a37a46c6c Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Tue, 3 Oct 2017 11:20:18 +0100 Subject: Fix broken test --- spec/features/container_registry_spec.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/container_registry_spec.rb b/spec/features/container_registry_spec.rb index ffcd0f483b9..45213dc6995 100644 --- a/spec/features/container_registry_spec.rb +++ b/spec/features/container_registry_spec.rb @@ -41,16 +41,19 @@ describe "Container Registry", js: true do expect_any_instance_of(ContainerRepository) .to receive(:delete_tags!).and_return(true) - click_on 'Remove repository' + click_on(class: 'js-remove-repo') end scenario 'user removes a specific tag from container repository' do visit_container_registry + find('.js-toggle-repo').trigger('click') + wait_for_requests + expect_any_instance_of(ContainerRegistry::Tag) .to receive(:delete).and_return(true) - click_on 'Remove tag' + click_on(class: 'js-delete-registry') end end -- cgit v1.2.1 From 6a40c21675848ae9ef9afd28b1eabc241994a6f4 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Tue, 3 Oct 2017 13:25:41 +0200 Subject: Update tests for new implementation --- spec/features/projects/artifacts/browse_spec.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/artifacts/browse_spec.rb b/spec/features/projects/artifacts/browse_spec.rb index 40af0247bce..1bfdf3c2727 100644 --- a/spec/features/projects/artifacts/browse_spec.rb +++ b/spec/features/projects/artifacts/browse_spec.rb @@ -1,8 +1,6 @@ require 'spec_helper' feature 'Browse artifact', :js do - include ArtifactHelper - let(:project) { create(:project, :public) } let(:pipeline) { create(:ci_empty_pipeline, project: project) } let(:job) { create(:ci_build, :artifacts, pipeline: pipeline) } @@ -24,8 +22,8 @@ feature 'Browse artifact', :js do end end - context 'when browsing a directory with an HTML file' do - let(:html_entry) { job.artifacts_metadata_entry("other_artifacts_0.1.2/index.html") } + context 'when browsing a directory with an text file' do + let(:txt_entry) { job.artifacts_metadata_entry('other_artifacts_0.1.2/doc_sample.txt') } before do allow(Gitlab.config.pages).to receive(:enabled).and_return(true) @@ -37,8 +35,7 @@ feature 'Browse artifact', :js do it "shows external link icon and styles" do link = first('.tree-item-file-external-link') - expect(link).to have_content('index.html') - expect(link[:href]).to eq(html_artifact_url(project, job, html_entry.blob)) + expect(link).to have_content('doc_sample.txt') expect(page).to have_selector('.js-artifact-tree-external-icon') end end -- cgit v1.2.1 From 5dd26d4e5a5a27ca93e6d55b4261c42f4f70e762 Mon Sep 17 00:00:00 2001 From: "Jacob Vosmaer (GitLab)" Date: Tue, 3 Oct 2017 16:58:33 +0000 Subject: Hide Gollum inside Gitlab::Git::Wiki --- spec/features/projects/wiki/user_views_wiki_page_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/wiki/user_views_wiki_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_page_spec.rb index 49ba2969ef0..470391dc66b 100644 --- a/spec/features/projects/wiki/user_views_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_page_spec.rb @@ -83,7 +83,7 @@ describe 'User views a wiki page' do it 'shows a file stored in a page' do file = Gollum::File.new(project.wiki) - allow_any_instance_of(Gollum::Wiki).to receive(:file).with('image.jpg', 'master', true).and_return(file) + allow_any_instance_of(Gollum::Wiki).to receive(:file).with('image.jpg', 'master').and_return(file) allow_any_instance_of(Gollum::File).to receive(:mime_type).and_return('image/jpeg') expect(page).to have_xpath('//img[@data-src="image.jpg"]') -- cgit v1.2.1 From bea4b0a8df71cd134077580abc5c63fd9767da53 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Tue, 3 Oct 2017 12:02:48 -0500 Subject: fix admin_hooks_spec --- spec/features/admin/admin_hooks_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb index 91f08dbad5d..5140889b4c6 100644 --- a/spec/features/admin/admin_hooks_spec.rb +++ b/spec/features/admin/admin_hooks_spec.rb @@ -62,14 +62,14 @@ describe 'Admin::Hooks', :js do it 'from hooks list page' do visit admin_hooks_path - expect { click_link 'Remove' }.to change(SystemHook, :count).by(-1) + expect { accept_confirm { find(:link, 'Remove').send_keys(:return) } }.to change(SystemHook, :count).by(-1) end it 'from hook edit page' do visit admin_hooks_path click_link 'Edit' - expect { click_link 'Remove' }.to change(SystemHook, :count).by(-1) + expect { accept_confirm { find(:link, 'Remove').send_keys(:return) } }.to change(SystemHook, :count).by(-1) end end end -- cgit v1.2.1 From ac417cb39fd9f5d85f75740c9b0ae03026d6d640 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Tue, 3 Oct 2017 12:05:57 -0500 Subject: fix admin_uses_repository_checks --- spec/features/admin/admin_uses_repository_checks_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb index c2b7543a690..9f6d6d84081 100644 --- a/spec/features/admin/admin_uses_repository_checks_spec.rb +++ b/spec/features/admin/admin_uses_repository_checks_spec.rb @@ -37,7 +37,7 @@ feature 'Admin uses repository checks' do expect(RepositoryCheck::ClearWorker).to receive(:perform_async) - click_link 'Clear all repository checks' + accept_confirm { find(:link, 'Clear all repository checks').send_keys(:return) } expect(page).to have_content('Started asynchronous removal of all repository check states.') end -- cgit v1.2.1 From ebddd8d4801d734190d1dd26e94834208b585260 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Tue, 3 Oct 2017 12:06:21 -0500 Subject: fix diff_notes_spec --- spec/features/projects/commit/diff_notes_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/commit/diff_notes_spec.rb b/spec/features/projects/commit/diff_notes_spec.rb index f0fe4e00acc..4dbfc6f6edf 100644 --- a/spec/features/projects/commit/diff_notes_spec.rb +++ b/spec/features/projects/commit/diff_notes_spec.rb @@ -20,8 +20,8 @@ feature 'Commit diff', :js do it "adds comment to diff" do diff_line_num = first('.diff-line-num.new') - diff_line_num.trigger('mouseover') - diff_line_num.find('.js-add-diff-note-button').trigger('click') + diff_line_num.hover + diff_line_num.find('.js-add-diff-note-button').click page.within(first('.diff-viewer')) do find('.js-note-text').set 'test comment' -- cgit v1.2.1 From 6c541edaf163fbf23859cf7c5fa3d609f3233216 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Tue, 3 Oct 2017 12:06:38 -0500 Subject: fix spec/features/projects/import_export/export_file_spec.rb --- spec/features/projects/deploy_keys_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/deploy_keys_spec.rb b/spec/features/projects/deploy_keys_spec.rb index 1c1c25c932e..e445758cb5e 100644 --- a/spec/features/projects/deploy_keys_spec.rb +++ b/spec/features/projects/deploy_keys_spec.rb @@ -20,7 +20,7 @@ describe 'Project deploy keys', :js do page.within(find('.deploy-keys')) do expect(page).to have_selector('.deploy-keys li', count: 1) - accept_confirm { find(:button, text: 'Remove').click } + accept_confirm { find(:button, text: 'Remove').send_keys(:return) } expect(page).not_to have_selector('.fa-spinner', count: 0) expect(page).to have_selector('.deploy-keys li', count: 0) -- cgit v1.2.1 From c3d03582aab57c13644497edbbf07bc5328900be Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Tue, 3 Oct 2017 12:07:19 -0500 Subject: fix export_file_spec --- spec/features/projects/import_export/export_file_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/import_export/export_file_spec.rb b/spec/features/projects/import_export/export_file_spec.rb index 62d244ff259..30ed023e0c4 100644 --- a/spec/features/projects/import_export/export_file_spec.rb +++ b/spec/features/projects/import_export/export_file_spec.rb @@ -41,7 +41,7 @@ feature 'Import/Export - project export integration test', js: true do expect(page).to have_content('Export project') - click_link 'Export project' + find(:link, 'Export project').send_keys(:return) visit edit_project_path(project) -- cgit v1.2.1 From 62364576bc4e2b141752a6ea9068171fa619a6ff Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Tue, 3 Oct 2017 12:07:44 -0500 Subject: fix mattermost_slash_commands --- .../services/user_activates_mattermost_slash_command_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb b/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb index 95d5e8b14b9..6f057137867 100644 --- a/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb +++ b/spec/features/projects/services/user_activates_mattermost_slash_command_spec.rb @@ -76,7 +76,7 @@ feature 'Setup Mattermost slash commands', :js do select_element = find('#mattermost_team_id') selected_option = select_element.find('option[selected]') - expect(select_element['disabled']).to be(true) + expect(select_element['disabled']).to eq("true") expect(selected_option).to have_content(team_name.to_s) end @@ -104,7 +104,7 @@ feature 'Setup Mattermost slash commands', :js do select_element = find('#mattermost_team_id') - expect(select_element['disabled']).to be(false) + expect(select_element['disabled']).to be_falsey expect(select_element.all('option').count).to eq(3) end @@ -122,7 +122,7 @@ feature 'Setup Mattermost slash commands', :js do click_link 'Add to Mattermost' - expect(find('input[type="submit"]')['disabled']).not_to be(true) + expect(find('input[type="submit"]')['disabled']).not_to eq("true") end it 'disables the submit button if the required fields are not provided', :js do @@ -132,7 +132,7 @@ feature 'Setup Mattermost slash commands', :js do fill_in('mattermost_trigger', with: '') - expect(find('input[type="submit"]')['disabled']).to be(true) + expect(find('input[type="submit"]')['disabled']).to eq("true") end def stub_teams(count: 0) -- cgit v1.2.1 From 8640b294faa1f2f99e72ec46d36ba4873d8d3f5b Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 4 Oct 2017 11:32:56 -0500 Subject: Add extra assertions about how the link will open --- spec/features/projects/artifacts/browse_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/artifacts/browse_spec.rb b/spec/features/projects/artifacts/browse_spec.rb index 1bfdf3c2727..fe485334192 100644 --- a/spec/features/projects/artifacts/browse_spec.rb +++ b/spec/features/projects/artifacts/browse_spec.rb @@ -35,7 +35,10 @@ feature 'Browse artifact', :js do it "shows external link icon and styles" do link = first('.tree-item-file-external-link') - expect(link).to have_content('doc_sample.txt') + expect(page).to have_link('doc_sample.txt', href: file_project_job_artifacts_path(project, job, path: txt_entry.blob.path)) + expect(link[:target]).to eq('_blank') + expect(link[:rel]).to include('noopener') + expect(link[:rel]).to include('noreferrer') expect(page).to have_selector('.js-artifact-tree-external-icon') end end -- cgit v1.2.1 From 5abcedf47c375c94b859c294ffb1a9669512a041 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Wed, 4 Oct 2017 13:54:34 -0500 Subject: fix rubocop --- spec/features/u2f_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/u2f_spec.rb b/spec/features/u2f_spec.rb index 8178e4144f1..c9afef2a8de 100644 --- a/spec/features/u2f_spec.rb +++ b/spec/features/u2f_spec.rb @@ -267,7 +267,7 @@ feature 'Using U2F (Universal 2nd Factor) Devices for Authentication', :js do visit profile_account_path expect do accept_confirm { click_on "Disable" } - end.to change{ U2fRegistration.count }.by(-1) + end.to change { U2fRegistration.count }.by(-1) end end end -- cgit v1.2.1 From 376a8c66c1ca8ee2a95255d21c9d55ce006ab655 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Tue, 5 Sep 2017 10:03:43 +0200 Subject: Remove the subgroups path on a group --- spec/features/groups_spec.rb | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'spec/features') diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index 4ec2e7e6012..493dd551d25 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -90,7 +90,10 @@ feature 'Group' do context 'as admin' do before do - visit subgroups_group_path(group) + visit group_path(group) + + pending('use the new subgroup button') + click_link 'New Subgroup' end @@ -111,7 +114,10 @@ feature 'Group' do sign_out(:user) sign_in(user) - visit subgroups_group_path(group) + visit group_path(group) + + pending('use the new subgroup button') + click_link 'New Subgroup' fill_in 'Group path', with: 'bar' click_button 'Create group' @@ -120,16 +126,6 @@ feature 'Group' do expect(page).to have_content("Group 'bar' was successfully created.") end end - - context 'when nested group feature is disabled' do - it 'renders 404' do - allow(Group).to receive(:supports_nested_groups?).and_return(false) - - visit subgroups_group_path(group) - - expect(page.status_code).to eq(404) - end - end end it 'checks permissions to avoid exposing groups by parent_id' do @@ -213,8 +209,8 @@ feature 'Group' do let!(:path) { group_path(group) } it 'has nested groups tab with nested groups inside' do + pending('the child should be visible on the show page') visit path - click_link 'Subgroups' expect(page).to have_content(nested_group.name) end -- cgit v1.2.1 From 3a4dc55f2924debcdbb37eb63d8ce57b1358df81 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Wed, 13 Sep 2017 17:16:30 +0200 Subject: Reuse the groups tree for explore and dashboard. --- spec/features/dashboard/groups_list_spec.rb | 4 ++++ spec/features/explore/groups_list_spec.rb | 2 ++ 2 files changed, 6 insertions(+) (limited to 'spec/features') diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index 533df7a325c..227550e62be 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -6,6 +6,10 @@ feature 'Dashboard Groups page', :js do let!(:nested_group) { create(:group, :nested) } let!(:another_group) { create(:group) } + before do + pending('Update for new group tree') + end + it 'shows groups user is member of' do group.add_owner(user) nested_group.add_owner(user) diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb index b5325301968..fa3d8f97a09 100644 --- a/spec/features/explore/groups_list_spec.rb +++ b/spec/features/explore/groups_list_spec.rb @@ -8,6 +8,8 @@ describe 'Explore Groups page', :js do let!(:empty_project) { create(:project, group: public_group) } before do + pending('Update for new group tree') + group.add_owner(user) sign_in(user) -- cgit v1.2.1 From de55396134e9e3de429c5c6df55ff06efb8ba329 Mon Sep 17 00:00:00 2001 From: Kushal Pandya Date: Wed, 4 Oct 2017 14:10:24 +0000 Subject: Groups tree enhancements for Groups Dashboard and Group Homepage --- spec/features/dashboard/groups_list_spec.rb | 7 ++++--- spec/features/explore/groups_list_spec.rb | 13 +++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'spec/features') diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index 227550e62be..9cfef46d346 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -16,6 +16,7 @@ feature 'Dashboard Groups page', :js do sign_in(user) visit dashboard_groups_path + wait_for_requests expect(page).to have_content(group.full_name) expect(page).to have_content(nested_group.full_name) @@ -33,7 +34,7 @@ feature 'Dashboard Groups page', :js do end it 'filters groups' do - fill_in 'filter_groups', with: group.name + fill_in 'filter', with: group.name wait_for_requests expect(page).to have_content(group.full_name) @@ -42,10 +43,10 @@ feature 'Dashboard Groups page', :js do end it 'resets search when user cleans the input' do - fill_in 'filter_groups', with: group.name + fill_in 'filter', with: group.name wait_for_requests - fill_in 'filter_groups', with: '' + fill_in 'filter', with: '' wait_for_requests expect(page).to have_content(group.full_name) diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb index fa3d8f97a09..41778542e23 100644 --- a/spec/features/explore/groups_list_spec.rb +++ b/spec/features/explore/groups_list_spec.rb @@ -15,6 +15,7 @@ describe 'Explore Groups page', :js do sign_in(user) visit explore_groups_path + wait_for_requests end it 'shows groups user is member of' do @@ -24,7 +25,7 @@ describe 'Explore Groups page', :js do end it 'filters groups' do - fill_in 'filter_groups', with: group.name + fill_in 'filter', with: group.name wait_for_requests expect(page).to have_content(group.full_name) @@ -33,10 +34,10 @@ describe 'Explore Groups page', :js do end it 'resets search when user cleans the input' do - fill_in 'filter_groups', with: group.name + fill_in 'filter', with: group.name wait_for_requests - fill_in 'filter_groups', with: "" + fill_in 'filter', with: "" wait_for_requests expect(page).to have_content(group.full_name) @@ -47,21 +48,21 @@ describe 'Explore Groups page', :js do it 'shows non-archived projects count' do # Initially project is not archived - expect(find('.js-groups-list-holder .content-list li:first-child .stats span:first-child')).to have_text("1") + expect(find('.js-groups-list-holder .content-list li:first-child .stats .number-projects')).to have_text("1") # Archive project empty_project.archive! visit explore_groups_path # Check project count - expect(find('.js-groups-list-holder .content-list li:first-child .stats span:first-child')).to have_text("0") + expect(find('.js-groups-list-holder .content-list li:first-child .stats .number-projects')).to have_text("0") # Unarchive project empty_project.unarchive! visit explore_groups_path # Check project count - expect(find('.js-groups-list-holder .content-list li:first-child .stats span:first-child')).to have_text("1") + expect(find('.js-groups-list-holder .content-list li:first-child .stats .number-projects')).to have_text("1") end describe 'landing component' do -- cgit v1.2.1 From 10c70b19d0209fcf542dd03a0484d98b6a06ddd3 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Wed, 4 Oct 2017 16:52:06 -0500 Subject: fix admin_settings_spec --- spec/features/admin/admin_settings_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index c490dce7ab0..0a75e07e59d 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -73,7 +73,7 @@ feature 'Admin updates settings' do context 'sign-in restrictions', :js do it 'de-activates oauth sign-in source' do - find('.btn', text: 'GitLab.com').click + find('input#application_setting_enabled_oauth_sign_in_sources_[value=gitlab]').send_keys(:return) expect(find('.btn', text: 'GitLab.com')).not_to have_css('.active') end -- cgit v1.2.1 From 7449c45d458dae3a121d0c4511cef844dabb4177 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Wed, 4 Oct 2017 16:52:22 -0500 Subject: fix add_issues_modal_spec --- spec/features/boards/add_issues_modal_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/boards/add_issues_modal_spec.rb b/spec/features/boards/add_issues_modal_spec.rb index c480b5b7e34..862d97a508f 100644 --- a/spec/features/boards/add_issues_modal_spec.rb +++ b/spec/features/boards/add_issues_modal_spec.rb @@ -101,8 +101,8 @@ describe 'Issue Boards add issue modal', :js do click_button 'Cancel' end - first('.board-delete').click - + accept_confirm { first('.board-delete').click } + click_button('Add issues') wait_for_requests -- cgit v1.2.1 From 2fc45e4d7e7f476ed67d9e9b61e6c1c6820e7c00 Mon Sep 17 00:00:00 2001 From: "Vitaliy @blackst0ne Klachkov" Date: Thu, 5 Oct 2017 09:31:34 +1100 Subject: Replace the 'project/merge_requests.feature' spinach test with an rspec analog --- .../merge_requests/user_posts_diff_notes_spec.rb | 32 +--- .../user_accepts_merge_request_spec.rb | 19 +++ .../user_closes_merge_request_spec.rb | 21 +++ .../merge_requests/user_comments_on_commit_spec.rb | 19 +++ .../merge_requests/user_comments_on_diff_spec.rb | 172 +++++++++++++++++++++ .../user_comments_on_merge_request_spec.rb | 50 ++++++ .../user_creates_merge_request_spec.rb | 32 ++++ .../user_edits_merge_request_spec.rb | 25 +++ .../user_manages_subscription_spec.rb | 32 ++++ .../user_reopens_merge_request_spec.rb | 22 +++ .../user_sorts_merge_requests_spec.rb | 63 ++++++++ .../user_views_all_merge_requests_spec.rb | 15 ++ .../user_views_closed_merge_requests_spec.rb | 15 ++ .../merge_requests/user_views_diffs_spec.rb | 46 ++++++ .../user_views_merged_merge_requests_spec.rb | 15 ++ .../user_views_open_merge_request_spec.rb | 92 +++++++++++ .../user_views_open_merge_requests_spec.rb | 72 +++++++++ 17 files changed, 712 insertions(+), 30 deletions(-) create mode 100644 spec/features/projects/merge_requests/user_closes_merge_request_spec.rb create mode 100644 spec/features/projects/merge_requests/user_comments_on_commit_spec.rb create mode 100644 spec/features/projects/merge_requests/user_comments_on_diff_spec.rb create mode 100644 spec/features/projects/merge_requests/user_comments_on_merge_request_spec.rb create mode 100644 spec/features/projects/merge_requests/user_creates_merge_request_spec.rb create mode 100644 spec/features/projects/merge_requests/user_edits_merge_request_spec.rb create mode 100644 spec/features/projects/merge_requests/user_manages_subscription_spec.rb create mode 100644 spec/features/projects/merge_requests/user_reopens_merge_request_spec.rb create mode 100644 spec/features/projects/merge_requests/user_sorts_merge_requests_spec.rb create mode 100644 spec/features/projects/merge_requests/user_views_all_merge_requests_spec.rb create mode 100644 spec/features/projects/merge_requests/user_views_closed_merge_requests_spec.rb create mode 100644 spec/features/projects/merge_requests/user_views_diffs_spec.rb create mode 100644 spec/features/projects/merge_requests/user_views_merged_merge_requests_spec.rb create mode 100644 spec/features/projects/merge_requests/user_views_open_merge_request_spec.rb create mode 100644 spec/features/projects/merge_requests/user_views_open_merge_requests_spec.rb (limited to 'spec/features') diff --git a/spec/features/merge_requests/user_posts_diff_notes_spec.rb b/spec/features/merge_requests/user_posts_diff_notes_spec.rb index 2fb6d0b965f..e1ca4fe186c 100644 --- a/spec/features/merge_requests/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_diff_notes_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' feature 'Merge requests > User posts diff notes', :js do + include MergeRequestDiffHelpers + let(:user) { create(:user) } let(:merge_request) { create(:merge_request) } let(:project) { merge_request.source_project } @@ -244,36 +246,6 @@ feature 'Merge requests > User posts diff notes', :js do expect(line[:num]).not_to have_css comment_button_class end - def get_line_components(line_holder, diff_side = nil) - if diff_side.nil? - get_inline_line_components(line_holder) - else - get_parallel_line_components(line_holder, diff_side) - end - end - - def get_inline_line_components(line_holder) - { content: line_holder.find('.line_content', match: :first), num: line_holder.find('.diff-line-num', match: :first) } - end - - def get_parallel_line_components(line_holder, diff_side = nil) - side_index = diff_side == 'left' ? 0 : 1 - # Wait for `.line_content` - line_holder.find('.line_content', match: :first) - # Wait for `.diff-line-num` - line_holder.find('.diff-line-num', match: :first) - { content: line_holder.all('.line_content')[side_index], num: line_holder.all('.diff-line-num')[side_index] } - end - - def click_diff_line(line_holder, diff_side = nil) - line = get_line_components(line_holder, diff_side) - line[:content].hover - - expect(line[:num]).to have_css comment_button_class - - line[:num].find(comment_button_class).trigger 'click' - end - def write_comment_on_line(line_holder, diff_side) click_diff_line(line_holder, diff_side) diff --git a/spec/features/projects/merge_requests/user_accepts_merge_request_spec.rb b/spec/features/projects/merge_requests/user_accepts_merge_request_spec.rb index 6c0b5e279d5..c35ba2d7016 100644 --- a/spec/features/projects/merge_requests/user_accepts_merge_request_spec.rb +++ b/spec/features/projects/merge_requests/user_accepts_merge_request_spec.rb @@ -62,4 +62,23 @@ describe 'User accepts a merge request', :js do wait_for_requests end end + + context 'when modifying the merge commit message' do + before do + merge_request.mark_as_mergeable + + visit(merge_request_path(merge_request)) + end + + it 'accepts a merge request' do + click_button('Modify commit message') + fill_in('Commit message', with: 'wow such merge') + + click_button('Merge') + + page.within('.status-box') do + expect(page).to have_content('Merged') + end + end + end end diff --git a/spec/features/projects/merge_requests/user_closes_merge_request_spec.rb b/spec/features/projects/merge_requests/user_closes_merge_request_spec.rb new file mode 100644 index 00000000000..b257f447439 --- /dev/null +++ b/spec/features/projects/merge_requests/user_closes_merge_request_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe 'User closes a merge requests', :js do + let(:project) { create(:project, :repository) } + let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(merge_request_path(merge_request)) + end + + it 'closes a merge request' do + click_link('Close merge request', match: :first) + + expect(page).to have_content(merge_request.title) + expect(page).to have_content('Closed by') + end +end diff --git a/spec/features/projects/merge_requests/user_comments_on_commit_spec.rb b/spec/features/projects/merge_requests/user_comments_on_commit_spec.rb new file mode 100644 index 00000000000..0a952cfc2a9 --- /dev/null +++ b/spec/features/projects/merge_requests/user_comments_on_commit_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe 'User comments on a commit', :js do + include MergeRequestDiffHelpers + include RepoHelpers + + let(:project) { create(:project, :repository) } + let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_commit_path(project, sample_commit.id)) + end + + include_examples 'comment on merge request file' +end diff --git a/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb b/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb new file mode 100644 index 00000000000..f34302f25f8 --- /dev/null +++ b/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb @@ -0,0 +1,172 @@ +require 'spec_helper' + +describe 'User comments on a diff', :js do + include MergeRequestDiffHelpers + include RepoHelpers + + let(:project) { create(:project, :repository) } + let(:merge_request) do + create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test') + end + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(diffs_project_merge_request_path(project, merge_request)) + end + + context 'when viewing comments' do + context 'when toggling inline comments' do + context 'in a single file' do + it 'hides a comment' do + click_diff_line(find("[id='#{sample_compare.changes[1][:line_code]}']")) + + page.within('.js-discussion-note-form') do + fill_in('note_note', with: 'Line is wrong') + click_button('Comment') + end + + page.within('.files > div:nth-child(3)') do + expect(page).to have_content('Line is wrong') + + find('.js-toggle-diff-comments').trigger('click') + + expect(page).not_to have_content('Line is wrong') + end + end + end + + context 'in multiple files' do + it 'toggles comments' do + click_diff_line(find("[id='#{sample_compare.changes[0][:line_code]}']")) + + page.within('.js-discussion-note-form') do + fill_in('note_note', with: 'Line is correct') + click_button('Comment') + end + + wait_for_requests + + page.within('.files > div:nth-child(2) .note-body > .note-text') do + expect(page).to have_content('Line is correct') + end + + click_diff_line(find("[id='#{sample_compare.changes[1][:line_code]}']")) + + page.within('.js-discussion-note-form') do + fill_in('note_note', with: 'Line is wrong') + click_button('Comment') + end + + wait_for_requests + + # Hide the comment. + page.within('.files > div:nth-child(3)') do + find('.js-toggle-diff-comments').trigger('click') + + expect(page).not_to have_content('Line is wrong') + end + + # At this moment a user should see only one comment. + # The other one should be hidden. + page.within('.files > div:nth-child(2) .note-body > .note-text') do + expect(page).to have_content('Line is correct') + end + + # Show the comment. + page.within('.files > div:nth-child(3)') do + find('.js-toggle-diff-comments').trigger('click') + end + + # Now both the comments should be shown. + page.within('.files > div:nth-child(3) .note-body > .note-text') do + expect(page).to have_content('Line is wrong') + end + + page.within('.files > div:nth-child(2) .note-body > .note-text') do + expect(page).to have_content('Line is correct') + end + + # Check the same comments in the side-by-side view. + click_link('Side-by-side') + + wait_for_requests + + page.within('.files > div:nth-child(3) .parallel .note-body > .note-text') do + expect(page).to have_content('Line is wrong') + end + + page.within('.files > div:nth-child(2) .parallel .note-body > .note-text') do + expect(page).to have_content('Line is correct') + end + end + end + end + end + + context 'when adding comments' do + include_examples 'comment on merge request file' + end + + context 'when editing comments' do + it 'edits a comment' do + click_diff_line(find("[id='#{sample_commit.line_code}']")) + + page.within('.js-discussion-note-form') do + fill_in(:note_note, with: 'Line is wrong') + click_button('Comment') + end + + page.within('.diff-file:nth-of-type(5) .note') do + find('.js-note-edit').click + + page.within('.current-note-edit-form') do + fill_in('note_note', with: 'Typo, please fix') + click_button('Save comment') + end + + expect(page).not_to have_button('Save comment', disabled: true) + end + + page.within('.diff-file:nth-of-type(5) .note') do + expect(page).to have_content('Typo, please fix').and have_no_content('Line is wrong') + end + end + end + + context 'when deleting comments' do + it 'deletes a comment' do + click_diff_line(find("[id='#{sample_commit.line_code}']")) + + page.within('.js-discussion-note-form') do + fill_in(:note_note, with: 'Line is wrong') + click_button('Comment') + end + + page.within('.notes-tab .badge') do + expect(page).to have_content('1') + end + + page.within('.diff-file:nth-of-type(5) .note') do + find('.more-actions').click + find('.more-actions .dropdown-menu li', match: :first) + + find('.js-note-delete').click + end + + page.within('.merge-request-tabs') do + find('.notes-tab').trigger('click') + end + + wait_for_requests + + expect(page).not_to have_css('.notes .discussion') + + page.within('.notes-tab .badge') do + expect(page).to have_content('0') + end + end + end +end diff --git a/spec/features/projects/merge_requests/user_comments_on_merge_request_spec.rb b/spec/features/projects/merge_requests/user_comments_on_merge_request_spec.rb new file mode 100644 index 00000000000..2eb652147ce --- /dev/null +++ b/spec/features/projects/merge_requests/user_comments_on_merge_request_spec.rb @@ -0,0 +1,50 @@ +require 'spec_helper' + +describe 'User comments on a merge request', :js do + include RepoHelpers + + let(:project) { create(:project, :repository) } + let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(merge_request_path(merge_request)) + end + + it 'adds a comment' do + page.within('.js-main-target-form') do + fill_in(:note_note, with: '# Comment with a header') + click_button('Comment') + end + + wait_for_requests + + page.within('.note') do + expect(page).to have_content('Comment with a header') + expect(page).not_to have_css('#comment-with-a-header') + end + end + + it 'loads new comment' do + # Add new comment in background in order to check + # if it's going to be loaded automatically for current user. + create(:diff_note_on_merge_request, project: project, noteable: merge_request, author: user, note: 'Line is wrong') + + # Trigger a refresh of notes. + execute_script("$(document).trigger('visibilitychange');") + wait_for_requests + + page.within('.notes .discussion') do + expect(page).to have_content("#{user.name} #{user.to_reference} started a discussion") + expect(page).to have_content(sample_commit.line_code_path) + expect(page).to have_content('Line is wrong') + end + + page.within('.notes-tab .badge') do + expect(page).to have_content('1') + end + end +end diff --git a/spec/features/projects/merge_requests/user_creates_merge_request_spec.rb b/spec/features/projects/merge_requests/user_creates_merge_request_spec.rb new file mode 100644 index 00000000000..f285c6c8783 --- /dev/null +++ b/spec/features/projects/merge_requests/user_creates_merge_request_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +describe 'User creates a merge request', :js do + let(:project) { create(:project, :repository) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_new_merge_request_path(project)) + end + + it 'creates a merge request' do + find('.js-source-branch').click + click_link('fix') + + find('.js-target-branch').click + click_link('feature') + + click_button('Compare branches') + + fill_in('merge_request_title', with: 'Wiki Feature') + click_button('Submit merge request') + + page.within('.merge-request') do + expect(page).to have_content('Wiki Feature') + end + + wait_for_requests + end +end diff --git a/spec/features/projects/merge_requests/user_edits_merge_request_spec.rb b/spec/features/projects/merge_requests/user_edits_merge_request_spec.rb new file mode 100644 index 00000000000..f6e3997383f --- /dev/null +++ b/spec/features/projects/merge_requests/user_edits_merge_request_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe 'User edits a merge request', :js do + let(:project) { create(:project, :repository) } + let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(edit_project_merge_request_path(project, merge_request)) + end + + it 'changes the target branch' do + expect(page).to have_content('Target branch') + + first('.target_branch').click + select('merge-test', from: 'merge_request_target_branch', visible: false) + click_button('Save changes') + + expect(page).to have_content("Request to merge #{merge_request.source_branch} into merge-test") + expect(page).to have_content("changed target branch from #{merge_request.target_branch} to merge-test") + end +end diff --git a/spec/features/projects/merge_requests/user_manages_subscription_spec.rb b/spec/features/projects/merge_requests/user_manages_subscription_spec.rb new file mode 100644 index 00000000000..30a80f8e652 --- /dev/null +++ b/spec/features/projects/merge_requests/user_manages_subscription_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +describe 'User manages subscription', :js do + let(:project) { create(:project, :public, :repository) } + let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(merge_request_path(merge_request)) + end + + it 'toggles subscription' do + subscribe_button = find('.issuable-subscribe-button span') + + expect(subscribe_button).to have_content('Subscribe') + + click_on('Subscribe') + + wait_for_requests + + expect(subscribe_button).to have_content('Unsubscribe') + + click_on('Unsubscribe') + + wait_for_requests + + expect(subscribe_button).to have_content('Subscribe') + end +end diff --git a/spec/features/projects/merge_requests/user_reopens_merge_request_spec.rb b/spec/features/projects/merge_requests/user_reopens_merge_request_spec.rb new file mode 100644 index 00000000000..ba3c9789da1 --- /dev/null +++ b/spec/features/projects/merge_requests/user_reopens_merge_request_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe 'User reopens a merge requests', :js do + let(:project) { create(:project, :public, :repository) } + let!(:merge_request) { create(:closed_merge_request, source_project: project, target_project: project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(merge_request_path(merge_request)) + end + + it 'reopens a merge request' do + click_link('Reopen merge request', match: :first) + + page.within('.status-box') do + expect(page).to have_content('Open') + end + end +end diff --git a/spec/features/projects/merge_requests/user_sorts_merge_requests_spec.rb b/spec/features/projects/merge_requests/user_sorts_merge_requests_spec.rb new file mode 100644 index 00000000000..d8d9f7e2a8c --- /dev/null +++ b/spec/features/projects/merge_requests/user_sorts_merge_requests_spec.rb @@ -0,0 +1,63 @@ +require 'spec_helper' + +describe 'User sorts merge requests' do + let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let!(:merge_request2) do + create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test') + end + let(:project) { create(:project, :public, :repository) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_merge_requests_path(project)) + end + + it 'keeps the sort option' do + find('button.dropdown-toggle').click + + page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do + click_link('Last updated') + end + + visit(merge_requests_dashboard_path(assignee_id: user.id)) + + expect(find('.issues-filters')).to have_content('Last updated') + + visit(project_merge_requests_path(project)) + + expect(find('.issues-filters')).to have_content('Last updated') + end + + context 'when merge requests have awards' do + before do + create_list(:award_emoji, 2, awardable: merge_request) + create(:award_emoji, :downvote, awardable: merge_request) + + create(:award_emoji, awardable: merge_request2) + create_list(:award_emoji, 2, :downvote, awardable: merge_request2) + end + + it 'sorts by popularity' do + find('button.dropdown-toggle').click + + page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do + click_link('Popularity') + end + + page.within('.mr-list') do + page.within('li.merge-request:nth-child(1)') do + expect(page).to have_content(merge_request.title) + expect(page).to have_content('2 1') + end + + page.within('li.merge-request:nth-child(2)') do + expect(page).to have_content(merge_request2.title) + expect(page).to have_content('1 2') + end + end + end + end +end diff --git a/spec/features/projects/merge_requests/user_views_all_merge_requests_spec.rb b/spec/features/projects/merge_requests/user_views_all_merge_requests_spec.rb new file mode 100644 index 00000000000..6c695bd7aa9 --- /dev/null +++ b/spec/features/projects/merge_requests/user_views_all_merge_requests_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe 'User views all merge requests' do + let!(:closed_merge_request) { create(:closed_merge_request, source_project: project, target_project: project) } + let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let(:project) { create(:project, :public) } + + before do + visit(project_merge_requests_path(project, state: :all)) + end + + it 'shows all merge requests' do + expect(page).to have_content(merge_request.title).and have_content(closed_merge_request.title) + end +end diff --git a/spec/features/projects/merge_requests/user_views_closed_merge_requests_spec.rb b/spec/features/projects/merge_requests/user_views_closed_merge_requests_spec.rb new file mode 100644 index 00000000000..853809fe87a --- /dev/null +++ b/spec/features/projects/merge_requests/user_views_closed_merge_requests_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe 'User views closed merge requests' do + let!(:closed_merge_request) { create(:closed_merge_request, source_project: project, target_project: project) } + let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let(:project) { create(:project, :public) } + + before do + visit(project_merge_requests_path(project, state: :closed)) + end + + it 'shows closed merge requests' do + expect(page).to have_content(closed_merge_request.title).and have_no_content(merge_request.title) + end +end diff --git a/spec/features/projects/merge_requests/user_views_diffs_spec.rb b/spec/features/projects/merge_requests/user_views_diffs_spec.rb new file mode 100644 index 00000000000..295eb02b625 --- /dev/null +++ b/spec/features/projects/merge_requests/user_views_diffs_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' + +describe 'User views diffs', :js do + let(:merge_request) do + create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test') + end + let(:project) { create(:project, :public, :repository) } + + before do + visit(diffs_project_merge_request_path(project, merge_request)) + + wait_for_requests + end + + shared_examples 'unfold diffs' do + it 'unfolds diffs' do + first('.js-unfold').click + + expect(first('.text-file')).to have_content('.bundle') + end + end + + it 'shows diffs' do + expect(page).to have_css('.tab-content #diffs.active') + expect(page).to have_css('#parallel-diff-btn', count: 1) + expect(page).to have_css('#inline-diff-btn', count: 1) + end + + context 'when in the inline view' do + include_examples 'unfold diffs' + end + + context 'when in the side-by-side view' do + before do + click_link('Side-by-side') + + wait_for_requests + end + + it 'shows diffs in parallel' do + expect(page).to have_css('.parallel') + end + + include_examples 'unfold diffs' + end +end diff --git a/spec/features/projects/merge_requests/user_views_merged_merge_requests_spec.rb b/spec/features/projects/merge_requests/user_views_merged_merge_requests_spec.rb new file mode 100644 index 00000000000..eb012694f1e --- /dev/null +++ b/spec/features/projects/merge_requests/user_views_merged_merge_requests_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe 'User views merged merge requests' do + let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let!(:merged_merge_request) { create(:merged_merge_request, source_project: project, target_project: project) } + let(:project) { create(:project, :public) } + + before do + visit(project_merge_requests_path(project, state: :merged)) + end + + it 'shows merged merge requests' do + expect(page).to have_content(merged_merge_request.title).and have_no_content(merge_request.title) + end +end diff --git a/spec/features/projects/merge_requests/user_views_open_merge_request_spec.rb b/spec/features/projects/merge_requests/user_views_open_merge_request_spec.rb new file mode 100644 index 00000000000..8970cf54457 --- /dev/null +++ b/spec/features/projects/merge_requests/user_views_open_merge_request_spec.rb @@ -0,0 +1,92 @@ +require 'spec_helper' + +describe 'User views an open merge request' do + let(:merge_request) do + create(:merge_request, source_project: project, target_project: project, description: '# Description header') + end + + context 'when a merge request does not have repository' do + let(:project) { create(:project, :public) } + + before do + visit(merge_request_path(merge_request)) + end + + it 'renders both the title and the description' do + node = find('.wiki h1 a#user-content-description-header') + expect(node[:href]).to end_with('#description-header') + + # Work around a weird Capybara behavior where calling `parent` on a node + # returns the whole document, not the node's actual parent element + expect(find(:xpath, "#{node.path}/..").text).to eq(merge_request.description[2..-1]) + + expect(page).to have_content(merge_request.title).and have_content(merge_request.description) + end + end + + context 'when a merge request has repository', :js do + let(:project) { create(:project, :public, :repository) } + + context 'when rendering description preview' do + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(edit_project_merge_request_path(project, merge_request)) + end + + it 'renders empty description preview' do + find('.gfm-form').fill_in(:merge_request_description, with: '') + + page.within('.gfm-form') do + click_link('Preview') + + expect(find('.js-md-preview')).to have_content('Nothing to preview.') + end + end + + it 'renders description preview' do + find('.gfm-form').fill_in(:merge_request_description, with: ':+1: Nice') + + page.within('.gfm-form') do + click_link('Preview') + + expect(find('.js-md-preview')).to have_css('gl-emoji') + end + + expect(find('.gfm-form')).to have_css('.js-md-preview').and have_link('Write') + expect(find('#merge_request_description', visible: false)).not_to be_visible + end + end + + context 'when the branch is rebased on the target' do + let(:merge_request) { create(:merge_request, :rebased, source_project: project, target_project: project) } + + before do + visit(merge_request_path(merge_request)) + end + + it 'does not show diverged commits count' do + page.within('.mr-source-target') do + expect(page).not_to have_content(/([0-9]+ commit[s]? behind)/) + end + end + end + + context 'when the branch is diverged on the target' do + let(:merge_request) { create(:merge_request, :diverged, source_project: project, target_project: project) } + + before do + visit(merge_request_path(merge_request)) + end + + it 'shows diverged commits count' do + page.within('.mr-source-target') do + expect(page).to have_content(/([0-9]+ commits behind)/) + end + end + end + end +end diff --git a/spec/features/projects/merge_requests/user_views_open_merge_requests_spec.rb b/spec/features/projects/merge_requests/user_views_open_merge_requests_spec.rb new file mode 100644 index 00000000000..07b8c1ef479 --- /dev/null +++ b/spec/features/projects/merge_requests/user_views_open_merge_requests_spec.rb @@ -0,0 +1,72 @@ +require 'spec_helper' + +describe 'User views open merge requests' do + let(:project) { create(:project, :public, :repository) } + + context "when the target branch is the project's default branch" do + let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let!(:closed_merge_request) { create(:closed_merge_request, source_project: project, target_project: project) } + + before do + visit(project_merge_requests_path(project)) + end + + it 'shows open merge requests' do + expect(page).to have_content(merge_request.title).and have_no_content(closed_merge_request.title) + end + + it 'does not show target branch name' do + expect(page).to have_content(merge_request.title) + expect(find('.issuable-info')).not_to have_content(project.default_branch) + end + end + + context "when the target branch is different from the project's default branch" do + let!(:merge_request) do + create(:merge_request, + source_project: project, + target_project: project, + source_branch: 'fix', + target_branch: 'feature_conflict') + end + + before do + visit(project_merge_requests_path(project)) + end + + it 'shows target branch name' do + expect(page).to have_content(merge_request.target_branch) + end + end + + context 'when a merge request has pipelines' do + let!(:build) { create :ci_build, pipeline: pipeline } + + let(:merge_request) do + create(:merge_request_with_diffs, + source_project: project, + target_project: project, + source_branch: 'merge-test') + end + + let(:pipeline) do + create(:ci_pipeline, + project: project, + sha: merge_request.diff_head_sha, + ref: merge_request.source_branch, + head_pipeline_of: merge_request) + end + + before do + project.enable_ci + + visit(project_merge_requests_path(project)) + end + + it 'shows pipeline status' do + page.within('.mr-list') do + expect(page).to have_link('Pipeline: pending') + end + end + end +end -- cgit v1.2.1 From 6a5b2fe8943190cff40e6e2c5dbc629fa4540151 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Mon, 2 Oct 2017 11:11:18 -0500 Subject: Allow merge when no pipeline success Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/38389 --- spec/features/merge_requests/widget_spec.rb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/widget_spec.rb b/spec/features/merge_requests/widget_spec.rb index 791cfa308c3..ab1353e3369 100644 --- a/spec/features/merge_requests/widget_spec.rb +++ b/spec/features/merge_requests/widget_spec.rb @@ -3,10 +3,13 @@ require 'rails_helper' describe 'Merge request', :js do let(:user) { create(:user) } let(:project) { create(:project, :repository) } + let(:project_only_mwps) { create(:project, :repository, only_allow_merge_if_pipeline_succeeds: true) } let(:merge_request) { create(:merge_request, source_project: project) } + let(:merge_request_in_only_mwps_project) { create(:merge_request, source_project: project_only_mwps) } before do - project.team << [user, :master] + project.add_master(user) + project_only_mwps.add_master(user) sign_in(user) end @@ -160,6 +163,20 @@ describe 'Merge request', :js do end end + context 'view merge request in project with only-mwps setting enabled but no CI is setup' do + before do + visit project_merge_request_path(project_only_mwps, merge_request_in_only_mwps_project) + end + + it 'should be allowed to merge' do + # Wait for the `ci_status` and `merge_check` requests + wait_for_requests + + expect(page).to have_selector('.accept-merge-request') + expect(find('.accept-merge-request')['disabled']).not_to be(true) + end + end + context 'view merge request with MWPS enabled but automatically merge fails' do before do merge_request.update( -- cgit v1.2.1 From 599fb7ef7f042594021ca0d26d938683fbe1206d Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 3 Oct 2017 13:24:56 +0200 Subject: Add feature specs for pipeline failure reason badge --- spec/features/projects/pipelines/pipelines_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/features') diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index f7b40cb1820..92486d2bc57 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -162,6 +162,16 @@ describe 'Pipelines', :js do expect(page).to have_selector( %Q{span[data-original-title="#{pipeline.yaml_errors}"]}) end + + it 'contains badge that indicates failure reason' do + expect(page).to have_content 'error' + end + + it 'contains badge with tooltip which contains failure reason' do + expect(pipeline.failure_reason?).to eq true + expect(page).to have_selector( + %Q{span[data-original-title="#{pipeline.present.failure_reason}"]}) + end end context 'with manual actions' do -- cgit v1.2.1 From e4d07f12b65fa8d1753a950a79c985406614c2b1 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Thu, 5 Oct 2017 12:41:22 +0200 Subject: Test against public projects --- spec/features/projects/artifacts/browse_spec.rb | 38 +++++++++++++++++++------ 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/artifacts/browse_spec.rb b/spec/features/projects/artifacts/browse_spec.rb index fe485334192..cb69aff8d5f 100644 --- a/spec/features/projects/artifacts/browse_spec.rb +++ b/spec/features/projects/artifacts/browse_spec.rb @@ -28,18 +28,40 @@ feature 'Browse artifact', :js do before do allow(Gitlab.config.pages).to receive(:enabled).and_return(true) allow(Gitlab.config.pages).to receive(:artifacts_server).and_return(true) + end + + context 'when the project is public' do + it "shows external link icon and styles" do + visit browse_url + + link = first('.tree-item-file-external-link') - visit browse_url + expect(page).to have_link('doc_sample.txt', href: file_project_job_artifacts_path(project, job, path: txt_entry.blob.path)) + expect(link[:target]).to eq('_blank') + expect(link[:rel]).to include('noopener') + expect(link[:rel]).to include('noreferrer') + expect(page).to have_selector('.js-artifact-tree-external-icon') + end end - it "shows external link icon and styles" do - link = first('.tree-item-file-external-link') + context 'when the project is private' do + let!(:private_project) { create(:project, :private) } + let(:pipeline) { create(:ci_empty_pipeline, project: private_project) } + let(:job) { create(:ci_build, :artifacts, pipeline: pipeline) } + let(:user) { create(:user) } + + before do + private_project.add_developer(user) + + sign_in(user) + end + + it 'shows internal link styles' do + visit browse_project_job_artifacts_path(private_project, job, 'other_artifacts_0.1.2') - expect(page).to have_link('doc_sample.txt', href: file_project_job_artifacts_path(project, job, path: txt_entry.blob.path)) - expect(link[:target]).to eq('_blank') - expect(link[:rel]).to include('noopener') - expect(link[:rel]).to include('noreferrer') - expect(page).to have_selector('.js-artifact-tree-external-icon') + expect(page).to have_link('doc_sample.txt') + expect(page).not_to have_selector('.js-artifact-tree-external-icon') + end end end end -- cgit v1.2.1 From 17dccc35ca4754405b87c87f81daec34e02ea7a1 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Thu, 5 Oct 2017 13:13:24 +0200 Subject: Update feature specs for updated group lists --- spec/features/dashboard/groups_list_spec.rb | 65 ++++++++++++++++------------- spec/features/explore/groups_list_spec.rb | 2 - spec/features/groups_spec.rb | 17 +++----- 3 files changed, 43 insertions(+), 41 deletions(-) (limited to 'spec/features') diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index 9cfef46d346..c9d9371f5ab 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -6,8 +6,11 @@ feature 'Dashboard Groups page', :js do let!(:nested_group) { create(:group, :nested) } let!(:another_group) { create(:group) } - before do - pending('Update for new group tree') + def click_group_caret(group) + within("#group-#{group.id}") do + first('.folder-caret').click + end + wait_for_requests end it 'shows groups user is member of' do @@ -18,9 +21,13 @@ feature 'Dashboard Groups page', :js do visit dashboard_groups_path wait_for_requests - expect(page).to have_content(group.full_name) - expect(page).to have_content(nested_group.full_name) - expect(page).not_to have_content(another_group.full_name) + expect(page).to have_content(group.name) + expect(page).to have_content(nested_group.parent.name) + + click_group_caret(nested_group.parent) + expect(page).to have_content(nested_group.name) + + expect(page).not_to have_content(another_group.name) end describe 'when filtering groups' do @@ -33,13 +40,14 @@ feature 'Dashboard Groups page', :js do visit dashboard_groups_path end - it 'filters groups' do - fill_in 'filter', with: group.name + it 'expands when filtering groups' do + fill_in 'filter', with: nested_group.name wait_for_requests - expect(page).to have_content(group.full_name) - expect(page).not_to have_content(nested_group.full_name) - expect(page).not_to have_content(another_group.full_name) + expect(page).not_to have_content(group.name) + expect(page).to have_content(nested_group.parent.name) + expect(page).to have_content(nested_group.name) + expect(page).not_to have_content(another_group.name) end it 'resets search when user cleans the input' do @@ -49,9 +57,9 @@ feature 'Dashboard Groups page', :js do fill_in 'filter', with: '' wait_for_requests - expect(page).to have_content(group.full_name) - expect(page).to have_content(nested_group.full_name) - expect(page).not_to have_content(another_group.full_name) + expect(page).to have_content(group.name) + expect(page).to have_content(nested_group.parent.name) + expect(page).not_to have_content(another_group.name) expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2 end end @@ -69,28 +77,29 @@ feature 'Dashboard Groups page', :js do end it 'shows subgroups inside of its parent group' do - expect(page).to have_selector('.groups-list-tree-container .group-list-tree', count: 2) - expect(page).to have_selector(".groups-list-tree-container #group-#{group.id} #group-#{subgroup.id}", count: 1) + expect(page).to have_selector("#group-#{group.id}") + click_group_caret(group) + expect(page).to have_selector("#group-#{group.id} #group-#{subgroup.id}") end it 'can toggle parent group' do - # Expanded by default - expect(page).to have_selector("#group-#{group.id} .fa-caret-down", count: 1) - expect(page).not_to have_selector("#group-#{group.id} .fa-caret-right") + # Collapsed by default + expect(page).not_to have_selector("#group-#{group.id} .fa-caret-down", count: 1) + expect(page).to have_selector("#group-#{group.id} .fa-caret-right") - # Collapse - find("#group-#{group.id}").trigger('click') + # expand + click_group_caret(group) - expect(page).not_to have_selector("#group-#{group.id} .fa-caret-down") - expect(page).to have_selector("#group-#{group.id} .fa-caret-right", count: 1) - expect(page).not_to have_selector("#group-#{group.id} #group-#{subgroup.id}") + expect(page).to have_selector("#group-#{group.id} .fa-caret-down") + expect(page).not_to have_selector("#group-#{group.id} .fa-caret-right", count: 1) + expect(page).to have_selector("#group-#{group.id} #group-#{subgroup.id}") - # Expand - find("#group-#{group.id}").trigger('click') + # collapse + click_group_caret(group) - expect(page).to have_selector("#group-#{group.id} .fa-caret-down", count: 1) - expect(page).not_to have_selector("#group-#{group.id} .fa-caret-right") - expect(page).to have_selector("#group-#{group.id} #group-#{subgroup.id}") + expect(page).not_to have_selector("#group-#{group.id} .fa-caret-down", count: 1) + expect(page).to have_selector("#group-#{group.id} .fa-caret-right") + expect(page).not_to have_selector("#group-#{group.id} #group-#{subgroup.id}") end end diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb index 41778542e23..801a33979ff 100644 --- a/spec/features/explore/groups_list_spec.rb +++ b/spec/features/explore/groups_list_spec.rb @@ -8,8 +8,6 @@ describe 'Explore Groups page', :js do let!(:empty_project) { create(:project, group: public_group) } before do - pending('Update for new group tree') - group.add_owner(user) sign_in(user) diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index 493dd551d25..da2edd8b980 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -90,11 +90,7 @@ feature 'Group' do context 'as admin' do before do - visit group_path(group) - - pending('use the new subgroup button') - - click_link 'New Subgroup' + visit new_group_path(group, parent_id: group.id) end it 'creates a nested group' do @@ -114,11 +110,8 @@ feature 'Group' do sign_out(:user) sign_in(user) - visit group_path(group) - - pending('use the new subgroup button') + visit new_group_path(group, parent_id: group.id) - click_link 'New Subgroup' fill_in 'Group path', with: 'bar' click_button 'Create group' @@ -206,13 +199,15 @@ feature 'Group' do describe 'group page with nested groups', :nested_groups, js: true do let!(:group) { create(:group) } let!(:nested_group) { create(:group, parent: group) } + let!(:project) { create(:project, namespace: group) } let!(:path) { group_path(group) } - it 'has nested groups tab with nested groups inside' do - pending('the child should be visible on the show page') + it 'it renders projects and groups on the page' do visit path + wait_for_requests expect(page).to have_content(nested_group.name) + expect(page).to have_content(project.name) end end -- cgit v1.2.1 From 4e88ca12060df0c6e73a1eed74d6a7f6e42d7b58 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Thu, 5 Oct 2017 14:23:01 +0200 Subject: Hide "New subgroup" links when subgroups are not supported --- spec/features/groups/show_spec.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'spec/features') diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb index 303013e59d5..501086fce80 100644 --- a/spec/features/groups/show_spec.rb +++ b/spec/features/groups/show_spec.rb @@ -24,4 +24,34 @@ feature 'Group show page' do it_behaves_like "an autodiscoverable RSS feed without an RSS token" end + + context 'subgroup support' do + let(:user) { create(:user) } + + before do + group.add_owner(user) + sign_in(user) + end + context 'when subgroups are supported', :js do + before do + allow(Group).to receive(:supports_nested_groups?) { true } + visit path + end + + it 'allows creating subgroups' do + expect(page).to have_css("li[data-text='New subgroup']", visible: false) + end + end + + context 'when subgroups are not supported' do + before do + allow(Group).to receive(:supports_nested_groups?) { false } + visit path + end + + it 'allows creating subgroups' do + expect(page).not_to have_selector("li[data-text='New subgroup']", visible: false) + end + end + end end -- cgit v1.2.1 From 866ef2bb2ed601618c77d39f3462ddca9601bc44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20D=C3=A1vila?= Date: Thu, 28 Sep 2017 19:57:49 -0500 Subject: Add more specs to cover subkeys scenarios --- spec/features/profiles/gpg_keys_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'spec/features') diff --git a/spec/features/profiles/gpg_keys_spec.rb b/spec/features/profiles/gpg_keys_spec.rb index b0f6848bc4b..59233e92f93 100644 --- a/spec/features/profiles/gpg_keys_spec.rb +++ b/spec/features/profiles/gpg_keys_spec.rb @@ -20,6 +20,18 @@ feature 'Profile > GPG Keys' do expect(page).to have_content('bette.cartwright@example.net Unverified') expect(page).to have_content(GpgHelpers::User2.fingerprint) end + + scenario 'with multiple subkeys' do + fill_in('Key', with: GpgHelpers::User3.public_key) + click_button('Add key') + + expect(page).to have_content('john.doe@example.com Unverified') + expect(page).to have_content(GpgHelpers::User3.fingerprint) + + GpgHelpers::User3.subkey_fingerprints.each do |fingerprint| + expect(page).to have_content(fingerprint) + end + end end scenario 'User sees their key' do -- cgit v1.2.1 From 44baf2b0f4fdfe7402014484ad71a7d497d28088 Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Thu, 5 Oct 2017 23:58:05 +0900 Subject: spec/features/projects/clusters_spec. Fix static analysys --- spec/features/projects/clusters_spec.rb | 111 ++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 spec/features/projects/clusters_spec.rb (limited to 'spec/features') diff --git a/spec/features/projects/clusters_spec.rb b/spec/features/projects/clusters_spec.rb new file mode 100644 index 00000000000..b836427513d --- /dev/null +++ b/spec/features/projects/clusters_spec.rb @@ -0,0 +1,111 @@ +require 'spec_helper' + +feature 'Clusters', :js do + let!(:project) { create(:project, :repository) } + let!(:user) { create(:user) } + + before do + project.add_master(user) + gitlab_sign_in(user) + end + + context 'when user has signed in Google' do + before do + allow_any_instance_of(GoogleApi::CloudPlatform::Client) + .to receive(:validate_token).and_return(true) + end + + context 'when user does not have a cluster and visits cluster index page' do + before do + visit project_clusters_path(project) + end + + it 'user sees a new page' do + expect(page).to have_button('Create cluster') + end + + context 'when user filled form with valid parameters' do + before do + double.tap do |dbl| + allow(dbl).to receive(:status).and_return('RUNNING') + allow(dbl).to receive(:self_link) + .and_return('projects/gcp-project-12345/zones/us-central1-a/operations/ope-123') + allow_any_instance_of(GoogleApi::CloudPlatform::Client) + .to receive(:projects_zones_clusters_create).and_return(dbl) + end + + allow(WaitForClusterCreationWorker).to receive(:perform_in).and_return(nil) + + fill_in 'cluster_gcp_project_id', with: 'gcp-project-123' + fill_in 'cluster_gcp_cluster_name', with: 'dev-cluster' + click_button 'Create cluster' + end + + it 'user sees a cluster details page and creation status' do + expect(page).to have_content('Cluster is being created on Google Container Engine...') + + Gcp::Cluster.last.make_created! + + expect(page).to have_content('Cluster was successfully created on Google Container Engine.') + end + end + + context 'when user filled form with invalid parameters' do + before do + click_button 'Create cluster' + end + + it 'user sees a validation error' do + expect(page).to have_css('#error_explanation') + end + end + end + + context 'when user has a cluster and visits cluster index page' do + let!(:cluster) { create(:gcp_cluster, :created_on_gke, :with_kubernetes_service, project: project) } + + before do + visit project_clusters_path(project) + end + + it 'user sees an cluster details page' do + expect(page).to have_button('Save changes') + expect(page.find(:css, '.cluster-name').value).to eq(cluster.gcp_cluster_name) + end + + context 'when user disables the cluster' do + before do + page.find(:css, '.js-toggle-cluster').click + click_button 'Save changes' + end + + it 'user sees the succeccful message' do + expect(page).to have_content('Cluster was successfully updated.') + end + end + + context 'when user destory the cluster' do + before do + page.accept_confirm do + click_link 'Remove integration' + end + end + + it 'user sees creation form with the succeccful message' do + expect(page).to have_content('Cluster was successfully removed.') + expect(page).to have_button('Create cluster') + end + end + end + end + + context 'when user has not signed in Google' do + before do + visit project_clusters_path(project) + end + + it 'user sees a login page' do + expect(page).to have_css('.signin-with-google') + end + end +end -- cgit v1.2.1 From 4cda11585c75ce923d357b0dbb91fb393ed8e303 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Thu, 5 Oct 2017 21:33:29 +0200 Subject: Fix almost all unresolved comments from Docs and UX review --- spec/features/projects/clusters_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/clusters_spec.rb b/spec/features/projects/clusters_spec.rb index b836427513d..7f33629c938 100644 --- a/spec/features/projects/clusters_spec.rb +++ b/spec/features/projects/clusters_spec.rb @@ -46,7 +46,7 @@ feature 'Clusters', :js do Gcp::Cluster.last.make_created! - expect(page).to have_content('Cluster was successfully created on Google Container Engine.') + expect(page).to have_content('Cluster was successfully created on Google Container Engine') end end @@ -92,7 +92,7 @@ feature 'Clusters', :js do end it 'user sees creation form with the succeccful message' do - expect(page).to have_content('Cluster was successfully removed.') + expect(page).to have_content('Cluster integration was successfully removed.') expect(page).to have_button('Create cluster') end end -- cgit v1.2.1 From 035bf5d4d5d3209286aa257cbd56ec6ce9e1afb9 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Thu, 5 Oct 2017 16:13:21 -0500 Subject: fix create_snipper and diff_notes specs --- spec/features/merge_requests/user_posts_diff_notes_spec.rb | 6 +++--- spec/features/projects/snippets/create_snippet_spec.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/user_posts_diff_notes_spec.rb b/spec/features/merge_requests/user_posts_diff_notes_spec.rb index 3b873d6f53c..8179100ef0d 100644 --- a/spec/features/merge_requests/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_diff_notes_spec.rb @@ -76,7 +76,7 @@ feature 'Merge requests > User posts diff notes', :js do context 'with an unfolded line' do before do - find('.js-unfold', match: :first).click + find('.js-unfold', match: :first).send_keys(:return) wait_for_requests end @@ -103,7 +103,7 @@ feature 'Merge requests > User posts diff notes', :js do it 'allows commenting' do should_allow_commenting(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]')) - first('.js-note-delete', visible: false).trigger('click') + first('.js-note-delete', visible: false).click should_allow_commenting(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]')) end @@ -135,7 +135,7 @@ feature 'Merge requests > User posts diff notes', :js do context 'with an unfolded line' do before do - find('.js-unfold', match: :first).click + find('.js-unfold', match: :first).send_keys(:return) wait_for_requests end diff --git a/spec/features/projects/snippets/create_snippet_spec.rb b/spec/features/projects/snippets/create_snippet_spec.rb index 7dc779fa573..e4215291f99 100644 --- a/spec/features/projects/snippets/create_snippet_spec.rb +++ b/spec/features/projects/snippets/create_snippet_spec.rb @@ -10,7 +10,7 @@ feature 'Create Snippet', :js do fill_in 'project_snippet_title', with: 'My Snippet Title' fill_in 'project_snippet_description', with: 'My Snippet **Description**' page.within('.file-editor') do - find('.ace_text-input').native.send_keys('Hello World!') + find('.ace_text-input', visible: false).send_keys('Hello World!') end end @@ -59,7 +59,7 @@ feature 'Create Snippet', :js do fill_form dropzone_file Rails.root.join('spec', 'fixtures', 'banana_sample.gif') - click_button('Create snippet') + find("input[value='Create snippet']").send_keys(:return) wait_for_requests expect(page).to have_content('My Snippet Title') -- cgit v1.2.1 From 10dfa99342f153e6c9c87c85fd05da884d2c37b4 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Thu, 5 Oct 2017 16:41:57 -0500 Subject: fix protected_branch spec describe block --- spec/features/protected_branches_spec.rb | 35 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'spec/features') diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index 44c20d4a8d5..aaf3d6d28ca 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -60,6 +60,23 @@ feature 'Protected Branches', :js do expect(page).to have_content('No branches to show') end end + + describe "Saved defaults" do + it "keeps the allowed to merge and push dropdowns defaults based on the previous selection" do + visit project_protected_branches_path(project) + find(".js-allowed-to-merge").trigger('click') + click_link 'No one' + find(".js-allowed-to-push").trigger('click') + click_link 'Developers + Masters' + visit project_protected_branches_path(project) + page.within(".js-allowed-to-merge") do + expect(page.find(".dropdown-toggle-text")).to have_content("No one") + end + page.within(".js-allowed-to-push") do + expect(page.find(".dropdown-toggle-text")).to have_content("Developers + Masters") + end + end + end end context 'logged in as admin' do @@ -150,22 +167,4 @@ feature 'Protected Branches', :js do find(".dropdown-input-field").set(branch_name) click_on("Create wildcard #{branch_name}") end - - describe "saved defaults" do - it "keeps the allowed to merge and push dropdowns defaults based on the previous selection" do - visit project_protected_branches_path(project) - set_protected_branch_name('some-branch') - find(".js-allowed-to-merge").trigger('click') - click_link 'No one' - find(".js-allowed-to-push").trigger('click') - click_link 'Developers + Masters' - visit project_protected_branches_path(project) - page.within(".js-allowed-to-merge") do - expect(page.find(".dropdown-toggle-text")).to have_content("No one") - end - page.within(".js-allowed-to-push") do - expect(page.find(".dropdown-toggle-text")).to have_content("Developers + Masters") - end - end - end end -- cgit v1.2.1 From f9d490dbb910cdd05ca0a0fa38331708181e4b1e Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Fri, 6 Oct 2017 16:14:14 +0200 Subject: Improve redirect uri state and fix all remaining tests --- spec/features/projects/clusters_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/clusters_spec.rb b/spec/features/projects/clusters_spec.rb index 7f33629c938..810f2c39b43 100644 --- a/spec/features/projects/clusters_spec.rb +++ b/spec/features/projects/clusters_spec.rb @@ -69,14 +69,14 @@ feature 'Clusters', :js do end it 'user sees an cluster details page' do - expect(page).to have_button('Save changes') + expect(page).to have_button('Save') expect(page.find(:css, '.cluster-name').value).to eq(cluster.gcp_cluster_name) end context 'when user disables the cluster' do before do page.find(:css, '.js-toggle-cluster').click - click_button 'Save changes' + click_button 'Save' end it 'user sees the succeccful message' do -- cgit v1.2.1 From 0f366c74131339cb45c8943437fe5b3e68721c75 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 6 Oct 2017 14:42:01 +0100 Subject: Fixed default group sort option Closes #38808 --- spec/features/dashboard/group_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'spec/features') diff --git a/spec/features/dashboard/group_spec.rb b/spec/features/dashboard/group_spec.rb index 60a16830cdc..3e61fafff69 100644 --- a/spec/features/dashboard/group_spec.rb +++ b/spec/features/dashboard/group_spec.rb @@ -5,6 +5,12 @@ RSpec.describe 'Dashboard Group' do sign_in(create(:user)) end + it 'defaults sort dropdown to last created' do + visit dashboard_groups_path + + expect(page).to have_button('Last created') + end + it 'creates new group', js: true do visit dashboard_groups_path find('.btn-new').trigger('click') -- cgit v1.2.1 From bc45fd78df153bec48bc759cddc370fba934d447 Mon Sep 17 00:00:00 2001 From: kushalpandya Date: Fri, 6 Oct 2017 18:27:18 +0530 Subject: Remove unnecessary test --- spec/features/explore/new_menu_spec.rb | 6 ------ 1 file changed, 6 deletions(-) (limited to 'spec/features') diff --git a/spec/features/explore/new_menu_spec.rb b/spec/features/explore/new_menu_spec.rb index e1c74a24890..c5ec495a418 100644 --- a/spec/features/explore/new_menu_spec.rb +++ b/spec/features/explore/new_menu_spec.rb @@ -128,12 +128,6 @@ feature 'Top Plus Menu', :js do expect(find('.header-new.dropdown')).not_to have_selector('.header-new-project-snippet') end - scenario 'public project has no New Issue Button' do - visit project_path(public_project) - - hasnot_topmenuitem("New issue") - end - scenario 'public project has no New merge request menu item' do visit project_path(public_project) -- cgit v1.2.1 From 265b1a3b72ff7552e2ae01a059f80bd59714649d Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Fri, 6 Oct 2017 20:40:41 +0000 Subject: Show confirmation modal before deleting account --- spec/features/issues/issue_detail_spec.rb | 3 +-- spec/features/profile_spec.rb | 44 ++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 6 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/issue_detail_spec.rb b/spec/features/issues/issue_detail_spec.rb index 28b636f9359..c0c396af93f 100644 --- a/spec/features/issues/issue_detail_spec.rb +++ b/spec/features/issues/issue_detail_spec.rb @@ -28,8 +28,7 @@ feature 'Issue Detail', :js do fill_in 'issue-title', with: 'issue title' click_button 'Save' - visit profile_account_path - click_link 'Delete account' + Users::DestroyService.new(user).execute(user) visit project_issue_path(project, issue) end diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index f183dd8cb75..1cddd35fd8a 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -12,11 +12,47 @@ describe 'Profile account page' do visit profile_account_path end - it { expect(page).to have_content('Remove account') } + it { expect(page).to have_content('Delete account') } - it 'deletes the account' do - expect { click_link 'Delete account' }.to change { User.where(id: user.id).count }.by(-1) - expect(current_path).to eq(new_user_session_path) + it 'does not immediately delete the account' do + click_button 'Delete account' + + expect(User.exists?(user.id)).to be_truthy + end + + it 'deletes user', :js do + click_button 'Delete account' + + fill_in 'password', with: '12345678' + + page.within '.popup-dialog' do + click_button 'Delete account' + end + + expect(page).to have_content('Account scheduled for removal') + expect(User.exists?(user.id)).to be_falsy + end + + it 'shows invalid password flash message', :js do + click_button 'Delete account' + + fill_in 'password', with: 'testing123' + + page.within '.popup-dialog' do + click_button 'Delete account' + end + + expect(page).to have_content('Invalid password') + end + + it 'does not show delete button when user owns a group' do + group = create(:group) + group.add_owner(user) + + visit profile_account_path + + expect(page).not_to have_button('Delete account') + expect(page).to have_content("Your account is currently an owner in these groups: #{group.name}") end end -- cgit v1.2.1 From 26b66e58ca4179ab8720f48c72e75aa3bac05911 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Fri, 6 Oct 2017 17:04:45 -0500 Subject: backport protected_branches_spec improvements from EE --- spec/features/protected_branches_spec.rb | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'spec/features') diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index aaf3d6d28ca..2ab1eda90f1 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -64,16 +64,24 @@ feature 'Protected Branches', :js do describe "Saved defaults" do it "keeps the allowed to merge and push dropdowns defaults based on the previous selection" do visit project_protected_branches_path(project) - find(".js-allowed-to-merge").trigger('click') - click_link 'No one' - find(".js-allowed-to-push").trigger('click') - click_link 'Developers + Masters' - visit project_protected_branches_path(project) - page.within(".js-allowed-to-merge") do - expect(page.find(".dropdown-toggle-text")).to have_content("No one") + form = '.js-new-protected-branch' + + within form do + find(".js-allowed-to-merge").trigger('click') + click_link 'No one' + find(".js-allowed-to-push").trigger('click') + click_link 'Developers + Masters' end - page.within(".js-allowed-to-push") do - expect(page.find(".dropdown-toggle-text")).to have_content("Developers + Masters") + + visit project_protected_branches_path(project) + + within form do + page.within(".js-allowed-to-merge") do + expect(page.find(".dropdown-toggle-text")).to have_content("No one") + end + page.within(".js-allowed-to-push") do + expect(page.find(".dropdown-toggle-text")).to have_content("Developers + Masters") + end end end end -- cgit v1.2.1 From b54203f0ada8f7ad6d24437b6f5f46ebf43f8695 Mon Sep 17 00:00:00 2001 From: Felipe Artur Date: Sat, 7 Oct 2017 04:25:17 +0000 Subject: Commenting on image diffs --- spec/features/merge_requests/diffs_spec.rb | 8 +- spec/features/merge_requests/image_diff_notes.rb | 196 +++++++++++++++++++++ .../merge_requests/user_posts_diff_notes_spec.rb | 1 + 3 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 spec/features/merge_requests/image_diff_notes.rb (limited to 'spec/features') diff --git a/spec/features/merge_requests/diffs_spec.rb b/spec/features/merge_requests/diffs_spec.rb index e9068f722d5..f4ba660ca39 100644 --- a/spec/features/merge_requests/diffs_spec.rb +++ b/spec/features/merge_requests/diffs_spec.rb @@ -42,8 +42,12 @@ feature 'Diffs URL', js: true do visit "#{diffs_project_merge_request_path(project, merge_request)}#{fragment}" end - it 'shows expanded note' do - expect(page).to have_selector(fragment, visible: true) + it 'shows collapsed note' do + wait_for_requests + + expect(page).to have_selector('.discussion-notes.collapsed') do |note_container| + expect(note_container).to have_selector(fragment, visible: false) + end end end end diff --git a/spec/features/merge_requests/image_diff_notes.rb b/spec/features/merge_requests/image_diff_notes.rb new file mode 100644 index 00000000000..e8ca8a98d70 --- /dev/null +++ b/spec/features/merge_requests/image_diff_notes.rb @@ -0,0 +1,196 @@ +require 'spec_helper' + +feature 'image diff notes', js: true do + include NoteInteractionHelpers + + let(:user) { create(:user) } + let(:project) { create(:project, :public, :repository) } + + before do + project.team << [user, :master] + sign_in user + + page.driver.set_cookie('sidebar_collapsed', 'true') + + # Stub helper to return any blob file as image from public app folder. + # This is necessary to run this specs since we don't display repo images in capybara. + allow_any_instance_of(DiffHelper).to receive(:diff_file_blob_raw_path).and_return('/apple-touch-icon.png') + end + + context 'create commit diff notes' do + commit_id = '2f63565e7aac07bcdadb654e253078b727143ec4' + + describe 'create a new diff note' do + before do + visit project_commit_path(project, commit_id) + create_image_diff_note + end + + it 'shows indicator badge on image diff' do + indicator = find('.js-image-badge') + + expect(indicator).to have_content('1') + end + + it 'shows the avatar badge on the new note' do + badge = find('.image-diff-avatar-link .badge') + + expect(badge).to have_content('1') + end + + it 'allows collapsing/expanding the discussion notes' do + find('.js-diff-notes-toggle', :first).click + + expect(page).not_to have_content('image diff test comment') + + find('.js-diff-notes-toggle').click + + expect(page).to have_content('image diff test comment') + end + end + + describe 'render commit diff notes' do + let(:path) { "files/images/6049019_460s.jpg" } + let(:commit) { project.commit('2f63565e7aac07bcdadb654e253078b727143ec4') } + + let(:note1_position) do + Gitlab::Diff::Position.new( + old_path: path, + new_path: path, + width: 100, + height: 100, + x: 10, + y: 10, + position_type: "image", + diff_refs: commit.diff_refs + ) + end + + let(:note2_position) do + Gitlab::Diff::Position.new( + old_path: path, + new_path: path, + width: 100, + height: 100, + x: 20, + y: 20, + position_type: "image", + diff_refs: commit.diff_refs + ) + end + + let!(:note1) { create(:diff_note_on_commit, commit_id: commit.id, project: project, position: note1_position, note: 'my note 1') } + let!(:note2) { create(:diff_note_on_commit, commit_id: commit.id, project: project, position: note2_position, note: 'my note 2') } + + before do + visit project_commit_path(project, commit.id) + wait_for_requests + end + + it 'render diff indicators within the image diff frame' do + expect(page).to have_css('.js-image-badge', count: 2) + end + + it 'shows the diff notes' do + expect(page).to have_css('.diff-content .note', count: 2) + end + + it 'shows the diff notes with correct avatar badge numbers' do + expect(page).to have_css('.image-diff-avatar-link', text: 1) + expect(page).to have_css('.image-diff-avatar-link', text: 2) + end + end + end + + %w(inline parallel).each do |view| + context "#{view} view" do + let(:merge_request) { create(:merge_request_with_diffs, :with_image_diffs, source_project: project, author: user) } + let(:path) { "files/images/ee_repo_logo.png" } + + let(:position) do + Gitlab::Diff::Position.new( + old_path: path, + new_path: path, + width: 100, + height: 100, + x: 1, + y: 1, + position_type: "image", + diff_refs: merge_request.diff_refs + ) + end + + let!(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request, position: position) } + + describe 'creating a new diff note' do + before do + visit diffs_project_merge_request_path(project, merge_request, view: view) + create_image_diff_note + end + + it 'shows indicator badge on image diff' do + indicator = find('.js-image-badge', match: :first) + + expect(indicator).to have_content('1') + end + + it 'shows the avatar badge on the new note' do + badge = find('.image-diff-avatar-link .badge', match: :first) + + expect(badge).to have_content('1') + end + + it 'allows expanding/collapsing the discussion notes' do + page.all('.js-diff-notes-toggle')[0].trigger('click') + page.all('.js-diff-notes-toggle')[1].trigger('click') + + expect(page).not_to have_content('image diff test comment') + + page.all('.js-diff-notes-toggle')[0].trigger('click') + page.all('.js-diff-notes-toggle')[1].trigger('click') + + expect(page).to have_content('image diff test comment') + end + end + end + end + + describe 'discussion tab polling', :js do + let(:merge_request) { create(:merge_request_with_diffs, :with_image_diffs, source_project: project, author: user) } + let(:path) { "files/images/ee_repo_logo.png" } + + let(:position) do + Gitlab::Diff::Position.new( + old_path: path, + new_path: path, + width: 100, + height: 100, + x: 50, + y: 50, + position_type: "image", + diff_refs: merge_request.diff_refs + ) + end + + before do + visit project_merge_request_path(project, merge_request) + end + + it 'render diff indicators within the image frame' do + diff_note = create(:diff_note_on_merge_request, project: project, noteable: merge_request, position: position) + + wait_for_requests + + expect(page).to have_selector('.image-comment-badge') + expect(page).to have_content(diff_note.note) + end + end +end + +def create_image_diff_note + find('.js-add-image-diff-note-button', match: :first).click + page.all('.js-add-image-diff-note-button')[0].trigger('click') + find('.diff-content .note-textarea').native.send_keys('image diff test comment') + click_button 'Comment' + wait_for_requests +end diff --git a/spec/features/merge_requests/user_posts_diff_notes_spec.rb b/spec/features/merge_requests/user_posts_diff_notes_spec.rb index e1ca4fe186c..7a773fb2baa 100644 --- a/spec/features/merge_requests/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_diff_notes_spec.rb @@ -227,6 +227,7 @@ feature 'Merge requests > User posts diff notes', :js do write_comment_on_line(line_holder, diff_side) click_button 'Comment' + wait_for_requests assert_comment_persistence(line_holder, asset_form_reset: asset_form_reset) -- cgit v1.2.1 From 70716a1292ca5910908ba37a9d113c8b5a221bb7 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Wed, 20 Sep 2017 17:41:11 +0200 Subject: Allow creating merge requests across forks of a project --- .../merge_requests/create_new_mr_from_fork_spec.rb | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 spec/features/merge_requests/create_new_mr_from_fork_spec.rb (limited to 'spec/features') diff --git a/spec/features/merge_requests/create_new_mr_from_fork_spec.rb b/spec/features/merge_requests/create_new_mr_from_fork_spec.rb new file mode 100644 index 00000000000..515818c5d42 --- /dev/null +++ b/spec/features/merge_requests/create_new_mr_from_fork_spec.rb @@ -0,0 +1,60 @@ +require 'spec_helper' + +feature 'Creating a merge request from a fork', :js do + let(:user) { create(:user) } + let(:project) { create(:project, :public, :repository) } + let!(:source_project) { ::Projects::ForkService.new(project, user).execute } + + before do + source_project.add_master(user) + + sign_in(user) + end + + shared_examples 'create merge request to other project' do + it 'has all possible target projects' do + visit project_new_merge_request_path(source_project) + + first('.js-target-project').click + + within('.dropdown-target-project .dropdown-content') do + expect(page).to have_content(project.full_path) + expect(page).to have_content(target_project.full_path) + expect(page).to have_content(source_project.full_path) + end + end + + it 'allows creating the merge request to another target project' do + visit project_merge_requests_path(source_project) + + page.within '.content' do + click_link 'New merge request' + end + + find('.js-source-branch', match: :first).click + find('.dropdown-source-branch .dropdown-content a', match: :first).click + + first('.js-target-project').click + find('.dropdown-target-project .dropdown-content a', text: target_project.full_path).click + + click_button 'Compare branches and continue' + + wait_for_requests + + expect { click_button 'Submit merge request' } + .to change { target_project.merge_requests.reload.size }.by(1) + end + end + + context 'creating to the source of a fork' do + let(:target_project) { project } + + it_behaves_like('create merge request to other project') + end + + context 'creating to a sibling of a fork' do + let!(:target_project) { ::Projects::ForkService.new(project, create(:user)).execute } + + it_behaves_like('create merge request to other project') + end +end -- cgit v1.2.1 From 7c00b53812895970fdb00cf1d27b059bb15815cd Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Thu, 21 Sep 2017 18:34:32 +0200 Subject: Find branches in all projects in the fork network --- .../merge_requests/create_new_mr_from_fork_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'spec/features') diff --git a/spec/features/merge_requests/create_new_mr_from_fork_spec.rb b/spec/features/merge_requests/create_new_mr_from_fork_spec.rb index 515818c5d42..e6f827174e2 100644 --- a/spec/features/merge_requests/create_new_mr_from_fork_spec.rb +++ b/spec/features/merge_requests/create_new_mr_from_fork_spec.rb @@ -44,6 +44,25 @@ feature 'Creating a merge request from a fork', :js do expect { click_button 'Submit merge request' } .to change { target_project.merge_requests.reload.size }.by(1) end + + it 'updates the branches when selecting a new target project' do + target_project_member = target_project.owner + CreateBranchService.new(target_project, target_project_member) + .execute('a-brand-new-branch-to-test', 'master') + + visit project_new_merge_request_path(source_project) + + first('.js-target-project').click + find('.dropdown-target-project .dropdown-content a', text: target_project.full_path).click + + wait_for_requests + + first('.js-target-branch').click + + within('.dropdown-target-branch .dropdown-content') do + expect(page).to have_content('a-brand-new-branch-to-test') + end + end end context 'creating to the source of a fork' do -- cgit v1.2.1 From e8ca579d88703aeeaa64dbf4ac45f73a60181568 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Fri, 29 Sep 2017 10:04:50 +0200 Subject: Add a project forks spec helper The helper creates a fork of a project with all provided attributes, but skipping the creation of the repository on disk. --- spec/features/dashboard/merge_requests_spec.rb | 3 ++- .../merge_requests/create_new_mr_from_fork_spec.rb | 18 ++++++++++++++---- spec/features/merge_requests/created_from_fork_spec.rb | 17 ++++++++--------- spec/features/merge_requests/diffs_spec.rb | 4 +++- spec/features/merge_requests/form_spec.rb | 12 +++++++----- spec/features/projects/issuable_templates_spec.rb | 8 ++++---- spec/features/projects/user_creates_directory_spec.rb | 2 +- spec/features/projects/user_creates_files_spec.rb | 2 +- spec/features/projects/user_deletes_files_spec.rb | 2 +- spec/features/projects/user_replaces_files_spec.rb | 2 +- spec/features/projects/user_uploads_files_spec.rb | 11 ++++++++--- spec/features/projects_spec.rb | 7 ++++--- 12 files changed, 54 insertions(+), 34 deletions(-) (limited to 'spec/features') diff --git a/spec/features/dashboard/merge_requests_spec.rb b/spec/features/dashboard/merge_requests_spec.rb index 8204828b5b9..d26428ec286 100644 --- a/spec/features/dashboard/merge_requests_spec.rb +++ b/spec/features/dashboard/merge_requests_spec.rb @@ -3,12 +3,13 @@ require 'spec_helper' feature 'Dashboard Merge Requests' do include FilterItemSelectHelper include SortingHelper + include ProjectForksHelper let(:current_user) { create :user } let(:project) { create(:project) } let(:public_project) { create(:project, :public, :repository) } - let(:forked_project) { Projects::ForkService.new(public_project, current_user).execute } + let(:forked_project) { fork_project(public_project, current_user, repository: true) } before do project.add_master(current_user) diff --git a/spec/features/merge_requests/create_new_mr_from_fork_spec.rb b/spec/features/merge_requests/create_new_mr_from_fork_spec.rb index e6f827174e2..93c40ff6443 100644 --- a/spec/features/merge_requests/create_new_mr_from_fork_spec.rb +++ b/spec/features/merge_requests/create_new_mr_from_fork_spec.rb @@ -1,9 +1,15 @@ require 'spec_helper' feature 'Creating a merge request from a fork', :js do + include ProjectForksHelper + let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } - let!(:source_project) { ::Projects::ForkService.new(project, user).execute } + let!(:source_project) do + fork_project(project, user, + repository: true, + namespace: user.namespace) + end before do source_project.add_master(user) @@ -49,7 +55,6 @@ feature 'Creating a merge request from a fork', :js do target_project_member = target_project.owner CreateBranchService.new(target_project, target_project_member) .execute('a-brand-new-branch-to-test', 'master') - visit project_new_merge_request_path(source_project) first('.js-target-project').click @@ -66,13 +71,18 @@ feature 'Creating a merge request from a fork', :js do end context 'creating to the source of a fork' do - let(:target_project) { project } + let!(:target_project) { project } it_behaves_like('create merge request to other project') end context 'creating to a sibling of a fork' do - let!(:target_project) { ::Projects::ForkService.new(project, create(:user)).execute } + let!(:target_project) do + other_user = create(:user) + fork_project(project, other_user, + repository: true, + namespace: other_user.namespace) + end it_behaves_like('create merge request to other project') end diff --git a/spec/features/merge_requests/created_from_fork_spec.rb b/spec/features/merge_requests/created_from_fork_spec.rb index 09541873f71..f9bc3ee6c58 100644 --- a/spec/features/merge_requests/created_from_fork_spec.rb +++ b/spec/features/merge_requests/created_from_fork_spec.rb @@ -1,21 +1,20 @@ require 'spec_helper' feature 'Merge request created from fork' do + include ProjectForksHelper + given(:user) { create(:user) } given(:project) { create(:project, :public, :repository) } - given(:fork_project) { create(:project, :public, :repository) } + given(:forked_project) { fork_project(project, user, repository: true) } given!(:merge_request) do - create(:forked_project_link, forked_to_project: fork_project, - forked_from_project: project) - - create(:merge_request_with_diffs, source_project: fork_project, + create(:merge_request_with_diffs, source_project: forked_project, target_project: project, description: 'Test merge request') end background do - fork_project.team << [user, :master] + forked_project.team << [user, :master] sign_in user end @@ -31,7 +30,7 @@ feature 'Merge request created from fork' do background do create(:note_on_commit, note: comment, - project: fork_project, + project: forked_project, commit_id: merge_request.commit_shas.first) end @@ -55,7 +54,7 @@ feature 'Merge request created from fork' do context 'source project is deleted' do background do MergeRequests::MergeService.new(project, user).execute(merge_request) - fork_project.destroy! + forked_project.destroy! end scenario 'user can access merge request', js: true do @@ -69,7 +68,7 @@ feature 'Merge request created from fork' do context 'pipeline present in source project' do given(:pipeline) do create(:ci_pipeline, - project: fork_project, + project: forked_project, sha: merge_request.diff_head_sha, ref: merge_request.source_branch) end diff --git a/spec/features/merge_requests/diffs_spec.rb b/spec/features/merge_requests/diffs_spec.rb index f4ba660ca39..ee9bb50a881 100644 --- a/spec/features/merge_requests/diffs_spec.rb +++ b/spec/features/merge_requests/diffs_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' feature 'Diffs URL', js: true do + include ProjectForksHelper + let(:project) { create(:project, :public, :repository) } let(:merge_request) { create(:merge_request, source_project: project) } @@ -68,7 +70,7 @@ feature 'Diffs URL', js: true do context 'when editing file' do let(:author_user) { create(:user) } let(:user) { create(:user) } - let(:forked_project) { Projects::ForkService.new(project, author_user).execute } + let(:forked_project) { fork_project(project, author_user, repository: true) } let(:merge_request) { create(:merge_request_with_diffs, source_project: forked_project, target_project: project, author: author_user) } let(:changelog_id) { Digest::SHA1.hexdigest("CHANGELOG") } diff --git a/spec/features/merge_requests/form_spec.rb b/spec/features/merge_requests/form_spec.rb index de98b147d04..758fc9b139d 100644 --- a/spec/features/merge_requests/form_spec.rb +++ b/spec/features/merge_requests/form_spec.rb @@ -1,8 +1,10 @@ require 'rails_helper' describe 'New/edit merge request', :js do + include ProjectForksHelper + let!(:project) { create(:project, :public, :repository) } - let(:fork_project) { create(:project, :repository, forked_from_project: project) } + let(:forked_project) { fork_project(project, nil, repository: true) } let!(:user) { create(:user) } let!(:user2) { create(:user) } let!(:milestone) { create(:milestone, project: project) } @@ -170,16 +172,16 @@ describe 'New/edit merge request', :js do context 'forked project' do before do - fork_project.team << [user, :master] + forked_project.team << [user, :master] sign_in(user) end context 'new merge request' do before do visit project_new_merge_request_path( - fork_project, + forked_project, merge_request: { - source_project_id: fork_project.id, + source_project_id: forked_project.id, target_project_id: project.id, source_branch: 'fix', target_branch: 'master' @@ -238,7 +240,7 @@ describe 'New/edit merge request', :js do context 'edit merge request' do before do merge_request = create(:merge_request, - source_project: fork_project, + source_project: forked_project, target_project: project, source_branch: 'fix', target_branch: 'master' diff --git a/spec/features/projects/issuable_templates_spec.rb b/spec/features/projects/issuable_templates_spec.rb index 1f9b52dd998..c9b8ef4e37b 100644 --- a/spec/features/projects/issuable_templates_spec.rb +++ b/spec/features/projects/issuable_templates_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' feature 'issuable templates', js: true do + include ProjectForksHelper + let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } let(:issue_form_location) { '#content-body .issuable-details .detail-page-description' } @@ -116,15 +118,13 @@ feature 'issuable templates', js: true do context 'user creates a merge request from a forked project using templates' do let(:template_content) { 'this is a test "feature-proposal" template' } let(:fork_user) { create(:user) } - let(:fork_project) { create(:project, :public, :repository) } - let(:merge_request) { create(:merge_request, :with_diffs, source_project: fork_project, target_project: project) } + let(:forked_project) { fork_project(project, fork_user) } + let(:merge_request) { create(:merge_request, :with_diffs, source_project: forked_project, target_project: project) } background do sign_out(:user) project.team << [fork_user, :developer] - fork_project.team << [fork_user, :master] - create(:forked_project_link, forked_to_project: fork_project, forked_from_project: project) sign_in(fork_user) diff --git a/spec/features/projects/user_creates_directory_spec.rb b/spec/features/projects/user_creates_directory_spec.rb index 1ba5d83eadf..e8f2e4813c5 100644 --- a/spec/features/projects/user_creates_directory_spec.rb +++ b/spec/features/projects/user_creates_directory_spec.rb @@ -79,7 +79,7 @@ feature 'User creates a directory', js: true do fill_in(:commit_message, with: 'New commit message', visible: true) click_button('Create directory') - fork = user.fork_of(project2) + fork = user.fork_of(project2.reload) expect(current_path).to eq(project_new_merge_request_path(fork)) end diff --git a/spec/features/projects/user_creates_files_spec.rb b/spec/features/projects/user_creates_files_spec.rb index 3d335687510..51d918bc85d 100644 --- a/spec/features/projects/user_creates_files_spec.rb +++ b/spec/features/projects/user_creates_files_spec.rb @@ -142,7 +142,7 @@ describe 'User creates files' do fill_in(:commit_message, with: 'New commit message', visible: true) click_button('Commit changes') - fork = user.fork_of(project2) + fork = user.fork_of(project2.reload) expect(current_path).to eq(project_new_merge_request_path(fork)) expect(page).to have_content('New commit message') diff --git a/spec/features/projects/user_deletes_files_spec.rb b/spec/features/projects/user_deletes_files_spec.rb index 95cd316be0e..7f48a69d9b7 100644 --- a/spec/features/projects/user_deletes_files_spec.rb +++ b/spec/features/projects/user_deletes_files_spec.rb @@ -59,7 +59,7 @@ describe 'User deletes files' do fill_in(:commit_message, with: 'New commit message', visible: true) click_button('Delete file') - fork = user.fork_of(project2) + fork = user.fork_of(project2.reload) expect(current_path).to eq(project_new_merge_request_path(fork)) expect(page).to have_content('New commit message') diff --git a/spec/features/projects/user_replaces_files_spec.rb b/spec/features/projects/user_replaces_files_spec.rb index e284fdefd4f..a9628198d5b 100644 --- a/spec/features/projects/user_replaces_files_spec.rb +++ b/spec/features/projects/user_replaces_files_spec.rb @@ -74,7 +74,7 @@ describe 'User replaces files' do expect(page).to have_content('Replacement file commit message') - fork = user.fork_of(project2) + fork = user.fork_of(project2.reload) expect(current_path).to eq(project_new_merge_request_path(fork)) diff --git a/spec/features/projects/user_uploads_files_spec.rb b/spec/features/projects/user_uploads_files_spec.rb index 98871317ca3..8014c299980 100644 --- a/spec/features/projects/user_uploads_files_spec.rb +++ b/spec/features/projects/user_uploads_files_spec.rb @@ -39,6 +39,9 @@ describe 'User uploads files' do expect(current_path).to eq(project_new_merge_request_path(project)) click_link('Changes') + find("a[data-action='diffs']", text: 'Changes').click + + wait_for_requests expect(page).to have_content('Lorem ipsum dolor sit amet') expect(page).to have_content('Sed ut perspiciatis unde omnis') @@ -51,7 +54,7 @@ describe 'User uploads files' do visit(project2_tree_path_root_ref) end - it 'uploads and commit a new fileto a forked project', js: true do + it 'uploads and commit a new file to a forked project', js: true do find('.add-to-tree').click click_link('Upload file') @@ -69,11 +72,13 @@ describe 'User uploads files' do expect(page).to have_content('New commit message') - fork = user.fork_of(project2) + fork = user.fork_of(project2.reload) expect(current_path).to eq(project_new_merge_request_path(fork)) - click_link('Changes') + find("a[data-action='diffs']", text: 'Changes').click + + wait_for_requests expect(page).to have_content('Lorem ipsum dolor sit amet') expect(page).to have_content('Sed ut perspiciatis unde omnis') diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 81f7ab80a04..b957575a244 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' feature 'Project' do + include ProjectForksHelper + describe 'creating from template' do let(:user) { create(:user) } let(:template) { Gitlab::ProjectTemplate.find(:rails) } @@ -57,11 +59,10 @@ feature 'Project' do describe 'remove forked relationship', js: true do let(:user) { create(:user) } - let(:project) { create(:project, namespace: user.namespace) } + let(:project) { fork_project(create(:project, :public), user, namespace_id: user.namespace) } before do sign_in user - create(:forked_project_link, forked_to_project: project) visit edit_project_path(project) end @@ -71,7 +72,7 @@ feature 'Project' do remove_with_confirm('Remove fork relationship', project.path) expect(page).to have_content 'The fork relationship has been removed.' - expect(project.forked?).to be_falsey + expect(project.reload.forked?).to be_falsey expect(page).not_to have_content 'Remove fork relationship' end end -- cgit v1.2.1 From 178f4e1e16b41f8e5992f484fdd6465090c55a08 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Tue, 3 Oct 2017 19:41:37 +0200 Subject: Show fork information on the project panel --- spec/features/projects_spec.rb | 49 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'spec/features') diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index b957575a244..4b2c54d54b5 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -77,6 +77,55 @@ feature 'Project' do end end + describe 'showing information about source of a project fork' do + let(:user) { create(:user) } + let(:base_project) { create(:project, :public, :repository) } + let(:forked_project) { fork_project(base_project, user, repository: true) } + + before do + sign_in user + end + + it 'shows a link to the source project when it is available' do + visit project_path(forked_project) + + expect(page).to have_content('Forked from') + expect(page).to have_link(base_project.full_name) + end + + it 'does not contain fork network information for the root project' do + forked_project + + visit project_path(base_project) + + expect(page).not_to have_content('In fork network of') + expect(page).not_to have_content('Forked from') + end + + it 'shows the name of the deleted project when the source was deleted' do + forked_project + Projects::DestroyService.new(base_project, base_project.owner).execute + + visit project_path(forked_project) + + expect(page).to have_content("Forked from #{base_project.full_name} (deleted)") + end + + context 'a fork of a fork' do + let(:fork_of_fork) { fork_project(forked_project, user, repository: true) } + + it 'links to the base project if the source project is removed' do + fork_of_fork + Projects::DestroyService.new(forked_project, user).execute + + visit project_path(fork_of_fork) + + expect(page).to have_content("Forked from") + expect(page).to have_link(base_project.full_name) + end + end + end + describe 'removal', js: true do let(:user) { create(:user, username: 'test', name: 'test') } let(:project) { create(:project, namespace: user.namespace, name: 'project1') } -- cgit v1.2.1 From fc51bde939a24347e21b765b8c0e4238e2ffc67d Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Fri, 6 Oct 2017 12:36:34 +0200 Subject: Add a spec for editing a file when a project was already forked --- spec/features/projects/user_edits_files_spec.rb | 32 ++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/user_edits_files_spec.rb b/spec/features/projects/user_edits_files_spec.rb index 19954313c23..2798041fa0c 100644 --- a/spec/features/projects/user_edits_files_spec.rb +++ b/spec/features/projects/user_edits_files_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' describe 'User edits files' do + include ProjectForksHelper let(:project) { create(:project, :repository, name: 'Shop') } let(:project2) { create(:project, :repository, name: 'Another Project', path: 'another-project') } let(:project_tree_path_root_ref) { project_tree_path(project, project.repository.root_ref) } @@ -122,7 +123,7 @@ describe 'User edits files' do fill_in(:commit_message, with: 'New commit message', visible: true) click_button('Commit changes') - fork = user.fork_of(project2) + fork = user.fork_of(project2.reload) expect(current_path).to eq(project_new_merge_request_path(fork)) @@ -130,5 +131,34 @@ describe 'User edits files' do expect(page).to have_content('New commit message') end + + context 'when the user already had a fork of the project', :js do + let!(:forked_project) { fork_project(project2, user, namespace: user.namespace, repository: true) } + before do + visit(project2_tree_path_root_ref) + end + + it 'links to the forked project for editing' do + click_link('.gitignore') + find('.js-edit-blob').click + + expect(page).not_to have_link('Fork') + expect(page).not_to have_button('Cancel') + + execute_script("ace.edit('editor').setValue('*.rbca')") + fill_in(:commit_message, with: 'Another commit', visible: true) + click_button('Commit changes') + + fork = user.fork_of(project2) + + expect(current_path).to eq(project_new_merge_request_path(fork)) + + wait_for_requests + + expect(page).to have_content('Another commit') + expect(page).to have_content("From #{forked_project.full_path}") + expect(page).to have_content("into #{project2.full_path}") + end + end end end -- cgit v1.2.1 From 0ce6785851510ccb49f0d1edc0220aca46f815f5 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Tue, 3 Oct 2017 10:35:01 +0200 Subject: Replaces `tag: true` into `:tag` in the specs Replaces all the explicit include metadata syntax in the specs (tag: true) into the implicit one (:tag). Added a cop to prevent future errors and handle autocorrection. --- spec/features/admin/admin_abuse_reports_spec.rb | 2 +- .../admin/admin_broadcast_messages_spec.rb | 2 +- .../admin/admin_disables_two_factor_spec.rb | 2 +- spec/features/admin/admin_groups_spec.rb | 10 ++++---- spec/features/admin/admin_health_check_spec.rb | 2 +- spec/features/admin/admin_hooks_spec.rb | 2 +- spec/features/admin/admin_labels_spec.rb | 2 +- spec/features/admin/admin_projects_spec.rb | 8 +++---- .../admin/admin_users_impersonation_tokens_spec.rb | 2 +- spec/features/admin/admin_users_spec.rb | 4 ++-- .../admin/admin_uses_repository_checks_spec.rb | 2 +- spec/features/auto_deploy_spec.rb | 4 ++-- spec/features/boards/boards_spec.rb | 2 +- spec/features/boards/keyboard_shortcut_spec.rb | 2 +- spec/features/boards/new_issue_spec.rb | 2 +- spec/features/boards/sidebar_spec.rb | 2 +- spec/features/ci_lint_spec.rb | 2 +- spec/features/container_registry_spec.rb | 2 +- spec/features/copy_as_gfm_spec.rb | 2 +- spec/features/cycle_analytics_spec.rb | 2 +- spec/features/dashboard/active_tab_spec.rb | 2 +- .../dashboard/datetime_on_tooltips_spec.rb | 2 +- spec/features/dashboard/group_spec.rb | 2 +- spec/features/dashboard/issues_spec.rb | 8 +++---- spec/features/dashboard/label_filter_spec.rb | 2 +- spec/features/dashboard/merge_requests_spec.rb | 6 ++--- .../project_member_activity_index_spec.rb | 2 +- spec/features/dashboard/projects_spec.rb | 2 +- .../dashboard/todos/todos_filtering_spec.rb | 2 +- spec/features/dashboard/todos/todos_spec.rb | 8 +++---- spec/features/expand_collapse_diffs_spec.rb | 2 +- spec/features/gitlab_flavored_markdown_spec.rb | 2 +- spec/features/group_variables_spec.rb | 2 +- spec/features/groups/labels/subscription_spec.rb | 2 +- spec/features/groups_spec.rb | 6 ++--- spec/features/issuables/default_sort_order_spec.rb | 18 +++++++------- spec/features/issuables/user_sees_sidebar_spec.rb | 4 ++-- spec/features/issues/award_emoji_spec.rb | 18 +++++++------- spec/features/issues/award_spec.rb | 2 +- .../features/issues/bulk_assignment_labels_spec.rb | 2 +- ..._issue_for_discussions_in_merge_request_spec.rb | 2 +- ..._for_single_discussion_in_merge_request_spec.rb | 2 +- .../issues/filtered_search/dropdown_author_spec.rb | 2 +- .../issues/filtered_search/dropdown_emoji_spec.rb | 2 +- .../issues/filtered_search/dropdown_label_spec.rb | 2 +- .../issues/filtered_search/filter_issues_spec.rb | 2 +- .../issues/filtered_search/recent_searches_spec.rb | 2 +- .../issues/filtered_search/search_bar_spec.rb | 2 +- .../issues/filtered_search/visual_tokens_spec.rb | 2 +- spec/features/issues/gfm_autocomplete_spec.rb | 2 +- spec/features/issues/issue_sidebar_spec.rb | 8 +++---- spec/features/issues/markdown_toolbar_spec.rb | 2 +- spec/features/issues/move_spec.rb | 6 ++--- spec/features/issues/spam_issues_spec.rb | 2 +- spec/features/issues/todo_spec.rb | 2 +- .../issues/user_uses_slash_commands_spec.rb | 2 +- spec/features/issues_spec.rb | 28 +++++++++++----------- spec/features/login_spec.rb | 8 +++---- spec/features/merge_requests/assign_issues_spec.rb | 2 +- spec/features/merge_requests/award_spec.rb | 2 +- ...f_mergeable_with_unresolved_discussions_spec.rb | 2 +- spec/features/merge_requests/cherry_pick_spec.rb | 2 +- spec/features/merge_requests/closes_issues_spec.rb | 2 +- spec/features/merge_requests/conflicts_spec.rb | 2 +- spec/features/merge_requests/create_new_mr_spec.rb | 2 +- .../merge_requests/created_from_fork_spec.rb | 6 ++--- .../merge_requests/deleted_source_branch_spec.rb | 2 +- .../merge_requests/diff_notes_avatars_spec.rb | 2 +- .../merge_requests/diff_notes_resolve_spec.rb | 2 +- spec/features/merge_requests/diffs_spec.rb | 2 +- spec/features/merge_requests/edit_mr_spec.rb | 4 ++-- .../merge_requests/filter_by_milestone_spec.rb | 8 +++---- .../merge_requests/filter_merge_requests_spec.rb | 16 ++++++------- spec/features/merge_requests/image_diff_notes.rb | 2 +- .../merge_commit_message_toggle_spec.rb | 2 +- .../only_allow_merge_if_build_succeeds_spec.rb | 6 ++--- spec/features/merge_requests/pipelines_spec.rb | 2 +- .../resolve_outdated_diff_discussions.rb | 2 +- spec/features/merge_requests/target_branch_spec.rb | 2 +- .../toggle_whitespace_changes_spec.rb | 2 +- .../merge_requests/toggler_behavior_spec.rb | 2 +- .../merge_requests/update_merge_requests_spec.rb | 6 ++--- .../user_uses_slash_commands_spec.rb | 2 +- spec/features/merge_requests/versions_spec.rb | 2 +- .../merge_requests/widget_deployments_spec.rb | 2 +- spec/features/merge_requests/widget_spec.rb | 2 +- spec/features/profiles/keys_spec.rb | 2 +- spec/features/profiles/oauth_applications_spec.rb | 2 +- .../profiles/personal_access_tokens_spec.rb | 2 +- .../user_changes_notified_of_own_activity_spec.rb | 2 +- .../profiles/user_visits_notifications_tab_spec.rb | 2 +- spec/features/projects/badges/list_spec.rb | 2 +- .../blobs/blob_line_permalink_updater_spec.rb | 2 +- spec/features/projects/blobs/edit_spec.rb | 2 +- .../features/projects/blobs/shortcuts_blob_spec.rb | 2 +- spec/features/projects/branches_spec.rb | 4 ++-- spec/features/projects/commit/builds_spec.rb | 2 +- spec/features/projects/commit/cherry_pick_spec.rb | 2 +- spec/features/projects/compare_spec.rb | 2 +- ...eloper_views_empty_project_instructions_spec.rb | 4 ++-- spec/features/projects/edit_spec.rb | 2 +- .../projects/environments/environments_spec.rb | 2 +- spec/features/projects/features_visibility_spec.rb | 4 ++-- spec/features/projects/files/browse_files_spec.rb | 2 +- .../projects/files/dockerfile_dropdown_spec.rb | 2 +- .../projects/files/edit_file_soft_wrap_spec.rb | 2 +- .../projects/files/find_file_keyboard_spec.rb | 2 +- .../projects/files/gitignore_dropdown_spec.rb | 2 +- .../projects/files/gitlab_ci_yml_dropdown_spec.rb | 2 +- .../project_owner_creates_license_file_spec.rb | 2 +- ...to_create_license_file_in_empty_project_spec.rb | 2 +- .../projects/files/template_type_dropdown_spec.rb | 2 +- spec/features/projects/files/undo_template_spec.rb | 2 +- .../projects/gfm_autocomplete_load_spec.rb | 2 +- .../projects/import_export/export_file_spec.rb | 2 +- .../projects/import_export/import_file_spec.rb | 2 +- .../import_export/namespace_export_file_spec.rb | 2 +- spec/features/projects/issuable_templates_spec.rb | 2 +- spec/features/projects/jobs_spec.rb | 2 +- spec/features/projects/labels/subscription_spec.rb | 2 +- .../projects/labels/update_prioritization_spec.rb | 10 ++++---- ...uester_cannot_request_access_to_project_spec.rb | 2 +- .../members/groups_with_access_list_spec.rb | 2 +- ...master_adds_member_with_expiration_date_spec.rb | 2 +- spec/features/projects/pipelines/pipelines_spec.rb | 4 ++-- spec/features/projects/project_settings_spec.rb | 4 ++-- spec/features/projects/ref_switcher_spec.rb | 2 +- .../projects/settings/integration_settings_spec.rb | 2 +- .../projects/settings/pipelines_settings_spec.rb | 2 +- .../projects/settings/repository_settings_spec.rb | 2 +- .../projects/settings/visibility_settings_spec.rb | 2 +- spec/features/projects/show_project_spec.rb | 2 +- spec/features/projects/user_browses_files_spec.rb | 8 +++---- .../projects/user_creates_directory_spec.rb | 2 +- spec/features/projects/user_creates_files_spec.rb | 10 ++++---- .../features/projects/user_creates_project_spec.rb | 2 +- spec/features/projects/user_deletes_files_spec.rb | 4 ++-- spec/features/projects/user_edits_files_spec.rb | 12 +++++----- .../projects/user_interacts_with_stars_spec.rb | 2 +- spec/features/projects/user_replaces_files_spec.rb | 4 ++-- spec/features/projects/user_uploads_files_spec.rb | 4 ++-- spec/features/projects/view_on_env_spec.rb | 2 +- .../projects/wiki/markdown_preview_spec.rb | 2 +- spec/features/projects_spec.rb | 4 ++-- spec/features/protected_tags_spec.rb | 2 +- spec/features/snippets/internal_snippet_spec.rb | 2 +- spec/features/tags/master_creates_tag_spec.rb | 2 +- spec/features/tags/master_deletes_tag_spec.rb | 6 ++--- spec/features/task_lists_spec.rb | 8 +++---- spec/features/triggers_spec.rb | 2 +- .../uploads/user_uploads_file_to_note_spec.rb | 16 ++++++------- spec/features/users/snippets_spec.rb | 2 +- spec/features/users_spec.rb | 2 +- spec/features/variables_spec.rb | 2 +- 154 files changed, 265 insertions(+), 265 deletions(-) (limited to 'spec/features') diff --git a/spec/features/admin/admin_abuse_reports_spec.rb b/spec/features/admin/admin_abuse_reports_spec.rb index 2144f6ba635..766cd4b0090 100644 --- a/spec/features/admin/admin_abuse_reports_spec.rb +++ b/spec/features/admin/admin_abuse_reports_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Admin::AbuseReports", js: true do +describe "Admin::AbuseReports", :js do let(:user) { create(:user) } context 'as an admin' do diff --git a/spec/features/admin/admin_broadcast_messages_spec.rb b/spec/features/admin/admin_broadcast_messages_spec.rb index cbccf370514..9cb351282a0 100644 --- a/spec/features/admin/admin_broadcast_messages_spec.rb +++ b/spec/features/admin/admin_broadcast_messages_spec.rb @@ -40,7 +40,7 @@ feature 'Admin Broadcast Messages' do expect(page).not_to have_content 'Migration to new server' end - scenario 'Live preview a customized broadcast message', js: true do + scenario 'Live preview a customized broadcast message', :js do fill_in 'broadcast_message_message', with: "Live **Markdown** previews. :tada:" page.within('.broadcast-message-preview') do diff --git a/spec/features/admin/admin_disables_two_factor_spec.rb b/spec/features/admin/admin_disables_two_factor_spec.rb index e214ae6b78d..6a97378391b 100644 --- a/spec/features/admin/admin_disables_two_factor_spec.rb +++ b/spec/features/admin/admin_disables_two_factor_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' feature 'Admin disables 2FA for a user' do - scenario 'successfully', js: true do + scenario 'successfully', :js do sign_in(create(:admin)) user = create(:user, :two_factor) diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb index 3768727d8ae..771fb5253da 100644 --- a/spec/features/admin/admin_groups_spec.rb +++ b/spec/features/admin/admin_groups_spec.rb @@ -52,7 +52,7 @@ feature 'Admin Groups' do expect_selected_visibility(internal) end - scenario 'when entered in group path, it auto filled the group name', js: true do + scenario 'when entered in group path, it auto filled the group name', :js do visit admin_groups_path click_link "New group" group_path = 'gitlab' @@ -81,7 +81,7 @@ feature 'Admin Groups' do expect_selected_visibility(group.visibility_level) end - scenario 'edit group path does not change group name', js: true do + scenario 'edit group path does not change group name', :js do group = create(:group, :private) visit admin_group_edit_path(group) @@ -93,7 +93,7 @@ feature 'Admin Groups' do end end - describe 'add user into a group', js: true do + describe 'add user into a group', :js do shared_context 'adds user into a group' do it do visit admin_group_path(group) @@ -124,7 +124,7 @@ feature 'Admin Groups' do group.add_user(:user, Gitlab::Access::OWNER) end - it 'adds admin a to a group as developer', js: true do + it 'adds admin a to a group as developer', :js do visit group_group_members_path(group) page.within '.users-group-form' do @@ -141,7 +141,7 @@ feature 'Admin Groups' do end end - describe 'admin remove himself from a group', js: true do + describe 'admin remove himself from a group', :js do it 'removes admin from the group' do group.add_user(current_user, Gitlab::Access::DEVELOPER) diff --git a/spec/features/admin/admin_health_check_spec.rb b/spec/features/admin/admin_health_check_spec.rb index 37fd3e171eb..09e6965849a 100644 --- a/spec/features/admin/admin_health_check_spec.rb +++ b/spec/features/admin/admin_health_check_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature "Admin Health Check", feature: true, broken_storage: true do +feature "Admin Health Check", :feature, :broken_storage do include StubENV before do diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb index 91f08dbad5d..2e65fcc5231 100644 --- a/spec/features/admin/admin_hooks_spec.rb +++ b/spec/features/admin/admin_hooks_spec.rb @@ -74,7 +74,7 @@ describe 'Admin::Hooks', :js do end end - describe 'Test', js: true do + describe 'Test', :js do before do WebMock.stub_request(:post, @system_hook.url) visit admin_hooks_path diff --git a/spec/features/admin/admin_labels_spec.rb b/spec/features/admin/admin_labels_spec.rb index ae9b47299e6..a5834056a1d 100644 --- a/spec/features/admin/admin_labels_spec.rb +++ b/spec/features/admin/admin_labels_spec.rb @@ -30,7 +30,7 @@ RSpec.describe 'admin issues labels' do end end - it 'deletes all labels', js: true do + it 'deletes all labels', :js do page.within '.labels' do page.all('.btn-remove').each do |remove| remove.click diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb index f4f2505d436..94b12105088 100644 --- a/spec/features/admin/admin_projects_spec.rb +++ b/spec/features/admin/admin_projects_spec.rb @@ -28,7 +28,7 @@ describe "Admin::Projects" do expect(page).not_to have_content(archived_project.name) end - it 'renders all projects', js: true do + it 'renders all projects', :js do find(:css, '#sort-projects-dropdown').click click_link 'Show archived projects' @@ -37,7 +37,7 @@ describe "Admin::Projects" do expect(page).to have_xpath("//span[@class='label label-warning']", text: 'archived') end - it 'renders only archived projects', js: true do + it 'renders only archived projects', :js do find(:css, '#sort-projects-dropdown').click click_link 'Show archived projects only' @@ -74,7 +74,7 @@ describe "Admin::Projects" do .to receive(:move_uploads_to_new_namespace).and_return(true) end - it 'transfers project to group web', js: true do + it 'transfers project to group web', :js do visit admin_project_path(project) click_button 'Search for Namespace' @@ -91,7 +91,7 @@ describe "Admin::Projects" do project.team << [user, :master] end - it 'adds admin a to a project as developer', js: true do + it 'adds admin a to a project as developer', :js do visit project_project_members_path(project) page.within '.users-project-form' do diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb index 034682dae27..388d30828a7 100644 --- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb +++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Admin > Users > Impersonation Tokens', js: true do +describe 'Admin > Users > Impersonation Tokens', :js do let(:admin) { create(:admin) } let!(:user) { create(:user) } diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index e2e2b13cf8a..f9f4bd6f5b9 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -288,7 +288,7 @@ describe "Admin::Users" do end end - it 'allows group membership to be revoked', js: true do + it 'allows group membership to be revoked', :js do page.within(first('.group_member')) do find('.btn-remove').click end @@ -309,7 +309,7 @@ describe "Admin::Users" do end end - describe 'remove users secondary email', js: true do + describe 'remove users secondary email', :js do let!(:secondary_email) do create :email, email: 'secondary@example.com', user: user end diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb index c2b7543a690..42f5b5eb8dc 100644 --- a/spec/features/admin/admin_uses_repository_checks_spec.rb +++ b/spec/features/admin/admin_uses_repository_checks_spec.rb @@ -32,7 +32,7 @@ feature 'Admin uses repository checks' do end end - scenario 'to clear all repository checks', js: true do + scenario 'to clear all repository checks', :js do visit admin_application_settings_path expect(RepositoryCheck::ClearWorker).to receive(:perform_async) diff --git a/spec/features/auto_deploy_spec.rb b/spec/features/auto_deploy_spec.rb index dff6f96b663..4a7c3e4f1ab 100644 --- a/spec/features/auto_deploy_spec.rb +++ b/spec/features/auto_deploy_spec.rb @@ -31,7 +31,7 @@ describe 'Auto deploy' do expect(page).to have_link('Set up auto deploy') end - it 'includes OpenShift as an available template', js: true do + it 'includes OpenShift as an available template', :js do click_link 'Set up auto deploy' click_button 'Apply a GitLab CI Yaml template' @@ -40,7 +40,7 @@ describe 'Auto deploy' do end end - it 'creates a merge request using "auto-deploy" branch', js: true do + it 'creates a merge request using "auto-deploy" branch', :js do click_link 'Set up auto deploy' click_button 'Apply a GitLab CI Yaml template' within '.gitlab-ci-yml-selector' do diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 33aca6cb527..91c4e5037de 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe 'Issue Boards', js: true do +describe 'Issue Boards', :js do include DragTo let(:group) { create(:group, :nested) } diff --git a/spec/features/boards/keyboard_shortcut_spec.rb b/spec/features/boards/keyboard_shortcut_spec.rb index 61b53aa5d1e..435de3861cf 100644 --- a/spec/features/boards/keyboard_shortcut_spec.rb +++ b/spec/features/boards/keyboard_shortcut_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe 'Issue Boards shortcut', js: true do +describe 'Issue Boards shortcut', :js do let(:project) { create(:project) } before do diff --git a/spec/features/boards/new_issue_spec.rb b/spec/features/boards/new_issue_spec.rb index f67372337ec..5ac4d87e90b 100644 --- a/spec/features/boards/new_issue_spec.rb +++ b/spec/features/boards/new_issue_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe 'Issue Boards new issue', js: true do +describe 'Issue Boards new issue', :js do let(:project) { create(:project, :public) } let(:board) { create(:board, project: project) } let!(:list) { create(:list, board: board, position: 0) } diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index c3bf50ef9d1..c4817eb947b 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe 'Issue Boards', js: true do +describe 'Issue Boards', :js do let(:user) { create(:user) } let(:user2) { create(:user) } let(:project) { create(:project, :public) } diff --git a/spec/features/ci_lint_spec.rb b/spec/features/ci_lint_spec.rb index af4cc00162a..9accd7bb07c 100644 --- a/spec/features/ci_lint_spec.rb +++ b/spec/features/ci_lint_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'CI Lint', js: true do +describe 'CI Lint', :js do before do sign_in(create(:user)) end diff --git a/spec/features/container_registry_spec.rb b/spec/features/container_registry_spec.rb index 45213dc6995..d5e9de20e59 100644 --- a/spec/features/container_registry_spec.rb +++ b/spec/features/container_registry_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Container Registry", js: true do +describe "Container Registry", :js do let(:user) { create(:user) } let(:project) { create(:project) } diff --git a/spec/features/copy_as_gfm_spec.rb b/spec/features/copy_as_gfm_spec.rb index ebcd0ba0dcd..c6ba1211b9e 100644 --- a/spec/features/copy_as_gfm_spec.rb +++ b/spec/features/copy_as_gfm_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Copy as GFM', js: true do +describe 'Copy as GFM', :js do include MarkupHelper include RepoHelpers include ActionView::Helpers::JavaScriptHelper diff --git a/spec/features/cycle_analytics_spec.rb b/spec/features/cycle_analytics_spec.rb index bfe9dac3bd4..177cd50dd72 100644 --- a/spec/features/cycle_analytics_spec.rb +++ b/spec/features/cycle_analytics_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Cycle Analytics', js: true do +feature 'Cycle Analytics', :js do let(:user) { create(:user) } let(:guest) { create(:user) } let(:project) { create(:project, :repository) } diff --git a/spec/features/dashboard/active_tab_spec.rb b/spec/features/dashboard/active_tab_spec.rb index 08d8cc7922b..8bab501134b 100644 --- a/spec/features/dashboard/active_tab_spec.rb +++ b/spec/features/dashboard/active_tab_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -RSpec.describe 'Dashboard Active Tab', js: true do +RSpec.describe 'Dashboard Active Tab', :js do before do sign_in(create(:user)) end diff --git a/spec/features/dashboard/datetime_on_tooltips_spec.rb b/spec/features/dashboard/datetime_on_tooltips_spec.rb index b6dce1b8ec4..349f9a47112 100644 --- a/spec/features/dashboard/datetime_on_tooltips_spec.rb +++ b/spec/features/dashboard/datetime_on_tooltips_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Tooltips on .timeago dates', js: true do +feature 'Tooltips on .timeago dates', :js do let(:user) { create(:user) } let(:project) { create(:project, name: 'test', namespace: user.namespace) } let(:created_date) { Date.yesterday.to_time } diff --git a/spec/features/dashboard/group_spec.rb b/spec/features/dashboard/group_spec.rb index 60a16830cdc..970173c7aaf 100644 --- a/spec/features/dashboard/group_spec.rb +++ b/spec/features/dashboard/group_spec.rb @@ -5,7 +5,7 @@ RSpec.describe 'Dashboard Group' do sign_in(create(:user)) end - it 'creates new group', js: true do + it 'creates new group', :js do visit dashboard_groups_path find('.btn-new').trigger('click') new_path = 'Samurai' diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index 795335aa106..5610894fd9a 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -24,7 +24,7 @@ RSpec.describe 'Dashboard Issues' do expect(page).not_to have_content(other_issue.title) end - it 'shows checkmark when unassigned is selected for assignee', js: true do + it 'shows checkmark when unassigned is selected for assignee', :js do find('.js-assignee-search').click find('li', text: 'Unassigned').click find('.js-assignee-search').click @@ -32,7 +32,7 @@ RSpec.describe 'Dashboard Issues' do expect(find('li[data-user-id="0"] a.is-active')).to be_visible end - it 'shows issues when current user is author', js: true do + it 'shows issues when current user is author', :js do find('#assignee_id', visible: false).set('') find('.js-author-search', match: :first).click @@ -70,7 +70,7 @@ RSpec.describe 'Dashboard Issues' do end describe 'new issue dropdown' do - it 'shows projects only with issues feature enabled', js: true do + it 'shows projects only with issues feature enabled', :js do find('.new-project-item-select-button').trigger('click') page.within('.select2-results') do @@ -79,7 +79,7 @@ RSpec.describe 'Dashboard Issues' do end end - it 'shows the new issue page', js: true do + it 'shows the new issue page', :js do find('.new-project-item-select-button').trigger('click') wait_for_requests diff --git a/spec/features/dashboard/label_filter_spec.rb b/spec/features/dashboard/label_filter_spec.rb index b1a207682c3..6802974c2ee 100644 --- a/spec/features/dashboard/label_filter_spec.rb +++ b/spec/features/dashboard/label_filter_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Dashboard > label filter', js: true do +describe 'Dashboard > label filter', :js do let(:user) { create(:user) } let(:project) { create(:project, name: 'test', namespace: user.namespace) } let(:project2) { create(:project, name: 'test2', path: 'test2', namespace: user.namespace) } diff --git a/spec/features/dashboard/merge_requests_spec.rb b/spec/features/dashboard/merge_requests_spec.rb index d26428ec286..f01ba442e58 100644 --- a/spec/features/dashboard/merge_requests_spec.rb +++ b/spec/features/dashboard/merge_requests_spec.rb @@ -24,7 +24,7 @@ feature 'Dashboard Merge Requests' do visit merge_requests_dashboard_path end - it 'shows projects only with merge requests feature enabled', js: true do + it 'shows projects only with merge requests feature enabled', :js do find('.new-project-item-select-button').trigger('click') page.within('.select2-results') do @@ -89,7 +89,7 @@ feature 'Dashboard Merge Requests' do expect(page).not_to have_content(other_merge_request.title) end - it 'shows authored merge requests', js: true do + it 'shows authored merge requests', :js do filter_item_select('Any Assignee', '.js-assignee-search') filter_item_select(current_user.to_reference, '.js-author-search') @@ -101,7 +101,7 @@ feature 'Dashboard Merge Requests' do expect(page).not_to have_content(other_merge_request.title) end - it 'shows all merge requests', js: true do + it 'shows all merge requests', :js do filter_item_select('Any Assignee', '.js-assignee-search') filter_item_select('Any Author', '.js-author-search') diff --git a/spec/features/dashboard/project_member_activity_index_spec.rb b/spec/features/dashboard/project_member_activity_index_spec.rb index 4a004107408..8f96899fb4f 100644 --- a/spec/features/dashboard/project_member_activity_index_spec.rb +++ b/spec/features/dashboard/project_member_activity_index_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Project member activity', js: true do +feature 'Project member activity', :js do let(:user) { create(:user) } let(:project) { create(:project, :public, name: 'x', namespace: user.namespace) } diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index 4da95ccc169..fbf8b5c0db6 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -80,7 +80,7 @@ feature 'Dashboard Projects' do end end - describe 'with a pipeline', clean_gitlab_redis_shared_state: true do + describe 'with a pipeline', :clean_gitlab_redis_shared_state do let(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.sha) } before do diff --git a/spec/features/dashboard/todos/todos_filtering_spec.rb b/spec/features/dashboard/todos/todos_filtering_spec.rb index 54d477f7274..ad0f132da8c 100644 --- a/spec/features/dashboard/todos/todos_filtering_spec.rb +++ b/spec/features/dashboard/todos/todos_filtering_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Dashboard > User filters todos', js: true do +feature 'Dashboard > User filters todos', :js do let(:user_1) { create(:user, username: 'user_1', name: 'user_1') } let(:user_2) { create(:user, username: 'user_2', name: 'user_2') } diff --git a/spec/features/dashboard/todos/todos_spec.rb b/spec/features/dashboard/todos/todos_spec.rb index 30bab7eeaa7..01aca443f4a 100644 --- a/spec/features/dashboard/todos/todos_spec.rb +++ b/spec/features/dashboard/todos/todos_spec.rb @@ -17,7 +17,7 @@ feature 'Dashboard Todos' do end end - context 'User has a todo', js: true do + context 'User has a todo', :js do before do create(:todo, :mentioned, user: user, project: project, target: issue, author: author) sign_in(user) @@ -177,7 +177,7 @@ feature 'Dashboard Todos' do end end - context 'User has done todos', js: true do + context 'User has done todos', :js do before do create(:todo, :mentioned, :done, user: user, project: project, target: issue, author: author) sign_in(user) @@ -249,7 +249,7 @@ feature 'Dashboard Todos' do expect(page).to have_selector('.gl-pagination .page', count: 2) end - describe 'mark all as done', js: true do + describe 'mark all as done', :js do before do visit dashboard_todos_path find('.js-todos-mark-all').trigger('click') @@ -267,7 +267,7 @@ feature 'Dashboard Todos' do end end - describe 'undo mark all as done', js: true do + describe 'undo mark all as done', :js do before do visit dashboard_todos_path end diff --git a/spec/features/expand_collapse_diffs_spec.rb b/spec/features/expand_collapse_diffs_spec.rb index 357d86497d9..1dd7547a7fc 100644 --- a/spec/features/expand_collapse_diffs_spec.rb +++ b/spec/features/expand_collapse_diffs_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Expand and collapse diffs', js: true do +feature 'Expand and collapse diffs', :js do let(:branch) { 'expand-collapse-diffs' } let(:project) { create(:project, :repository) } diff --git a/spec/features/gitlab_flavored_markdown_spec.rb b/spec/features/gitlab_flavored_markdown_spec.rb index 53b3bb3b65f..3c2186b3598 100644 --- a/spec/features/gitlab_flavored_markdown_spec.rb +++ b/spec/features/gitlab_flavored_markdown_spec.rb @@ -49,7 +49,7 @@ describe "GitLab Flavored Markdown" do end end - describe "for issues", js: true do + describe "for issues", :js do before do @other_issue = create(:issue, author: user, diff --git a/spec/features/group_variables_spec.rb b/spec/features/group_variables_spec.rb index 37814ba6238..d2d0be35f1c 100644 --- a/spec/features/group_variables_spec.rb +++ b/spec/features/group_variables_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Group variables', js: true do +feature 'Group variables', :js do let(:user) { create(:user) } let(:group) { create(:group) } diff --git a/spec/features/groups/labels/subscription_spec.rb b/spec/features/groups/labels/subscription_spec.rb index 1dd09d4f203..2e06caf98f6 100644 --- a/spec/features/groups/labels/subscription_spec.rb +++ b/spec/features/groups/labels/subscription_spec.rb @@ -11,7 +11,7 @@ feature 'Labels subscription' do gitlab_sign_in user end - scenario 'users can subscribe/unsubscribe to group labels', js: true do + scenario 'users can subscribe/unsubscribe to group labels', :js do visit group_labels_path(group) expect(page).to have_content('feature') diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index 4ec2e7e6012..862823d862e 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -85,7 +85,7 @@ feature 'Group' do end end - describe 'create a nested group', :nested_groups, js: true do + describe 'create a nested group', :nested_groups, :js do let(:group) { create(:group, path: 'foo') } context 'as admin' do @@ -142,7 +142,7 @@ feature 'Group' do expect(page).not_to have_content('secret-group') end - describe 'group edit', js: true do + describe 'group edit', :js do let(:group) { create(:group) } let(:path) { edit_group_path(group) } let(:new_name) { 'new-name' } @@ -207,7 +207,7 @@ feature 'Group' do end end - describe 'group page with nested groups', :nested_groups, js: true do + describe 'group page with nested groups', :nested_groups, :js do let!(:group) { create(:group) } let!(:nested_group) { create(:group, parent: group) } let!(:path) { group_path(group) } diff --git a/spec/features/issuables/default_sort_order_spec.rb b/spec/features/issuables/default_sort_order_spec.rb index 925d026ed61..caee7a67aec 100644 --- a/spec/features/issuables/default_sort_order_spec.rb +++ b/spec/features/issuables/default_sort_order_spec.rb @@ -26,7 +26,7 @@ describe 'Projects > Issuables > Default sort order' do MergeRequest.all end - context 'in the "merge requests" tab', js: true do + context 'in the "merge requests" tab', :js do let(:issuable_type) { :merge_request } it 'is "last created"' do @@ -37,7 +37,7 @@ describe 'Projects > Issuables > Default sort order' do end end - context 'in the "merge requests / open" tab', js: true do + context 'in the "merge requests / open" tab', :js do let(:issuable_type) { :merge_request } it 'is "created date"' do @@ -49,7 +49,7 @@ describe 'Projects > Issuables > Default sort order' do end end - context 'in the "merge requests / merged" tab', js: true do + context 'in the "merge requests / merged" tab', :js do let(:issuable_type) { :merged_merge_request } it 'is "last updated"' do @@ -61,7 +61,7 @@ describe 'Projects > Issuables > Default sort order' do end end - context 'in the "merge requests / closed" tab', js: true do + context 'in the "merge requests / closed" tab', :js do let(:issuable_type) { :closed_merge_request } it 'is "last updated"' do @@ -73,7 +73,7 @@ describe 'Projects > Issuables > Default sort order' do end end - context 'in the "merge requests / all" tab', js: true do + context 'in the "merge requests / all" tab', :js do let(:issuable_type) { :merge_request } it 'is "created date"' do @@ -102,7 +102,7 @@ describe 'Projects > Issuables > Default sort order' do Issue.all end - context 'in the "issues" tab', js: true do + context 'in the "issues" tab', :js do let(:issuable_type) { :issue } it 'is "created date"' do @@ -114,7 +114,7 @@ describe 'Projects > Issuables > Default sort order' do end end - context 'in the "issues / open" tab', js: true do + context 'in the "issues / open" tab', :js do let(:issuable_type) { :issue } it 'is "created date"' do @@ -126,7 +126,7 @@ describe 'Projects > Issuables > Default sort order' do end end - context 'in the "issues / closed" tab', js: true do + context 'in the "issues / closed" tab', :js do let(:issuable_type) { :closed_issue } it 'is "last updated"' do @@ -138,7 +138,7 @@ describe 'Projects > Issuables > Default sort order' do end end - context 'in the "issues / all" tab', js: true do + context 'in the "issues / all" tab', :js do let(:issuable_type) { :issue } it 'is "created date"' do diff --git a/spec/features/issuables/user_sees_sidebar_spec.rb b/spec/features/issuables/user_sees_sidebar_spec.rb index 2bd1c8aab86..c6c2e58ecea 100644 --- a/spec/features/issuables/user_sees_sidebar_spec.rb +++ b/spec/features/issuables/user_sees_sidebar_spec.rb @@ -12,7 +12,7 @@ describe 'Issue Sidebar on Mobile' do sign_in(user) end - context 'mobile sidebar on merge requests', js: true do + context 'mobile sidebar on merge requests', :js do before do visit project_merge_request_path(merge_request.project, merge_request) end @@ -20,7 +20,7 @@ describe 'Issue Sidebar on Mobile' do it_behaves_like "issue sidebar stays collapsed on mobile" end - context 'mobile sidebar on issues', js: true do + context 'mobile sidebar on issues', :js do before do visit project_issue_path(project, issue) end diff --git a/spec/features/issues/award_emoji_spec.rb b/spec/features/issues/award_emoji_spec.rb index a29acb30163..850b35c4467 100644 --- a/spec/features/issues/award_emoji_spec.rb +++ b/spec/features/issues/award_emoji_spec.rb @@ -24,7 +24,7 @@ describe 'Awards Emoji' do end # Regression test: https://gitlab.com/gitlab-org/gitlab-ce/issues/29529 - it 'does not shows a 500 page', js: true do + it 'does not shows a 500 page', :js do expect(page).to have_text(issue.title) end end @@ -37,37 +37,37 @@ describe 'Awards Emoji' do wait_for_requests end - it 'increments the thumbsdown emoji', js: true do + it 'increments the thumbsdown emoji', :js do find('[data-name="thumbsdown"]').click wait_for_requests expect(thumbsdown_emoji).to have_text("1") end context 'click the thumbsup emoji' do - it 'increments the thumbsup emoji', js: true do + it 'increments the thumbsup emoji', :js do find('[data-name="thumbsup"]').click wait_for_requests expect(thumbsup_emoji).to have_text("1") end - it 'decrements the thumbsdown emoji', js: true do + it 'decrements the thumbsdown emoji', :js do expect(thumbsdown_emoji).to have_text("0") end end context 'click the thumbsdown emoji' do - it 'increments the thumbsdown emoji', js: true do + it 'increments the thumbsdown emoji', :js do find('[data-name="thumbsdown"]').click wait_for_requests expect(thumbsdown_emoji).to have_text("1") end - it 'decrements the thumbsup emoji', js: true do + it 'decrements the thumbsup emoji', :js do expect(thumbsup_emoji).to have_text("0") end end - it 'toggles the smiley emoji on a note', js: true do + it 'toggles the smiley emoji on a note', :js do toggle_smiley_emoji(true) within('.note-body') do @@ -82,7 +82,7 @@ describe 'Awards Emoji' do end context 'execute /award quick action' do - it 'toggles the emoji award on noteable', js: true do + it 'toggles the emoji award on noteable', :js do execute_quick_action('/award :100:') expect(find(noteable_award_counter)).to have_text("1") @@ -95,7 +95,7 @@ describe 'Awards Emoji' do end end - context 'unauthorized user', js: true do + context 'unauthorized user', :js do before do visit project_issue_path(project, issue) end diff --git a/spec/features/issues/award_spec.rb b/spec/features/issues/award_spec.rb index e95eb19f7d1..ddb69d414da 100644 --- a/spec/features/issues/award_spec.rb +++ b/spec/features/issues/award_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Issue awards', js: true do +feature 'Issue awards', :js do let(:user) { create(:user) } let(:project) { create(:project, :public) } let(:issue) { create(:issue, project: project) } diff --git a/spec/features/issues/bulk_assignment_labels_spec.rb b/spec/features/issues/bulk_assignment_labels_spec.rb index a89dcdf41dc..3223eb20b55 100644 --- a/spec/features/issues/bulk_assignment_labels_spec.rb +++ b/spec/features/issues/bulk_assignment_labels_spec.rb @@ -9,7 +9,7 @@ feature 'Issues > Labels bulk assignment' do let!(:feature) { create(:label, project: project, title: 'feature') } let!(:wontfix) { create(:label, project: project, title: 'wontfix') } - context 'as an allowed user', js: true do + context 'as an allowed user', :js do before do project.team << [user, :master] diff --git a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb index 80cc8d22999..822ba48e005 100644 --- a/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_discussions_in_merge_request_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Resolving all open discussions in a merge request from an issue', js: true do +feature 'Resolving all open discussions in a merge request from an issue', :js do let(:user) { create(:user) } let(:project) { create(:project, :repository) } let(:merge_request) { create(:merge_request, source_project: project) } diff --git a/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb b/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb index ad5fd0fd97b..f0bed85595c 100644 --- a/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb +++ b/spec/features/issues/create_issue_for_single_discussion_in_merge_request_spec.rb @@ -24,7 +24,7 @@ feature 'Resolve an open discussion in a merge request by creating an issue' do end end - context 'resolving the discussion', js: true do + context 'resolving the discussion', :js do before do click_button 'Resolve discussion' end diff --git a/spec/features/issues/filtered_search/dropdown_author_spec.rb b/spec/features/issues/filtered_search/dropdown_author_spec.rb index 3cec59050ab..5e20fb48768 100644 --- a/spec/features/issues/filtered_search/dropdown_author_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_author_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe 'Dropdown author', js: true do +describe 'Dropdown author', :js do include FilteredSearchHelpers let!(:project) { create(:project) } diff --git a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb index 44741bcc92d..3012c77f2b9 100644 --- a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe 'Dropdown emoji', js: true do +describe 'Dropdown emoji', :js do include FilteredSearchHelpers let!(:project) { create(:project, :public) } diff --git a/spec/features/issues/filtered_search/dropdown_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb index c46803112a9..cbc4f8d4c50 100644 --- a/spec/features/issues/filtered_search/dropdown_label_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_label_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Dropdown label', js: true do +describe 'Dropdown label', :js do include FilteredSearchHelpers let(:project) { create(:project) } diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb index 630d6a10c9c..2974016c6a7 100644 --- a/spec/features/issues/filtered_search/filter_issues_spec.rb +++ b/spec/features/issues/filtered_search/filter_issues_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Filter issues', js: true do +describe 'Filter issues', :js do include FilteredSearchHelpers let(:project) { create(:project) } diff --git a/spec/features/issues/filtered_search/recent_searches_spec.rb b/spec/features/issues/filtered_search/recent_searches_spec.rb index 447281ed19d..eef7988e2bd 100644 --- a/spec/features/issues/filtered_search/recent_searches_spec.rb +++ b/spec/features/issues/filtered_search/recent_searches_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Recent searches', js: true do +describe 'Recent searches', :js do include FilteredSearchHelpers let(:project_1) { create(:project, :public) } diff --git a/spec/features/issues/filtered_search/search_bar_spec.rb b/spec/features/issues/filtered_search/search_bar_spec.rb index d4dd570fb37..88688422dc7 100644 --- a/spec/features/issues/filtered_search/search_bar_spec.rb +++ b/spec/features/issues/filtered_search/search_bar_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe 'Search bar', js: true do +describe 'Search bar', :js do include FilteredSearchHelpers let!(:project) { create(:project) } diff --git a/spec/features/issues/filtered_search/visual_tokens_spec.rb b/spec/features/issues/filtered_search/visual_tokens_spec.rb index 2b624f4842d..920f5546eef 100644 --- a/spec/features/issues/filtered_search/visual_tokens_spec.rb +++ b/spec/features/issues/filtered_search/visual_tokens_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe 'Visual tokens', js: true do +describe 'Visual tokens', :js do include FilteredSearchHelpers include WaitForRequests diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index c6cf6265645..15041ff04ea 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'GFM autocomplete', js: true do +feature 'GFM autocomplete', :js do let(:user) { create(:user, name: '💃speciąl someone💃', username: 'someone.special') } let(:project) { create(:project) } let(:label) { create(:label, project: project, title: 'special+') } diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb index af11b474842..bc9c3d825c1 100644 --- a/spec/features/issues/issue_sidebar_spec.rb +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -13,7 +13,7 @@ feature 'Issue Sidebar' do sign_in(user) end - context 'assignee', js: true do + context 'assignee', :js do let(:user2) { create(:user) } let(:issue2) { create(:issue, project: project, author: user2) } @@ -82,7 +82,7 @@ feature 'Issue Sidebar' do visit_issue(project, issue) end - context 'sidebar', js: true do + context 'sidebar', :js do it 'changes size when the screen size is smaller' do sidebar_selector = 'aside.right-sidebar.right-sidebar-collapsed' # Resize the window @@ -101,7 +101,7 @@ feature 'Issue Sidebar' do end end - context 'editing issue labels', js: true do + context 'editing issue labels', :js do before do page.within('.block.labels') do find('.edit-link').click @@ -114,7 +114,7 @@ feature 'Issue Sidebar' do end end - context 'creating a new label', js: true do + context 'creating a new label', :js do before do page.within('.block.labels') do click_link 'Create new' diff --git a/spec/features/issues/markdown_toolbar_spec.rb b/spec/features/issues/markdown_toolbar_spec.rb index 634ea111dc1..6869c2c869d 100644 --- a/spec/features/issues/markdown_toolbar_spec.rb +++ b/spec/features/issues/markdown_toolbar_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Issue markdown toolbar', js: true do +feature 'Issue markdown toolbar', :js do let(:project) { create(:project, :public) } let(:issue) { create(:issue, project: project) } let(:user) { create(:user) } diff --git a/spec/features/issues/move_spec.rb b/spec/features/issues/move_spec.rb index b2724945da4..6d7b1b1cd8f 100644 --- a/spec/features/issues/move_spec.rb +++ b/spec/features/issues/move_spec.rb @@ -37,7 +37,7 @@ feature 'issue move to another project' do visit issue_path(issue) end - scenario 'moving issue to another project', js: true do + scenario 'moving issue to another project', :js do find('.js-move-issue').trigger('click') wait_for_requests all('.js-move-issue-dropdown-item')[0].click @@ -49,7 +49,7 @@ feature 'issue move to another project' do expect(page.current_path).to include project_path(new_project) end - scenario 'searching project dropdown', js: true do + scenario 'searching project dropdown', :js do new_project_search.team << [user, :reporter] find('.js-move-issue').trigger('click') @@ -63,7 +63,7 @@ feature 'issue move to another project' do end end - context 'user does not have permission to move the issue to a project', js: true do + context 'user does not have permission to move the issue to a project', :js do let!(:private_project) { create(:project, :private) } let(:another_project) { create(:project) } background { another_project.team << [user, :guest] } diff --git a/spec/features/issues/spam_issues_spec.rb b/spec/features/issues/spam_issues_spec.rb index 332ce78b138..d25231d624c 100644 --- a/spec/features/issues/spam_issues_spec.rb +++ b/spec/features/issues/spam_issues_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe 'New issue', js: true do +describe 'New issue', :js do include StubENV let(:project) { create(:project, :public) } diff --git a/spec/features/issues/todo_spec.rb b/spec/features/issues/todo_spec.rb index 8405f1cd48d..29a2d38ae18 100644 --- a/spec/features/issues/todo_spec.rb +++ b/spec/features/issues/todo_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Manually create a todo item from issue', js: true do +feature 'Manually create a todo item from issue', :js do let!(:project) { create(:project) } let!(:issue) { create(:issue, project: project) } let!(:user) { create(:user)} diff --git a/spec/features/issues/user_uses_slash_commands_spec.rb b/spec/features/issues/user_uses_slash_commands_spec.rb index 7437c469a72..9f5e25ff2cb 100644 --- a/spec/features/issues/user_uses_slash_commands_spec.rb +++ b/spec/features/issues/user_uses_slash_commands_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Issues > User uses quick actions', js: true do +feature 'Issues > User uses quick actions', :js do include QuickActionsHelpers it_behaves_like 'issuable record that supports quick actions in its description and notes', :issue do diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index e2db1442d90..25e99774575 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -270,7 +270,7 @@ describe 'Issues', :js do visit namespace_project_issues_path(user.namespace, project1) end - it 'changes incoming email address token', js: true do + it 'changes incoming email address token', :js do find('.issue-email-modal-btn').click previous_token = find('input#issue_email').value find('.incoming-email-token-reset').trigger('click') @@ -286,7 +286,7 @@ describe 'Issues', :js do end end - describe 'update labels from issue#show', js: true do + describe 'update labels from issue#show', :js do let(:issue) { create(:issue, project: project, author: user, assignees: [user]) } let!(:label) { create(:label, project: project) } @@ -309,7 +309,7 @@ describe 'Issues', :js do let(:issue) { create(:issue, project: project, author: user, assignees: [user]) } context 'by authorized user' do - it 'allows user to select unassigned', js: true do + it 'allows user to select unassigned', :js do visit project_issue_path(project, issue) page.within('.assignee') do @@ -327,7 +327,7 @@ describe 'Issues', :js do expect(issue.reload.assignees).to be_empty end - it 'allows user to select an assignee', js: true do + it 'allows user to select an assignee', :js do issue2 = create(:issue, project: project, author: user) visit project_issue_path(project, issue2) @@ -348,7 +348,7 @@ describe 'Issues', :js do end end - it 'allows user to unselect themselves', js: true do + it 'allows user to unselect themselves', :js do issue2 = create(:issue, project: project, author: user) visit project_issue_path(project, issue2) @@ -377,7 +377,7 @@ describe 'Issues', :js do project.team << [[guest], :guest] end - it 'shows assignee text', js: true do + it 'shows assignee text', :js do sign_out(:user) sign_in(guest) @@ -392,7 +392,7 @@ describe 'Issues', :js do let!(:milestone) { create(:milestone, project: project) } context 'by authorized user' do - it 'allows user to select unassigned', js: true do + it 'allows user to select unassigned', :js do visit project_issue_path(project, issue) page.within('.milestone') do @@ -410,7 +410,7 @@ describe 'Issues', :js do expect(issue.reload.milestone).to be_nil end - it 'allows user to de-select milestone', js: true do + it 'allows user to de-select milestone', :js do visit project_issue_path(project, issue) page.within('.milestone') do @@ -440,7 +440,7 @@ describe 'Issues', :js do issue.save end - it 'shows milestone text', js: true do + it 'shows milestone text', :js do sign_out(:user) sign_in(guest) @@ -473,7 +473,7 @@ describe 'Issues', :js do end end - context 'dropzone upload file', js: true do + context 'dropzone upload file', :js do before do visit new_project_issue_path(project) end @@ -544,7 +544,7 @@ describe 'Issues', :js do end describe 'due date' do - context 'update due on issue#show', js: true do + context 'update due on issue#show', :js do let(:issue) { create(:issue, project: project, author: user, assignees: [user]) } before do @@ -588,8 +588,8 @@ describe 'Issues', :js do end end - describe 'title issue#show', js: true do - it 'updates the title', js: true do + describe 'title issue#show', :js do + it 'updates the title', :js do issue = create(:issue, author: user, assignees: [user], project: project, title: 'new title') visit project_issue_path(project, issue) @@ -603,7 +603,7 @@ describe 'Issues', :js do end end - describe 'confidential issue#show', js: true do + describe 'confidential issue#show', :js do it 'shows confidential sibebar information as confidential and can be turned off' do issue = create(:issue, :confidential, project: project) diff --git a/spec/features/login_spec.rb b/spec/features/login_spec.rb index c9983f0941f..6dfabcc7225 100644 --- a/spec/features/login_spec.rb +++ b/spec/features/login_spec.rb @@ -197,7 +197,7 @@ feature 'Login' do expect(page).to have_content('The global settings require you to enable Two-Factor Authentication for your account. You need to do this before ') end - it 'allows skipping two-factor configuration', js: true do + it 'allows skipping two-factor configuration', :js do expect(current_path).to eq profile_two_factor_auth_path click_link 'Configure it later' @@ -215,7 +215,7 @@ feature 'Login' do ) end - it 'disallows skipping two-factor configuration', js: true do + it 'disallows skipping two-factor configuration', :js do expect(current_path).to eq profile_two_factor_auth_path expect(page).not_to have_link('Configure it later') end @@ -260,7 +260,7 @@ feature 'Login' do 'before ') end - it 'allows skipping two-factor configuration', js: true do + it 'allows skipping two-factor configuration', :js do expect(current_path).to eq profile_two_factor_auth_path click_link 'Configure it later' @@ -279,7 +279,7 @@ feature 'Login' do ) end - it 'disallows skipping two-factor configuration', js: true do + it 'disallows skipping two-factor configuration', :js do expect(current_path).to eq profile_two_factor_auth_path expect(page).not_to have_link('Configure it later') end diff --git a/spec/features/merge_requests/assign_issues_spec.rb b/spec/features/merge_requests/assign_issues_spec.rb index 63fa72650ac..d49d145f254 100644 --- a/spec/features/merge_requests/assign_issues_spec.rb +++ b/spec/features/merge_requests/assign_issues_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Merge request issue assignment', js: true do +feature 'Merge request issue assignment', :js do let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } let(:issue1) { create(:issue, project: project) } diff --git a/spec/features/merge_requests/award_spec.rb b/spec/features/merge_requests/award_spec.rb index e886309133d..a24464f2556 100644 --- a/spec/features/merge_requests/award_spec.rb +++ b/spec/features/merge_requests/award_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Merge request awards', js: true do +feature 'Merge request awards', :js do let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } let(:merge_request) { create(:merge_request, source_project: project) } diff --git a/spec/features/merge_requests/check_if_mergeable_with_unresolved_discussions_spec.rb b/spec/features/merge_requests/check_if_mergeable_with_unresolved_discussions_spec.rb index 1f5e7b55fb0..fbbfe7942be 100644 --- a/spec/features/merge_requests/check_if_mergeable_with_unresolved_discussions_spec.rb +++ b/spec/features/merge_requests/check_if_mergeable_with_unresolved_discussions_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Check if mergeable with unresolved discussions', js: true do +feature 'Check if mergeable with unresolved discussions', :js do let(:user) { create(:user) } let(:project) { create(:project, :repository) } let!(:merge_request) { create(:merge_request_with_diff_notes, source_project: project, author: user) } diff --git a/spec/features/merge_requests/cherry_pick_spec.rb b/spec/features/merge_requests/cherry_pick_spec.rb index 4b1e1b9a8d4..48f370c3ad4 100644 --- a/spec/features/merge_requests/cherry_pick_spec.rb +++ b/spec/features/merge_requests/cherry_pick_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Cherry-pick Merge Requests', js: true do +describe 'Cherry-pick Merge Requests', :js do let(:user) { create(:user) } let(:group) { create(:group) } let(:project) { create(:project, :repository, namespace: group) } diff --git a/spec/features/merge_requests/closes_issues_spec.rb b/spec/features/merge_requests/closes_issues_spec.rb index 299b4f5708a..4dd4e40f52c 100644 --- a/spec/features/merge_requests/closes_issues_spec.rb +++ b/spec/features/merge_requests/closes_issues_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Merge Request closing issues message', js: true do +feature 'Merge Request closing issues message', :js do let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } let(:issue_1) { create(:issue, project: project)} diff --git a/spec/features/merge_requests/conflicts_spec.rb b/spec/features/merge_requests/conflicts_spec.rb index 2d2c674f8fb..b0432ed8fc6 100644 --- a/spec/features/merge_requests/conflicts_spec.rb +++ b/spec/features/merge_requests/conflicts_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Merge request conflict resolution', js: true do +feature 'Merge request conflict resolution', :js do let(:user) { create(:user) } let(:project) { create(:project, :repository) } diff --git a/spec/features/merge_requests/create_new_mr_spec.rb b/spec/features/merge_requests/create_new_mr_spec.rb index 96e8027a54d..5402d61da54 100644 --- a/spec/features/merge_requests/create_new_mr_spec.rb +++ b/spec/features/merge_requests/create_new_mr_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Create New Merge Request', js: true do +feature 'Create New Merge Request', :js do let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } diff --git a/spec/features/merge_requests/created_from_fork_spec.rb b/spec/features/merge_requests/created_from_fork_spec.rb index f9bc3ee6c58..d03ddfece74 100644 --- a/spec/features/merge_requests/created_from_fork_spec.rb +++ b/spec/features/merge_requests/created_from_fork_spec.rb @@ -34,7 +34,7 @@ feature 'Merge request created from fork' do commit_id: merge_request.commit_shas.first) end - scenario 'user can reply to the comment', js: true do + scenario 'user can reply to the comment', :js do visit_merge_request(merge_request) expect(page).to have_content(comment) @@ -57,7 +57,7 @@ feature 'Merge request created from fork' do forked_project.destroy! end - scenario 'user can access merge request', js: true do + scenario 'user can access merge request', :js do visit_merge_request(merge_request) expect(page).to have_content 'Test merge request' @@ -78,7 +78,7 @@ feature 'Merge request created from fork' do create(:ci_build, pipeline: pipeline, name: 'spinach') end - scenario 'user visits a pipelines page', js: true do + scenario 'user visits a pipelines page', :js do visit_merge_request(merge_request) page.within('.merge-request-tabs') { click_link 'Pipelines' } diff --git a/spec/features/merge_requests/deleted_source_branch_spec.rb b/spec/features/merge_requests/deleted_source_branch_spec.rb index 874c6e2ff69..7f69e82af4c 100644 --- a/spec/features/merge_requests/deleted_source_branch_spec.rb +++ b/spec/features/merge_requests/deleted_source_branch_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' # This test serves as a regression test for a bug that caused an error # message to be shown by JavaScript when the source branch was deleted. # Please do not remove "js: true". -describe 'Deleted source branch', js: true do +describe 'Deleted source branch', :js do let(:user) { create(:user) } let(:merge_request) { create(:merge_request) } diff --git a/spec/features/merge_requests/diff_notes_avatars_spec.rb b/spec/features/merge_requests/diff_notes_avatars_spec.rb index 4766cdf716f..9aa0672feae 100644 --- a/spec/features/merge_requests/diff_notes_avatars_spec.rb +++ b/spec/features/merge_requests/diff_notes_avatars_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Diff note avatars', js: true do +feature 'Diff note avatars', :js do include NoteInteractionHelpers let(:user) { create(:user) } diff --git a/spec/features/merge_requests/diff_notes_resolve_spec.rb b/spec/features/merge_requests/diff_notes_resolve_spec.rb index fd110e68e84..637e6036384 100644 --- a/spec/features/merge_requests/diff_notes_resolve_spec.rb +++ b/spec/features/merge_requests/diff_notes_resolve_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Diff notes resolve', js: true do +feature 'Diff notes resolve', :js do let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user, title: "Bug NS-04") } diff --git a/spec/features/merge_requests/diffs_spec.rb b/spec/features/merge_requests/diffs_spec.rb index ee9bb50a881..80fb7335989 100644 --- a/spec/features/merge_requests/diffs_spec.rb +++ b/spec/features/merge_requests/diffs_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Diffs URL', js: true do +feature 'Diffs URL', :js do include ProjectForksHelper let(:project) { create(:project, :public, :repository) } diff --git a/spec/features/merge_requests/edit_mr_spec.rb b/spec/features/merge_requests/edit_mr_spec.rb index 7386e78fb13..4538555c168 100644 --- a/spec/features/merge_requests/edit_mr_spec.rb +++ b/spec/features/merge_requests/edit_mr_spec.rb @@ -29,7 +29,7 @@ feature 'Edit Merge Request' do expect(page).to have_content 'Someone edited the merge request the same time you did' end - it 'allows to unselect "Remove source branch"', js: true do + it 'allows to unselect "Remove source branch"', :js do merge_request.update(merge_params: { 'force_remove_source_branch' => '1' }) expect(merge_request.merge_params['force_remove_source_branch']).to be_truthy @@ -42,7 +42,7 @@ feature 'Edit Merge Request' do expect(page).to have_content 'Remove source branch' end - it 'should preserve description textarea height', js: true do + it 'should preserve description textarea height', :js do long_description = %q( Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ac ornare ligula, ut tempus arcu. Etiam ultricies accumsan dolor vitae faucibus. Donec at elit lacus. Mauris orci ante, aliquam quis lorem eget, convallis faucibus arcu. Aenean at pulvinar lacus. Ut viverra quam massa, molestie ornare tortor dignissim a. Suspendisse tristique pellentesque tellus, id lacinia metus elementum id. Nam tristique, arcu rhoncus faucibus viverra, lacus ipsum sagittis ligula, vitae convallis odio lacus a nibh. Ut tincidunt est purus, ac vestibulum augue maximus in. Suspendisse vel erat et mi ultricies semper. Pellentesque volutpat pellentesque consequat. diff --git a/spec/features/merge_requests/filter_by_milestone_spec.rb b/spec/features/merge_requests/filter_by_milestone_spec.rb index 166c02a7a7f..8b9ff9be943 100644 --- a/spec/features/merge_requests/filter_by_milestone_spec.rb +++ b/spec/features/merge_requests/filter_by_milestone_spec.rb @@ -18,7 +18,7 @@ feature 'Merge Request filtering by Milestone' do sign_in(user) end - scenario 'filters by no Milestone', js: true do + scenario 'filters by no Milestone', :js do create(:merge_request, :with_diffs, source_project: project) create(:merge_request, :simple, source_project: project, milestone: milestone) @@ -32,7 +32,7 @@ feature 'Merge Request filtering by Milestone' do expect(page).to have_css('.merge-request', count: 1) end - context 'filters by upcoming milestone', js: true do + context 'filters by upcoming milestone', :js do it 'does not show merge requests with no expiry' do create(:merge_request, :with_diffs, source_project: project) create(:merge_request, :simple, source_project: project, milestone: milestone) @@ -67,7 +67,7 @@ feature 'Merge Request filtering by Milestone' do end end - scenario 'filters by a specific Milestone', js: true do + scenario 'filters by a specific Milestone', :js do create(:merge_request, :with_diffs, source_project: project, milestone: milestone) create(:merge_request, :simple, source_project: project) @@ -83,7 +83,7 @@ feature 'Merge Request filtering by Milestone' do milestone.update(name: "rock 'n' roll") end - scenario 'filters by a specific Milestone', js: true do + scenario 'filters by a specific Milestone', :js do create(:merge_request, :with_diffs, source_project: project, milestone: milestone) create(:merge_request, :simple, source_project: project) diff --git a/spec/features/merge_requests/filter_merge_requests_spec.rb b/spec/features/merge_requests/filter_merge_requests_spec.rb index 16703bc1c01..aac295ab940 100644 --- a/spec/features/merge_requests/filter_merge_requests_spec.rb +++ b/spec/features/merge_requests/filter_merge_requests_spec.rb @@ -36,7 +36,7 @@ describe 'Filter merge requests' do expect_mr_list_count(0) end - context 'assignee', js: true do + context 'assignee', :js do it 'updates to current user' do expect_assignee_visual_tokens() end @@ -69,7 +69,7 @@ describe 'Filter merge requests' do expect_mr_list_count(0) end - context 'milestone', js: true do + context 'milestone', :js do it 'updates to current milestone' do expect_milestone_visual_tokens() end @@ -88,7 +88,7 @@ describe 'Filter merge requests' do end end - describe 'for label from mr#index', js: true do + describe 'for label from mr#index', :js do it 'filters by no label' do input_filtered_search('label:none') @@ -137,7 +137,7 @@ describe 'Filter merge requests' do expect_mr_list_count(0) end - context 'assignee and label', js: true do + context 'assignee and label', :js do def expect_assignee_label_visual_tokens wait_for_requests @@ -183,7 +183,7 @@ describe 'Filter merge requests' do visit project_merge_requests_path(project) end - context 'only text', js: true do + context 'only text', :js do it 'filters merge requests by searched text' do input_filtered_search('bug') @@ -199,7 +199,7 @@ describe 'Filter merge requests' do end end - context 'filters and searches', js: true do + context 'filters and searches', :js do it 'filters by text and label' do input_filtered_search('Bug') @@ -289,7 +289,7 @@ describe 'Filter merge requests' do end end - describe 'filter by assignee id', js: true do + describe 'filter by assignee id', :js do it 'filter by current user' do visit project_merge_requests_path(project, assignee_id: user.id) @@ -312,7 +312,7 @@ describe 'Filter merge requests' do end end - describe 'filter by author id', js: true do + describe 'filter by author id', :js do it 'filter by current user' do visit project_merge_requests_path(project, author_id: user.id) diff --git a/spec/features/merge_requests/image_diff_notes.rb b/spec/features/merge_requests/image_diff_notes.rb index e8ca8a98d70..3c53b51e330 100644 --- a/spec/features/merge_requests/image_diff_notes.rb +++ b/spec/features/merge_requests/image_diff_notes.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'image diff notes', js: true do +feature 'image diff notes', :js do include NoteInteractionHelpers let(:user) { create(:user) } diff --git a/spec/features/merge_requests/merge_commit_message_toggle_spec.rb b/spec/features/merge_requests/merge_commit_message_toggle_spec.rb index 08a3bb84aac..82b2b56ef80 100644 --- a/spec/features/merge_requests/merge_commit_message_toggle_spec.rb +++ b/spec/features/merge_requests/merge_commit_message_toggle_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Clicking toggle commit message link', js: true do +feature 'Clicking toggle commit message link', :js do let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } let(:issue_1) { create(:issue, project: project)} diff --git a/spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb b/spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb index 59e67420333..91f207bd339 100644 --- a/spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb +++ b/spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Only allow merge requests to be merged if the pipeline succeeds', js: true do +feature 'Only allow merge requests to be merged if the pipeline succeeds', :js do let(:merge_request) { create(:merge_request_with_diffs) } let(:project) { merge_request.target_project } @@ -10,7 +10,7 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', js: t project.team << [merge_request.author, :master] end - context 'project does not have CI enabled', js: true do + context 'project does not have CI enabled', :js do it 'allows MR to be merged' do visit_merge_request(merge_request) @@ -20,7 +20,7 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', js: t end end - context 'when project has CI enabled', js: true do + context 'when project has CI enabled', :js do given!(:pipeline) do create(:ci_empty_pipeline, project: project, diff --git a/spec/features/merge_requests/pipelines_spec.rb b/spec/features/merge_requests/pipelines_spec.rb index 347ce788b36..a3fcc27cab0 100644 --- a/spec/features/merge_requests/pipelines_spec.rb +++ b/spec/features/merge_requests/pipelines_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Pipelines for Merge Requests', js: true do +feature 'Pipelines for Merge Requests', :js do describe 'pipeline tab' do given(:user) { create(:user) } given(:merge_request) { create(:merge_request) } diff --git a/spec/features/merge_requests/resolve_outdated_diff_discussions.rb b/spec/features/merge_requests/resolve_outdated_diff_discussions.rb index 55a82bdf2b9..25abbb469ab 100644 --- a/spec/features/merge_requests/resolve_outdated_diff_discussions.rb +++ b/spec/features/merge_requests/resolve_outdated_diff_discussions.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Resolve outdated diff discussions', js: true do +feature 'Resolve outdated diff discussions', :js do let(:project) { create(:project, :repository, :public) } let(:merge_request) do diff --git a/spec/features/merge_requests/target_branch_spec.rb b/spec/features/merge_requests/target_branch_spec.rb index 9bbf2610bcb..bce36e05e57 100644 --- a/spec/features/merge_requests/target_branch_spec.rb +++ b/spec/features/merge_requests/target_branch_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Target branch', js: true do +describe 'Target branch', :js do let(:user) { create(:user) } let(:merge_request) { create(:merge_request) } let(:project) { merge_request.project } diff --git a/spec/features/merge_requests/toggle_whitespace_changes_spec.rb b/spec/features/merge_requests/toggle_whitespace_changes_spec.rb index dd989fd49b2..fa3d988b27a 100644 --- a/spec/features/merge_requests/toggle_whitespace_changes_spec.rb +++ b/spec/features/merge_requests/toggle_whitespace_changes_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Toggle Whitespace Changes', js: true do +feature 'Toggle Whitespace Changes', :js do before do sign_in(create(:admin)) merge_request = create(:merge_request) diff --git a/spec/features/merge_requests/toggler_behavior_spec.rb b/spec/features/merge_requests/toggler_behavior_spec.rb index 4e5ec9fbd2d..cd92ad22267 100644 --- a/spec/features/merge_requests/toggler_behavior_spec.rb +++ b/spec/features/merge_requests/toggler_behavior_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'toggler_behavior', js: true do +feature 'toggler_behavior', :js do let(:user) { create(:user) } let(:project) { create(:project, :repository) } let(:merge_request) { create(:merge_request, source_project: project, author: user) } diff --git a/spec/features/merge_requests/update_merge_requests_spec.rb b/spec/features/merge_requests/update_merge_requests_spec.rb index 9cb8a357309..1a41fd36a4f 100644 --- a/spec/features/merge_requests/update_merge_requests_spec.rb +++ b/spec/features/merge_requests/update_merge_requests_spec.rb @@ -10,7 +10,7 @@ feature 'Multiple merge requests updating from merge_requests#index' do sign_in(user) end - context 'status', js: true do + context 'status', :js do describe 'close merge request' do before do visit project_merge_requests_path(project) @@ -37,7 +37,7 @@ feature 'Multiple merge requests updating from merge_requests#index' do end end - context 'assignee', js: true do + context 'assignee', :js do describe 'set assignee' do before do visit project_merge_requests_path(project) @@ -67,7 +67,7 @@ feature 'Multiple merge requests updating from merge_requests#index' do end end - context 'milestone', js: true do + context 'milestone', :js do let(:milestone) { create(:milestone, project: project) } describe 'set milestone' do diff --git a/spec/features/merge_requests/user_uses_slash_commands_spec.rb b/spec/features/merge_requests/user_uses_slash_commands_spec.rb index 95c50df1896..ee0766f1192 100644 --- a/spec/features/merge_requests/user_uses_slash_commands_spec.rb +++ b/spec/features/merge_requests/user_uses_slash_commands_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Merge Requests > User uses quick actions', js: true do +feature 'Merge Requests > User uses quick actions', :js do include QuickActionsHelpers it_behaves_like 'issuable record that supports quick actions in its description and notes', :merge_request do diff --git a/spec/features/merge_requests/versions_spec.rb b/spec/features/merge_requests/versions_spec.rb index 8e231fbc281..50f7d721ff3 100644 --- a/spec/features/merge_requests/versions_spec.rb +++ b/spec/features/merge_requests/versions_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Merge Request versions', js: true do +feature 'Merge Request versions', :js do let(:merge_request) { create(:merge_request, importing: true) } let(:project) { merge_request.source_project } let!(:merge_request_diff1) { merge_request.merge_request_diffs.create(head_commit_sha: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9') } diff --git a/spec/features/merge_requests/widget_deployments_spec.rb b/spec/features/merge_requests/widget_deployments_spec.rb index c0221525c9f..5658c2c5122 100644 --- a/spec/features/merge_requests/widget_deployments_spec.rb +++ b/spec/features/merge_requests/widget_deployments_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Widget Deployments Header', js: true do +feature 'Widget Deployments Header', :js do describe 'when deployed to an environment' do given(:user) { create(:user) } given(:project) { merge_request.target_project } diff --git a/spec/features/merge_requests/widget_spec.rb b/spec/features/merge_requests/widget_spec.rb index ab1353e3369..2bad3b02250 100644 --- a/spec/features/merge_requests/widget_spec.rb +++ b/spec/features/merge_requests/widget_spec.rb @@ -256,7 +256,7 @@ describe 'Merge request', :js do end end - context 'user can merge into source project but cannot push to fork', js: true do + context 'user can merge into source project but cannot push to fork', :js do let(:fork_project) { create(:project, :public, :repository) } let(:user2) { create(:user) } diff --git a/spec/features/profiles/keys_spec.rb b/spec/features/profiles/keys_spec.rb index aa71c4dbba4..7d5ba3a7328 100644 --- a/spec/features/profiles/keys_spec.rb +++ b/spec/features/profiles/keys_spec.rb @@ -12,7 +12,7 @@ feature 'Profile > SSH Keys' do visit profile_keys_path end - scenario 'auto-populates the title', js: true do + scenario 'auto-populates the title', :js do fill_in('Key', with: attributes_for(:key).fetch(:key)) expect(page).to have_field("Title", with: "dummy@gitlab.com") diff --git a/spec/features/profiles/oauth_applications_spec.rb b/spec/features/profiles/oauth_applications_spec.rb index 45f78444362..8cb240077eb 100644 --- a/spec/features/profiles/oauth_applications_spec.rb +++ b/spec/features/profiles/oauth_applications_spec.rb @@ -7,7 +7,7 @@ describe 'Profile > Applications' do sign_in(user) end - describe 'User manages applications', js: true do + describe 'User manages applications', :js do it 'deletes an application' do create(:oauth_application, owner: user) visit oauth_applications_path diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb index f3124bbf29e..a572160dae9 100644 --- a/spec/features/profiles/personal_access_tokens_spec.rb +++ b/spec/features/profiles/personal_access_tokens_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Profile > Personal Access Tokens', js: true do +describe 'Profile > Personal Access Tokens', :js do let(:user) { create(:user) } def active_personal_access_tokens diff --git a/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb b/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb index 6a4173d43e1..d5fe5bdffc5 100644 --- a/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb +++ b/spec/features/profiles/user_changes_notified_of_own_activity_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Profile > Notifications > User changes notified_of_own_activity setting', js: true do +feature 'Profile > Notifications > User changes notified_of_own_activity setting', :js do let(:user) { create(:user) } before do diff --git a/spec/features/profiles/user_visits_notifications_tab_spec.rb b/spec/features/profiles/user_visits_notifications_tab_spec.rb index 48c1787c8b7..923ca8b1c80 100644 --- a/spec/features/profiles/user_visits_notifications_tab_spec.rb +++ b/spec/features/profiles/user_visits_notifications_tab_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'User visits the notifications tab', js: true do +feature 'User visits the notifications tab', :js do let(:project) { create(:project) } let(:user) { create(:user) } diff --git a/spec/features/projects/badges/list_spec.rb b/spec/features/projects/badges/list_spec.rb index 89ae891037e..68c4a647958 100644 --- a/spec/features/projects/badges/list_spec.rb +++ b/spec/features/projects/badges/list_spec.rb @@ -39,7 +39,7 @@ feature 'list of badges' do end end - scenario 'user changes current ref of build status badge', js: true do + scenario 'user changes current ref of build status badge', :js do page.within('.pipeline-status') do first('.js-project-refs-dropdown').click diff --git a/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb b/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb index 1160f674974..c12e56d2c3f 100644 --- a/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb +++ b/spec/features/projects/blobs/blob_line_permalink_updater_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Blob button line permalinks (BlobLinePermalinkUpdater)', js: true do +feature 'Blob button line permalinks (BlobLinePermalinkUpdater)', :js do include TreeHelper let(:project) { create(:project, :public, :repository) } diff --git a/spec/features/projects/blobs/edit_spec.rb b/spec/features/projects/blobs/edit_spec.rb index 62ac9fd0e95..6c625ed17aa 100644 --- a/spec/features/projects/blobs/edit_spec.rb +++ b/spec/features/projects/blobs/edit_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Editing file blob', js: true do +feature 'Editing file blob', :js do include TreeHelper let(:project) { create(:project, :public, :repository) } diff --git a/spec/features/projects/blobs/shortcuts_blob_spec.rb b/spec/features/projects/blobs/shortcuts_blob_spec.rb index 1e3080fa319..9f1fef80ab5 100644 --- a/spec/features/projects/blobs/shortcuts_blob_spec.rb +++ b/spec/features/projects/blobs/shortcuts_blob_spec.rb @@ -6,7 +6,7 @@ feature 'Blob shortcuts' do let(:path) { project.repository.ls_files(project.repository.root_ref)[0] } let(:sha) { project.repository.commit.sha } - describe 'On a file(blob)', js: true do + describe 'On a file(blob)', :js do def get_absolute_url(path = "") "http://#{page.server.host}:#{page.server.port}#{path}" end diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index d1f5623554d..941d34dd660 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -46,7 +46,7 @@ describe 'Branches' do end describe 'Find branches' do - it 'shows filtered branches', js: true do + it 'shows filtered branches', :js do visit project_branches_path(project) fill_in 'branch-search', with: 'fix' @@ -58,7 +58,7 @@ describe 'Branches' do end describe 'Delete unprotected branch' do - it 'removes branch after confirmation', js: true do + it 'removes branch after confirmation', :js do visit project_branches_path(project) fill_in 'branch-search', with: 'fix' diff --git a/spec/features/projects/commit/builds_spec.rb b/spec/features/projects/commit/builds_spec.rb index 740331fe42a..9c57626ea1d 100644 --- a/spec/features/projects/commit/builds_spec.rb +++ b/spec/features/projects/commit/builds_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'project commit pipelines', js: true do +feature 'project commit pipelines', :js do given(:project) { create(:project, :repository) } background do diff --git a/spec/features/projects/commit/cherry_pick_spec.rb b/spec/features/projects/commit/cherry_pick_spec.rb index 7086f56bb1b..c11a95732b2 100644 --- a/spec/features/projects/commit/cherry_pick_spec.rb +++ b/spec/features/projects/commit/cherry_pick_spec.rb @@ -64,7 +64,7 @@ describe 'Cherry-pick Commits' do end end - context "I cherry-pick a commit from a different branch", js: true do + context "I cherry-pick a commit from a different branch", :js do it do find('.header-action-buttons a.dropdown-toggle').click find(:css, "a[href='#modal-cherry-pick-commit']").click diff --git a/spec/features/projects/compare_spec.rb b/spec/features/projects/compare_spec.rb index 82d73fe8531..87ffc2a0b90 100644 --- a/spec/features/projects/compare_spec.rb +++ b/spec/features/projects/compare_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -describe "Compare", js: true do +describe "Compare", :js do let(:user) { create(:user) } let(:project) { create(:project, :repository) } diff --git a/spec/features/projects/developer_views_empty_project_instructions_spec.rb b/spec/features/projects/developer_views_empty_project_instructions_spec.rb index fe8567ce348..36809240f76 100644 --- a/spec/features/projects/developer_views_empty_project_instructions_spec.rb +++ b/spec/features/projects/developer_views_empty_project_instructions_spec.rb @@ -17,7 +17,7 @@ feature 'Developer views empty project instructions' do expect_instructions_for('http') end - scenario 'switches to SSH', js: true do + scenario 'switches to SSH', :js do visit_project select_protocol('SSH') @@ -37,7 +37,7 @@ feature 'Developer views empty project instructions' do expect_instructions_for('ssh') end - scenario 'switches to HTTP', js: true do + scenario 'switches to HTTP', :js do visit_project select_protocol('HTTP') diff --git a/spec/features/projects/edit_spec.rb b/spec/features/projects/edit_spec.rb index 17f914c9c17..7a372757523 100644 --- a/spec/features/projects/edit_spec.rb +++ b/spec/features/projects/edit_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Project edit', js: true do +feature 'Project edit', :js do let(:admin) { create(:admin) } let(:user) { create(:user) } let(:project) { create(:project) } diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index af7ad365546..610f566c0cf 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -145,7 +145,7 @@ feature 'Environments page', :js do expect(page).to have_content(action.name.humanize) end - it 'allows to play a manual action', js: true do + it 'allows to play a manual action', :js do expect(action).to be_manual find('.js-dropdown-play-icon-container').click diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index 57722276d79..e5282b42a4f 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -6,7 +6,7 @@ describe 'Edit Project Settings' do let!(:issue) { create(:issue, project: project) } let(:non_member) { create(:user) } - describe 'project features visibility selectors', js: true do + describe 'project features visibility selectors', :js do before do project.team << [member, :master] sign_in(member) @@ -163,7 +163,7 @@ describe 'Edit Project Settings' do end end - describe 'repository visibility', js: true do + describe 'repository visibility', :js do before do project.team << [member, :master] sign_in(member) diff --git a/spec/features/projects/files/browse_files_spec.rb b/spec/features/projects/files/browse_files_spec.rb index f62a9edd37e..84197e45dcb 100644 --- a/spec/features/projects/files/browse_files_spec.rb +++ b/spec/features/projects/files/browse_files_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'user browses project', js: true do +feature 'user browses project', :js do let(:project) { create(:project, :repository) } let(:user) { create(:user) } diff --git a/spec/features/projects/files/dockerfile_dropdown_spec.rb b/spec/features/projects/files/dockerfile_dropdown_spec.rb index cebb238dda1..3c3a5326538 100644 --- a/spec/features/projects/files/dockerfile_dropdown_spec.rb +++ b/spec/features/projects/files/dockerfile_dropdown_spec.rb @@ -16,7 +16,7 @@ feature 'User wants to add a Dockerfile file' do expect(page).to have_css('.dockerfile-selector') end - scenario 'user can pick a Dockerfile file from the dropdown', js: true do + scenario 'user can pick a Dockerfile file from the dropdown', :js do find('.js-dockerfile-selector').click wait_for_requests diff --git a/spec/features/projects/files/edit_file_soft_wrap_spec.rb b/spec/features/projects/files/edit_file_soft_wrap_spec.rb index c7e3f657639..25f7e18ac5c 100644 --- a/spec/features/projects/files/edit_file_soft_wrap_spec.rb +++ b/spec/features/projects/files/edit_file_soft_wrap_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'User uses soft wrap whilst editing file', js: true do +feature 'User uses soft wrap whilst editing file', :js do before do user = create(:user) project = create(:project, :repository) diff --git a/spec/features/projects/files/find_file_keyboard_spec.rb b/spec/features/projects/files/find_file_keyboard_spec.rb index 7f97fdb8cc9..618725ee781 100644 --- a/spec/features/projects/files/find_file_keyboard_spec.rb +++ b/spec/features/projects/files/find_file_keyboard_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Find file keyboard shortcuts', js: true do +feature 'Find file keyboard shortcuts', :js do let(:user) { create(:user) } let(:project) { create(:project, :repository) } diff --git a/spec/features/projects/files/gitignore_dropdown_spec.rb b/spec/features/projects/files/gitignore_dropdown_spec.rb index e2044c9d5aa..81d68c3d67c 100644 --- a/spec/features/projects/files/gitignore_dropdown_spec.rb +++ b/spec/features/projects/files/gitignore_dropdown_spec.rb @@ -13,7 +13,7 @@ feature 'User wants to add a .gitignore file' do expect(page).to have_css('.gitignore-selector') end - scenario 'user can pick a .gitignore file from the dropdown', js: true do + scenario 'user can pick a .gitignore file from the dropdown', :js do find('.js-gitignore-selector').click wait_for_requests within '.gitignore-selector' do diff --git a/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb b/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb index ab242b0b0b5..8e58fa7bd56 100644 --- a/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb +++ b/spec/features/projects/files/gitlab_ci_yml_dropdown_spec.rb @@ -13,7 +13,7 @@ feature 'User wants to add a .gitlab-ci.yml file' do expect(page).to have_css('.gitlab-ci-yml-selector') end - scenario 'user can pick a template from the dropdown', js: true do + scenario 'user can pick a template from the dropdown', :js do find('.js-gitlab-ci-yml-selector').click wait_for_requests within '.gitlab-ci-yml-selector' do diff --git a/spec/features/projects/files/project_owner_creates_license_file_spec.rb b/spec/features/projects/files/project_owner_creates_license_file_spec.rb index 95af263bcac..6c5b1086ec1 100644 --- a/spec/features/projects/files/project_owner_creates_license_file_spec.rb +++ b/spec/features/projects/files/project_owner_creates_license_file_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'project owner creates a license file', js: true do +feature 'project owner creates a license file', :js do let(:project_master) { create(:user) } let(:project) { create(:project, :repository) } background do diff --git a/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb b/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb index 7bcab01c739..6c616bf0456 100644 --- a/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb +++ b/spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'project owner sees a link to create a license file in empty project', js: true do +feature 'project owner sees a link to create a license file in empty project', :js do let(:project_master) { create(:user) } let(:project) { create(:project) } background do diff --git a/spec/features/projects/files/template_type_dropdown_spec.rb b/spec/features/projects/files/template_type_dropdown_spec.rb index 48003eeaa87..f95a60e5194 100644 --- a/spec/features/projects/files/template_type_dropdown_spec.rb +++ b/spec/features/projects/files/template_type_dropdown_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Template type dropdown selector', js: true do +feature 'Template type dropdown selector', :js do let(:project) { create(:project, :repository) } let(:user) { create(:user) } diff --git a/spec/features/projects/files/undo_template_spec.rb b/spec/features/projects/files/undo_template_spec.rb index 9bcd5beabb8..64fe350f3dc 100644 --- a/spec/features/projects/files/undo_template_spec.rb +++ b/spec/features/projects/files/undo_template_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Template Undo Button', js: true do +feature 'Template Undo Button', :js do let(:project) { create(:project, :repository) } let(:user) { create(:user) } diff --git a/spec/features/projects/gfm_autocomplete_load_spec.rb b/spec/features/projects/gfm_autocomplete_load_spec.rb index cff3b1f5743..1c988726ae6 100644 --- a/spec/features/projects/gfm_autocomplete_load_spec.rb +++ b/spec/features/projects/gfm_autocomplete_load_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'GFM autocomplete loading', js: true do +describe 'GFM autocomplete loading', :js do let(:project) { create(:project) } before do diff --git a/spec/features/projects/import_export/export_file_spec.rb b/spec/features/projects/import_export/export_file_spec.rb index 62d244ff259..05776c50f9d 100644 --- a/spec/features/projects/import_export/export_file_spec.rb +++ b/spec/features/projects/import_export/export_file_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' # It looks up for any sensitive word inside the JSON, so if a sensitive word is found # we''l have to either include it adding the model that includes it to the +safe_list+ # or make sure the attribute is blacklisted in the +import_export.yml+ configuration -feature 'Import/Export - project export integration test', js: true do +feature 'Import/Export - project export integration test', :js do include Select2Helper include ExportFileHelper diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb index e5c7781a096..c928459f911 100644 --- a/spec/features/projects/import_export/import_file_spec.rb +++ b/spec/features/projects/import_export/import_file_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Import/Export - project import integration test', js: true do +feature 'Import/Export - project import integration test', :js do include Select2Helper let(:user) { create(:user) } diff --git a/spec/features/projects/import_export/namespace_export_file_spec.rb b/spec/features/projects/import_export/namespace_export_file_spec.rb index 691b0e1e4ca..b6a7c3cdcdb 100644 --- a/spec/features/projects/import_export/namespace_export_file_spec.rb +++ b/spec/features/projects/import_export/namespace_export_file_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Import/Export - Namespace export file cleanup', js: true do +feature 'Import/Export - Namespace export file cleanup', :js do let(:export_path) { "#{Dir.tmpdir}/import_file_spec" } let(:config_hash) { YAML.load_file(Gitlab::ImportExport.config_file).deep_stringify_keys } diff --git a/spec/features/projects/issuable_templates_spec.rb b/spec/features/projects/issuable_templates_spec.rb index c9b8ef4e37b..62b23121c5a 100644 --- a/spec/features/projects/issuable_templates_spec.rb +++ b/spec/features/projects/issuable_templates_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'issuable templates', js: true do +feature 'issuable templates', :js do include ProjectForksHelper let(:user) { create(:user) } diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index a4ed589f3de..71702db860c 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -299,7 +299,7 @@ feature 'Jobs' do end shared_examples 'expected variables behavior' do - it 'shows variable key and value after click', js: true do + it 'shows variable key and value after click', :js do expect(page).to have_css('.reveal-variables') expect(page).not_to have_css('.js-build-variable') expect(page).not_to have_css('.js-build-value') diff --git a/spec/features/projects/labels/subscription_spec.rb b/spec/features/projects/labels/subscription_spec.rb index 5716d151250..e8c70dec854 100644 --- a/spec/features/projects/labels/subscription_spec.rb +++ b/spec/features/projects/labels/subscription_spec.rb @@ -13,7 +13,7 @@ feature 'Labels subscription' do sign_in user end - scenario 'users can subscribe/unsubscribe to labels', js: true do + scenario 'users can subscribe/unsubscribe to labels', :js do visit project_labels_path(project) expect(page).to have_content('bug') diff --git a/spec/features/projects/labels/update_prioritization_spec.rb b/spec/features/projects/labels/update_prioritization_spec.rb index 8f85e972027..d063f5c27b5 100644 --- a/spec/features/projects/labels/update_prioritization_spec.rb +++ b/spec/features/projects/labels/update_prioritization_spec.rb @@ -17,7 +17,7 @@ feature 'Prioritize labels' do sign_in user end - scenario 'user can prioritize a group label', js: true do + scenario 'user can prioritize a group label', :js do visit project_labels_path(project) expect(page).to have_content('Star labels to start sorting by priority') @@ -34,7 +34,7 @@ feature 'Prioritize labels' do end end - scenario 'user can unprioritize a group label', js: true do + scenario 'user can unprioritize a group label', :js do create(:label_priority, project: project, label: feature, priority: 1) visit project_labels_path(project) @@ -52,7 +52,7 @@ feature 'Prioritize labels' do end end - scenario 'user can prioritize a project label', js: true do + scenario 'user can prioritize a project label', :js do visit project_labels_path(project) expect(page).to have_content('Star labels to start sorting by priority') @@ -69,7 +69,7 @@ feature 'Prioritize labels' do end end - scenario 'user can unprioritize a project label', js: true do + scenario 'user can unprioritize a project label', :js do create(:label_priority, project: project, label: bug, priority: 1) visit project_labels_path(project) @@ -88,7 +88,7 @@ feature 'Prioritize labels' do end end - scenario 'user can sort prioritized labels and persist across reloads', js: true do + scenario 'user can sort prioritized labels and persist across reloads', :js do create(:label_priority, project: project, label: bug, priority: 1) create(:label_priority, project: project, label: feature, priority: 2) diff --git a/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb b/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb index c8988aa63a7..6d729f2f85f 100644 --- a/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb +++ b/spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Projects > Members > Group requester cannot request access to project', js: true do +feature 'Projects > Members > Group requester cannot request access to project', :js do let(:user) { create(:user) } let(:owner) { create(:user) } let(:group) { create(:group, :public, :access_requestable) } diff --git a/spec/features/projects/members/groups_with_access_list_spec.rb b/spec/features/projects/members/groups_with_access_list_spec.rb index 9950272af08..b1053982eee 100644 --- a/spec/features/projects/members/groups_with_access_list_spec.rb +++ b/spec/features/projects/members/groups_with_access_list_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Projects > Members > Groups with access list', js: true do +feature 'Projects > Members > Groups with access list', :js do let(:user) { create(:user) } let(:group) { create(:group, :public) } let(:project) { create(:project, :public) } diff --git a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb index cd621b6b3ce..5f7b4ee0e77 100644 --- a/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb +++ b/spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Projects > Members > Master adds member with expiration date', js: true do +feature 'Projects > Members > Master adds member with expiration date', :js do include Select2Helper include ActiveSupport::Testing::TimeHelpers diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 92486d2bc57..c35b0840248 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -453,7 +453,7 @@ describe 'Pipelines', :js do visit new_project_pipeline_path(project) end - context 'for valid commit', js: true do + context 'for valid commit', :js do before do click_button project.default_branch @@ -501,7 +501,7 @@ describe 'Pipelines', :js do end describe 'find pipelines' do - it 'shows filtered pipelines', js: true do + it 'shows filtered pipelines', :js do click_button project.default_branch page.within '.dropdown-menu' do diff --git a/spec/features/projects/project_settings_spec.rb b/spec/features/projects/project_settings_spec.rb index 06568817757..15a5cd9990b 100644 --- a/spec/features/projects/project_settings_spec.rb +++ b/spec/features/projects/project_settings_spec.rb @@ -10,7 +10,7 @@ describe 'Edit Project Settings' do sign_in(user) end - describe 'Project settings section', js: true do + describe 'Project settings section', :js do it 'shows errors for invalid project name' do visit edit_project_path(project) fill_in 'project_name_edit', with: 'foo&bar' @@ -125,7 +125,7 @@ describe 'Edit Project Settings' do end end - describe 'Transfer project section', js: true do + describe 'Transfer project section', :js do let!(:project) { create(:project, :repository, namespace: user.namespace, name: 'gitlabhq') } let!(:group) { create(:group) } diff --git a/spec/features/projects/ref_switcher_spec.rb b/spec/features/projects/ref_switcher_spec.rb index f0a23729220..f8695403857 100644 --- a/spec/features/projects/ref_switcher_spec.rb +++ b/spec/features/projects/ref_switcher_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Ref switcher', js: true do +feature 'Ref switcher', :js do let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } diff --git a/spec/features/projects/settings/integration_settings_spec.rb b/spec/features/projects/settings/integration_settings_spec.rb index d932c4e4d9a..cbdb7973ac8 100644 --- a/spec/features/projects/settings/integration_settings_spec.rb +++ b/spec/features/projects/settings/integration_settings_spec.rb @@ -76,7 +76,7 @@ feature 'Integration settings' do expect(page).to have_content(url) end - scenario 'test existing webhook', js: true do + scenario 'test existing webhook', :js do WebMock.stub_request(:post, hook.url) visit integrations_path diff --git a/spec/features/projects/settings/pipelines_settings_spec.rb b/spec/features/projects/settings/pipelines_settings_spec.rb index 975d204e75e..de8fbb15b9c 100644 --- a/spec/features/projects/settings/pipelines_settings_spec.rb +++ b/spec/features/projects/settings/pipelines_settings_spec.rb @@ -22,7 +22,7 @@ feature "Pipelines settings" do context 'for master' do given(:role) { :master } - scenario 'be allowed to change', js: true do + scenario 'be allowed to change', :js do fill_in('Test coverage parsing', with: 'coverage_regex') click_on 'Save changes' diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index 15180d4b498..a4fefb0d0e7 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -23,7 +23,7 @@ feature 'Repository settings' do context 'for master' do given(:role) { :master } - context 'Deploy Keys', js: true do + context 'Deploy Keys', :js do let(:private_deploy_key) { create(:deploy_key, title: 'private_deploy_key', public: false) } let(:public_deploy_key) { create(:another_deploy_key, title: 'public_deploy_key', public: true) } let(:new_ssh_key) { attributes_for(:key)[:key] } diff --git a/spec/features/projects/settings/visibility_settings_spec.rb b/spec/features/projects/settings/visibility_settings_spec.rb index 37ee6255bd1..1c3b84d0114 100644 --- a/spec/features/projects/settings/visibility_settings_spec.rb +++ b/spec/features/projects/settings/visibility_settings_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Visibility settings', js: true do +feature 'Visibility settings', :js do let(:user) { create(:user) } let(:project) { create(:project, namespace: user.namespace, visibility_level: 20) } diff --git a/spec/features/projects/show_project_spec.rb b/spec/features/projects/show_project_spec.rb index 1bc6fae9e7f..0b94c9eae5d 100644 --- a/spec/features/projects/show_project_spec.rb +++ b/spec/features/projects/show_project_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Project show page', feature: true do +describe 'Project show page', :feature do context 'when project pending delete' do let(:project) { create(:project, :empty_repo, pending_delete: true) } diff --git a/spec/features/projects/user_browses_files_spec.rb b/spec/features/projects/user_browses_files_spec.rb index b7a0b72db50..f43b11c9485 100644 --- a/spec/features/projects/user_browses_files_spec.rb +++ b/spec/features/projects/user_browses_files_spec.rb @@ -76,7 +76,7 @@ describe 'User browses files' do expect(page).to have_content('LICENSE') end - it 'shows files from a repository with apostroph in its name', js: true do + it 'shows files from a repository with apostroph in its name', :js do first('.js-project-refs-dropdown').click page.within('.project-refs-form') do @@ -91,7 +91,7 @@ describe 'User browses files' do expect(page).not_to have_content('Loading commit data...') end - it 'shows the code with a leading dot in the directory', js: true do + it 'shows the code with a leading dot in the directory', :js do first('.js-project-refs-dropdown').click page.within('.project-refs-form') do @@ -117,7 +117,7 @@ describe 'User browses files' do click_link('.gitignore') end - it 'shows a file content', js: true do + it 'shows a file content', :js do wait_for_requests expect(page).to have_content('*.rbc') end @@ -168,7 +168,7 @@ describe 'User browses files' do visit(tree_path_root_ref) end - it 'shows a preview of a file content', js: true do + it 'shows a preview of a file content', :js do find('.add-to-tree').click click_link('Upload file') drop_in_dropzone(File.join(Rails.root, 'spec', 'fixtures', 'logo_sample.svg')) diff --git a/spec/features/projects/user_creates_directory_spec.rb b/spec/features/projects/user_creates_directory_spec.rb index e8f2e4813c5..052cb3188c5 100644 --- a/spec/features/projects/user_creates_directory_spec.rb +++ b/spec/features/projects/user_creates_directory_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'User creates a directory', js: true do +feature 'User creates a directory', :js do let(:fork_message) do "You're not allowed to make changes to this project directly. "\ "A fork of this project has been created that you can make changes in, so you can submit a merge request." diff --git a/spec/features/projects/user_creates_files_spec.rb b/spec/features/projects/user_creates_files_spec.rb index 51d918bc85d..cbe70a93942 100644 --- a/spec/features/projects/user_creates_files_spec.rb +++ b/spec/features/projects/user_creates_files_spec.rb @@ -59,7 +59,7 @@ describe 'User creates files' do expect(page).to have_selector('.file-editor') end - it 'creates and commit a new file', js: true do + it 'creates and commit a new file', :js do execute_script("ace.edit('editor').setValue('*.rbca')") fill_in(:file_name, with: 'not_a_file.md') fill_in(:commit_message, with: 'New commit message', visible: true) @@ -74,7 +74,7 @@ describe 'User creates files' do expect(page).to have_content('*.rbca') end - it 'creates and commit a new file with new lines at the end of file', js: true do + it 'creates and commit a new file with new lines at the end of file', :js do execute_script('ace.edit("editor").setValue("Sample\n\n\n")') fill_in(:file_name, with: 'not_a_file.md') fill_in(:commit_message, with: 'New commit message', visible: true) @@ -89,7 +89,7 @@ describe 'User creates files' do expect(evaluate_script('ace.edit("editor").getValue()')).to eq("Sample\n\n\n") end - it 'creates and commit a new file with a directory name', js: true do + it 'creates and commit a new file with a directory name', :js do fill_in(:file_name, with: 'foo/bar/baz.txt') expect(page).to have_selector('.file-editor') @@ -105,7 +105,7 @@ describe 'User creates files' do expect(page).to have_content('*.rbca') end - it 'creates and commit a new file specifying a new branch', js: true do + it 'creates and commit a new file specifying a new branch', :js do expect(page).to have_selector('.file-editor') execute_script("ace.edit('editor').setValue('*.rbca')") @@ -130,7 +130,7 @@ describe 'User creates files' do visit(project2_tree_path_root_ref) end - it 'creates and commit new file in forked project', js: true do + it 'creates and commit new file in forked project', :js do find('.add-to-tree').click click_link('New file') diff --git a/spec/features/projects/user_creates_project_spec.rb b/spec/features/projects/user_creates_project_spec.rb index 1c3791f63ac..4a152572502 100644 --- a/spec/features/projects/user_creates_project_spec.rb +++ b/spec/features/projects/user_creates_project_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'User creates a project', js: true do +feature 'User creates a project', :js do let(:user) { create(:user) } before do diff --git a/spec/features/projects/user_deletes_files_spec.rb b/spec/features/projects/user_deletes_files_spec.rb index 7f48a69d9b7..9e4e92ec076 100644 --- a/spec/features/projects/user_deletes_files_spec.rb +++ b/spec/features/projects/user_deletes_files_spec.rb @@ -21,7 +21,7 @@ describe 'User deletes files' do visit(project_tree_path_root_ref) end - it 'deletes the file', js: true do + it 'deletes the file', :js do click_link('.gitignore') expect(page).to have_content('.gitignore') @@ -41,7 +41,7 @@ describe 'User deletes files' do visit(project2_tree_path_root_ref) end - it 'deletes the file in a forked project', js: true do + it 'deletes the file in a forked project', :js do click_link('.gitignore') expect(page).to have_content('.gitignore') diff --git a/spec/features/projects/user_edits_files_spec.rb b/spec/features/projects/user_edits_files_spec.rb index 2798041fa0c..e8d83a661d4 100644 --- a/spec/features/projects/user_edits_files_spec.rb +++ b/spec/features/projects/user_edits_files_spec.rb @@ -18,7 +18,7 @@ describe 'User edits files' do visit(project_tree_path_root_ref) end - it 'inserts a content of a file', js: true do + it 'inserts a content of a file', :js do click_link('.gitignore') find('.js-edit-blob').click find('.file-editor', match: :first) @@ -35,7 +35,7 @@ describe 'User edits files' do expect(page).not_to have_link('edit') end - it 'commits an edited file', js: true do + it 'commits an edited file', :js do click_link('.gitignore') find('.js-edit-blob').click find('.file-editor', match: :first) @@ -51,7 +51,7 @@ describe 'User edits files' do expect(page).to have_content('*.rbca') end - it 'commits an edited file to a new branch', js: true do + it 'commits an edited file to a new branch', :js do click_link('.gitignore') find('.js-edit-blob').click @@ -69,7 +69,7 @@ describe 'User edits files' do expect(page).to have_content('*.rbca') end - it 'shows the diff of an edited file', js: true do + it 'shows the diff of an edited file', :js do click_link('.gitignore') find('.js-edit-blob').click find('.file-editor', match: :first) @@ -87,7 +87,7 @@ describe 'User edits files' do visit(project2_tree_path_root_ref) end - it 'inserts a content of a file in a forked project', js: true do + it 'inserts a content of a file in a forked project', :js do click_link('.gitignore') find('.js-edit-blob').click @@ -108,7 +108,7 @@ describe 'User edits files' do expect(evaluate_script('ace.edit("editor").getValue()')).to eq('*.rbca') end - it 'commits an edited file in a forked project', js: true do + it 'commits an edited file in a forked project', :js do click_link('.gitignore') find('.js-edit-blob').click diff --git a/spec/features/projects/user_interacts_with_stars_spec.rb b/spec/features/projects/user_interacts_with_stars_spec.rb index 0ac3f8181fa..d9d2e0ab171 100644 --- a/spec/features/projects/user_interacts_with_stars_spec.rb +++ b/spec/features/projects/user_interacts_with_stars_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'User interacts with project stars' do let(:project) { create(:project, :public, :repository) } - context 'when user is signed in', js: true do + context 'when user is signed in', :js do let(:user) { create(:user) } before do diff --git a/spec/features/projects/user_replaces_files_spec.rb b/spec/features/projects/user_replaces_files_spec.rb index a9628198d5b..245b6aa285b 100644 --- a/spec/features/projects/user_replaces_files_spec.rb +++ b/spec/features/projects/user_replaces_files_spec.rb @@ -23,7 +23,7 @@ describe 'User replaces files' do visit(project_tree_path_root_ref) end - it 'replaces an existed file with a new one', js: true do + it 'replaces an existed file with a new one', :js do click_link('.gitignore') expect(page).to have_content('.gitignore') @@ -49,7 +49,7 @@ describe 'User replaces files' do visit(project2_tree_path_root_ref) end - it 'replaces an existed file with a new one in a forked project', js: true do + it 'replaces an existed file with a new one in a forked project', :js do click_link('.gitignore') expect(page).to have_content('.gitignore') diff --git a/spec/features/projects/user_uploads_files_spec.rb b/spec/features/projects/user_uploads_files_spec.rb index 8014c299980..ae51901adc6 100644 --- a/spec/features/projects/user_uploads_files_spec.rb +++ b/spec/features/projects/user_uploads_files_spec.rb @@ -23,7 +23,7 @@ describe 'User uploads files' do visit(project_tree_path_root_ref) end - it 'uploads and commit a new file', js: true do + it 'uploads and commit a new file', :js do find('.add-to-tree').click click_link('Upload file') drop_in_dropzone(File.join(Rails.root, 'spec', 'fixtures', 'doc_sample.txt')) @@ -54,7 +54,7 @@ describe 'User uploads files' do visit(project2_tree_path_root_ref) end - it 'uploads and commit a new file to a forked project', js: true do + it 'uploads and commit a new file to a forked project', :js do find('.add-to-tree').click click_link('Upload file') diff --git a/spec/features/projects/view_on_env_spec.rb b/spec/features/projects/view_on_env_spec.rb index 2a316a0d0db..7f547a4ca1f 100644 --- a/spec/features/projects/view_on_env_spec.rb +++ b/spec/features/projects/view_on_env_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'View on environment', js: true do +describe 'View on environment', :js do let(:branch_name) { 'feature' } let(:file_path) { 'files/ruby/feature.rb' } let(:project) { create(:project, :repository) } diff --git a/spec/features/projects/wiki/markdown_preview_spec.rb b/spec/features/projects/wiki/markdown_preview_spec.rb index 9a4ccf3c54d..78c350c8ee4 100644 --- a/spec/features/projects/wiki/markdown_preview_spec.rb +++ b/spec/features/projects/wiki/markdown_preview_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Projects > Wiki > User previews markdown changes', js: true do +feature 'Projects > Wiki > User previews markdown changes', :js do let(:user) { create(:user) } let(:project) { create(:project, namespace: user.namespace) } let(:wiki_content) do diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 4b2c54d54b5..ac62280e4ca 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -57,7 +57,7 @@ feature 'Project' do end end - describe 'remove forked relationship', js: true do + describe 'remove forked relationship', :js do let(:user) { create(:user) } let(:project) { fork_project(create(:project, :public), user, namespace_id: user.namespace) } @@ -126,7 +126,7 @@ feature 'Project' do end end - describe 'removal', js: true do + describe 'removal', :js do let(:user) { create(:user, username: 'test', name: 'test') } let(:project) { create(:project, namespace: user.namespace, name: 'project1') } diff --git a/spec/features/protected_tags_spec.rb b/spec/features/protected_tags_spec.rb index 8abd4403065..8cc6f17b8d9 100644 --- a/spec/features/protected_tags_spec.rb +++ b/spec/features/protected_tags_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Protected Tags', js: true do +feature 'Protected Tags', :js do let(:user) { create(:user, :admin) } let(:project) { create(:project, :repository) } diff --git a/spec/features/snippets/internal_snippet_spec.rb b/spec/features/snippets/internal_snippet_spec.rb index 3a229612235..3a2768c424f 100644 --- a/spec/features/snippets/internal_snippet_spec.rb +++ b/spec/features/snippets/internal_snippet_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -feature 'Internal Snippets', js: true do +feature 'Internal Snippets', :js do let(:internal_snippet) { create(:personal_snippet, :internal) } describe 'normal user' do diff --git a/spec/features/tags/master_creates_tag_spec.rb b/spec/features/tags/master_creates_tag_spec.rb index 39d79a3327b..1455345bd56 100644 --- a/spec/features/tags/master_creates_tag_spec.rb +++ b/spec/features/tags/master_creates_tag_spec.rb @@ -55,7 +55,7 @@ feature 'Master creates tag' do end end - scenario 'opens dropdown for ref', js: true do + scenario 'opens dropdown for ref', :js do click_link 'New tag' ref_row = find('.form-group:nth-of-type(2) .col-sm-10') page.within ref_row do diff --git a/spec/features/tags/master_deletes_tag_spec.rb b/spec/features/tags/master_deletes_tag_spec.rb index 80750c904b5..f5b3774122b 100644 --- a/spec/features/tags/master_deletes_tag_spec.rb +++ b/spec/features/tags/master_deletes_tag_spec.rb @@ -10,7 +10,7 @@ feature 'Master deletes tag' do visit project_tags_path(project) end - context 'from the tags list page', js: true do + context 'from the tags list page', :js do scenario 'deletes the tag' do expect(page).to have_content 'v1.1.0' @@ -34,7 +34,7 @@ feature 'Master deletes tag' do end end - context 'when pre-receive hook fails', js: true do + context 'when pre-receive hook fails', :js do context 'when Gitaly operation_user_delete_tag feature is enabled' do before do allow_any_instance_of(Gitlab::GitalyClient::OperationService).to receive(:rm_tag) @@ -48,7 +48,7 @@ feature 'Master deletes tag' do end end - context 'when Gitaly operation_user_delete_tag feature is disabled', skip_gitaly_mock: true do + context 'when Gitaly operation_user_delete_tag feature is disabled', :skip_gitaly_mock do before do allow_any_instance_of(Gitlab::Git::HooksService).to receive(:execute) .and_raise(Gitlab::Git::HooksService::PreReceiveError, 'Do not delete tags') diff --git a/spec/features/task_lists_spec.rb b/spec/features/task_lists_spec.rb index aeb0534b733..485b0b287ad 100644 --- a/spec/features/task_lists_spec.rb +++ b/spec/features/task_lists_spec.rb @@ -63,7 +63,7 @@ feature 'Task Lists' do end describe 'for Issues' do - describe 'multiple tasks', js: true do + describe 'multiple tasks', :js do let!(:issue) { create(:issue, description: markdown, author: user, project: project) } it 'renders' do @@ -103,7 +103,7 @@ feature 'Task Lists' do end end - describe 'single incomplete task', js: true do + describe 'single incomplete task', :js do let!(:issue) { create(:issue, description: singleIncompleteMarkdown, author: user, project: project) } it 'renders' do @@ -122,7 +122,7 @@ feature 'Task Lists' do end end - describe 'single complete task', js: true do + describe 'single complete task', :js do let!(:issue) { create(:issue, description: singleCompleteMarkdown, author: user, project: project) } it 'renders' do @@ -141,7 +141,7 @@ feature 'Task Lists' do end end - describe 'nested tasks', js: true do + describe 'nested tasks', :js do let(:issue) { create(:issue, description: nested_tasks_markdown, author: user, project: project) } before do diff --git a/spec/features/triggers_spec.rb b/spec/features/triggers_spec.rb index 47664de469a..548d8372a07 100644 --- a/spec/features/triggers_spec.rb +++ b/spec/features/triggers_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Triggers', js: true do +feature 'Triggers', :js do let(:trigger_title) { 'trigger desc' } let(:user) { create(:user) } let(:user2) { create(:user) } diff --git a/spec/features/uploads/user_uploads_file_to_note_spec.rb b/spec/features/uploads/user_uploads_file_to_note_spec.rb index e1c95590af1..1261ffdc2ee 100644 --- a/spec/features/uploads/user_uploads_file_to_note_spec.rb +++ b/spec/features/uploads/user_uploads_file_to_note_spec.rb @@ -14,20 +14,20 @@ feature 'User uploads file to note' do end context 'before uploading' do - it 'shows "Attach a file" button', js: true do + it 'shows "Attach a file" button', :js do expect(page).to have_button('Attach a file') expect(page).not_to have_selector('.uploading-progress-container', visible: true) end end context 'uploading is in progress' do - it 'shows "Cancel" button on uploading', js: true do + it 'shows "Cancel" button on uploading', :js do dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) expect(page).to have_button('Cancel') end - it 'cancels uploading on clicking to "Cancel" button', js: true do + it 'cancels uploading on clicking to "Cancel" button', :js do dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) click_button 'Cancel' @@ -37,20 +37,20 @@ feature 'User uploads file to note' do expect(page).not_to have_selector('.uploading-progress-container', visible: true) end - it 'shows "Attaching a file" message on uploading 1 file', js: true do + it 'shows "Attaching a file" message on uploading 1 file', :js do dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) expect(page).to have_selector('.attaching-file-message', visible: true, text: 'Attaching a file -') end - it 'shows "Attaching 2 files" message on uploading 2 file', js: true do + it 'shows "Attaching 2 files" message on uploading 2 file', :js do dropzone_file([Rails.root.join('spec', 'fixtures', 'video_sample.mp4'), Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) expect(page).to have_selector('.attaching-file-message', visible: true, text: 'Attaching 2 files -') end - it 'shows error message, "retry" and "attach a new file" link a if file is too big', js: true do + it 'shows error message, "retry" and "attach a new file" link a if file is too big', :js do dropzone_file([Rails.root.join('spec', 'fixtures', 'video_sample.mp4')], 0.01) error_text = 'File is too big (0.06MiB). Max filesize: 0.01MiB.' @@ -63,7 +63,7 @@ feature 'User uploads file to note' do end context 'uploading is complete' do - it 'shows "Attach a file" button on uploading complete', js: true do + it 'shows "Attach a file" button on uploading complete', :js do dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')]) wait_for_requests @@ -71,7 +71,7 @@ feature 'User uploads file to note' do expect(page).not_to have_selector('.uploading-progress-container', visible: true) end - scenario 'they see the attached file', js: true do + scenario 'they see the attached file', :js do dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')]) click_button 'Comment' wait_for_requests diff --git a/spec/features/users/snippets_spec.rb b/spec/features/users/snippets_spec.rb index 13760b4c2fc..8c697e33436 100644 --- a/spec/features/users/snippets_spec.rb +++ b/spec/features/users/snippets_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Snippets tab on a user profile', js: true do +describe 'Snippets tab on a user profile', :js do context 'when the user has snippets' do let(:user) { create(:user) } diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index 15b89dac572..0252c957c95 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Users', js: true do +feature 'Users', :js do let(:user) { create(:user, username: 'user1', name: 'User 1', email: 'user1@gitlab.com') } scenario 'GET /users/sign_in creates a new user account' do diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb index 6794bf4f4ba..5d8e818f7bf 100644 --- a/spec/features/variables_spec.rb +++ b/spec/features/variables_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Project variables', js: true do +describe 'Project variables', :js do let(:user) { create(:user) } let(:project) { create(:project) } let(:variable) { create(:ci_variable, key: 'test_key', value: 'test value') } -- cgit v1.2.1 From e0a68d458befab46f07eb7ab9a2f2a675f64e121 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Mon, 9 Oct 2017 15:17:24 -0500 Subject: Fixed click events --- spec/features/container_registry_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/container_registry_spec.rb b/spec/features/container_registry_spec.rb index d5e9de20e59..bef2aa9e0e5 100644 --- a/spec/features/container_registry_spec.rb +++ b/spec/features/container_registry_spec.rb @@ -47,7 +47,7 @@ describe "Container Registry", :js do scenario 'user removes a specific tag from container repository' do visit_container_registry - find('.js-toggle-repo').trigger('click') + find('.js-toggle-repo').click wait_for_requests expect_any_instance_of(ContainerRegistry::Tag) -- cgit v1.2.1 From 7e7baf7aab59f65dade40b6ad3c99231c1b1a4d9 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 9 Oct 2017 15:57:18 -0500 Subject: fix diff_notes_avatars_spec.rb failures in headless Chrome --- spec/features/merge_requests/diff_notes_avatars_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/diff_notes_avatars_spec.rb b/spec/features/merge_requests/diff_notes_avatars_spec.rb index 2fcf7383471..e28eb463199 100644 --- a/spec/features/merge_requests/diff_notes_avatars_spec.rb +++ b/spec/features/merge_requests/diff_notes_avatars_spec.rb @@ -108,7 +108,7 @@ feature 'Diff note avatars', :js do expect(page).to have_selector('.notes_holder', visible: false) page.within find_line(position.line_code(project.repository)) do - first('img.js-diff-comment-avatar').send_keys(:return) + first('img.js-diff-comment-avatar').click end expect(page).to have_selector('.notes_holder') -- cgit v1.2.1 From 98b1b3fb87eb3f0f8bd16667266b591e79933ac2 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 9 Oct 2017 17:07:56 -0500 Subject: ensure javascript confirm dialog is accepted when attempting to delete boards --- spec/features/boards/boards_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 1311347a530..9c6c5d3739c 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -136,7 +136,7 @@ describe 'Issue Boards', :js do it 'allows user to delete board' do page.within(find('.board:nth-child(2)')) do - find('.board-delete').click + accept_confirm { find('.board-delete').click } end wait_for_requests @@ -151,7 +151,7 @@ describe 'Issue Boards', :js do find('.dropdown-menu-close').click page.within(find('.board:nth-child(2)')) do - find('.board-delete').click + accept_confirm { find('.board-delete').click } end wait_for_requests -- cgit v1.2.1 From 301204c2a3e663d87809ba2595e7388b5d3463ff Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 9 Oct 2017 17:08:46 -0500 Subject: resize window when simulating dragging as horizontal scrolling causes issues in tests --- spec/features/boards/boards_spec.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'spec/features') diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 9c6c5d3739c..83ea9ee3b8b 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -560,6 +560,9 @@ describe 'Issue Boards', :js do end def drag(selector: '.board-list', list_from_index: 0, from_index: 0, to_index: 0, list_to_index: 0) + # ensure there is enough horizontal space for four boards + page.current_window.resize_to(2000, 800) + drag_to(selector: selector, scrollable: '#board-app', list_from_index: list_from_index, -- cgit v1.2.1 From 73bb0029a3e4df66d74948cc0fc3ff693d8385fe Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 9 Oct 2017 17:19:43 -0500 Subject: chrome cannot send_keys unless the element is focusable --- spec/features/boards/boards_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 83ea9ee3b8b..08581bf19ba 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -518,7 +518,7 @@ describe 'Issue Boards', :js do end it 'allows user to use keyboard shortcuts' do - find('.boards-list').native.send_keys('i') + find('body').native.send_keys('i') expect(page).to have_content('New Issue') end end -- cgit v1.2.1 From 56025c7e6bbc4f7a084d9b384874ff322b3732fe Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 9 Oct 2017 23:13:57 -0500 Subject: accept javascript confirm when testing pipeline deletion --- spec/features/projects/pipeline_schedules_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/pipeline_schedules_spec.rb b/spec/features/projects/pipeline_schedules_spec.rb index 24b335a7068..fa2f7a1fd78 100644 --- a/spec/features/projects/pipeline_schedules_spec.rb +++ b/spec/features/projects/pipeline_schedules_spec.rb @@ -54,7 +54,7 @@ feature 'Pipeline Schedules', :js do end it 'deletes the pipeline' do - click_link 'Delete' + accept_confirm { click_link 'Delete' } expect(page).not_to have_css(".pipeline-schedule-table-row") end -- cgit v1.2.1 From 31c8fb987d656fed83b617092e79a42d9dd02590 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 10 Oct 2017 00:27:21 -0500 Subject: fix race condition when visiting file blob of recently triggered file upload --- spec/features/projects/user_browses_files_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/user_browses_files_spec.rb b/spec/features/projects/user_browses_files_spec.rb index f43b11c9485..1d7c8a731f0 100644 --- a/spec/features/projects/user_browses_files_spec.rb +++ b/spec/features/projects/user_browses_files_spec.rb @@ -175,10 +175,11 @@ describe 'User browses files' do page.within('#modal-upload-blob') do fill_in(:commit_message, with: 'New commit message') + fill_in(:branch_name, with: 'new_branch_name', visible: true) + click_button('Upload file') end - fill_in(:branch_name, with: 'new_branch_name', visible: true) - click_button('Upload file') + block_and_wait_for_requests_complete visit(project_blob_path(project, 'new_branch_name/logo_sample.svg')) -- cgit v1.2.1 From b5029214639593af5b867e9c8f06dd52767b7362 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Tue, 10 Oct 2017 11:06:42 +0000 Subject: Remove Build code from global namespace --- spec/features/projects/jobs_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 71702db860c..576870ea0f3 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -300,13 +300,13 @@ feature 'Jobs' do shared_examples 'expected variables behavior' do it 'shows variable key and value after click', :js do - expect(page).to have_css('.reveal-variables') + expect(page).to have_css('.js-reveal-variables') expect(page).not_to have_css('.js-build-variable') expect(page).not_to have_css('.js-build-value') click_button 'Reveal Variables' - expect(page).not_to have_css('.reveal-variables') + expect(page).not_to have_css('.js-reveal-variables') expect(page).to have_selector('.js-build-variable', text: 'TRIGGER_KEY_1') expect(page).to have_selector('.js-build-value', text: 'TRIGGER_VALUE_1') end -- cgit v1.2.1 From 47d19c2de1df14bb3ab00d051be8e4f19f4ed7c4 Mon Sep 17 00:00:00 2001 From: Andrew Newdigate Date: Tue, 10 Oct 2017 14:56:04 +0000 Subject: Stop using `branch_names.include?` and use `branch_exists?` --- spec/features/projects/issuable_templates_spec.rb | 2 +- .../projects/merge_requests/user_views_open_merge_request_spec.rb | 2 +- spec/features/task_lists_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/issuable_templates_spec.rb b/spec/features/projects/issuable_templates_spec.rb index 62b23121c5a..9f67216705d 100644 --- a/spec/features/projects/issuable_templates_spec.rb +++ b/spec/features/projects/issuable_templates_spec.rb @@ -118,7 +118,7 @@ feature 'issuable templates', :js do context 'user creates a merge request from a forked project using templates' do let(:template_content) { 'this is a test "feature-proposal" template' } let(:fork_user) { create(:user) } - let(:forked_project) { fork_project(project, fork_user) } + let(:forked_project) { fork_project(project, fork_user, repository: true) } let(:merge_request) { create(:merge_request, :with_diffs, source_project: forked_project, target_project: project) } background do diff --git a/spec/features/projects/merge_requests/user_views_open_merge_request_spec.rb b/spec/features/projects/merge_requests/user_views_open_merge_request_spec.rb index 8970cf54457..3aac93eaf7c 100644 --- a/spec/features/projects/merge_requests/user_views_open_merge_request_spec.rb +++ b/spec/features/projects/merge_requests/user_views_open_merge_request_spec.rb @@ -6,7 +6,7 @@ describe 'User views an open merge request' do end context 'when a merge request does not have repository' do - let(:project) { create(:project, :public) } + let(:project) { create(:project, :public, :repository) } before do visit(merge_request_path(merge_request)) diff --git a/spec/features/task_lists_spec.rb b/spec/features/task_lists_spec.rb index 485b0b287ad..2dc3c5e3927 100644 --- a/spec/features/task_lists_spec.rb +++ b/spec/features/task_lists_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' feature 'Task Lists' do include Warden::Test::Helpers - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:user) { create(:user) } let(:user2) { create(:user) } -- cgit v1.2.1 From eff96b8c775c19b320f97b5d6359822f2b7929f1 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Tue, 10 Oct 2017 15:36:32 +0000 Subject: Fix unable to expand text diff discussion comments --- spec/features/merge_requests/diffs_spec.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/diffs_spec.rb b/spec/features/merge_requests/diffs_spec.rb index 80fb7335989..2adca58620f 100644 --- a/spec/features/merge_requests/diffs_spec.rb +++ b/spec/features/merge_requests/diffs_spec.rb @@ -44,12 +44,8 @@ feature 'Diffs URL', :js do visit "#{diffs_project_merge_request_path(project, merge_request)}#{fragment}" end - it 'shows collapsed note' do - wait_for_requests - - expect(page).to have_selector('.discussion-notes.collapsed') do |note_container| - expect(note_container).to have_selector(fragment, visible: false) - end + it 'shows expanded note' do + expect(page).to have_selector(fragment, visible: true) end end end -- cgit v1.2.1 From 501d2df40ff0da4f37dc9bbedde900ae820c2d11 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Tue, 10 Oct 2017 12:40:33 -0500 Subject: Add explicit test to test resolved discussion toggle content --- .../merge_requests/diff_notes_resolve_spec.rb | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/diff_notes_resolve_spec.rb b/spec/features/merge_requests/diff_notes_resolve_spec.rb index 637e6036384..475c8586f45 100644 --- a/spec/features/merge_requests/diff_notes_resolve_spec.rb +++ b/spec/features/merge_requests/diff_notes_resolve_spec.rb @@ -88,14 +88,24 @@ feature 'Diff notes resolve', :js do end end - it 'hides resolved discussion' do - page.within '.diff-content' do - click_button 'Resolve discussion' + describe 'resolved discussion' do + before do + page.within '.diff-content' do + click_button 'Resolve discussion' + end + + visit_merge_request end - visit_merge_request + it 'hides when resolve discussion is clicked' do + expect(page).to have_selector('.discussion-body', visible: false) + end - expect(page).to have_selector('.discussion-body', visible: false) + it 'shows resolved discussion when toggled' do + find(".timeline-content .discussion[data-discussion-id='#{note.discussion_id}'] .discussion-toggle-button").click + + expect(page.find(".timeline-content #note_#{note.noteable_id}")).to be_visible + end end it 'allows user to resolve from reply form without a comment' do -- cgit v1.2.1 From 9aed01f0e9422eeb010f991f75f53849be500e6e Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 10 Oct 2017 14:20:51 -0500 Subject: accept confirm dialog when cancelling a pipeline --- spec/features/projects/pipelines/pipelines_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index ddf4678de9d..be8ff727a43 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -232,7 +232,7 @@ describe 'Pipelines', :js do context 'when canceling' do before do - find('.js-pipelines-cancel-button').click + accept_alert { find('.js-pipelines-cancel-button').click } end it 'indicates that pipeline was canceled' do -- cgit v1.2.1 From 59bb5bc54f6b5d502cd9761c230134e1ead73364 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Tue, 10 Oct 2017 15:56:43 -0500 Subject: Fix rubocop lints --- spec/features/boards/add_issues_modal_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/boards/add_issues_modal_spec.rb b/spec/features/boards/add_issues_modal_spec.rb index 862d97a508f..e4cfcea45a5 100644 --- a/spec/features/boards/add_issues_modal_spec.rb +++ b/spec/features/boards/add_issues_modal_spec.rb @@ -102,7 +102,7 @@ describe 'Issue Boards add issue modal', :js do end accept_confirm { first('.board-delete').click } - + click_button('Add issues') wait_for_requests -- cgit v1.2.1 From bd69b794350f44ff750798c476a9cd27861fedfa Mon Sep 17 00:00:00 2001 From: "Vitaliy @blackst0ne Klachkov" Date: Wed, 11 Oct 2017 15:26:04 +1100 Subject: Replace the 'features/explore/projects.feature' spinach test with an rspec analog --- .../explore/user_explores_projects_spec.rb | 72 ++++++++++ spec/features/projects/issues/list_spec.rb | 20 --- .../projects/issues/user_views_issues_spec.rb | 56 ++++++++ .../user_views_open_merge_requests_spec.rb | 143 ++++++++++++------- spec/features/projects/user_views_details_spec.rb | 151 +++++++++++++++++++++ 5 files changed, 372 insertions(+), 70 deletions(-) create mode 100644 spec/features/explore/user_explores_projects_spec.rb delete mode 100644 spec/features/projects/issues/list_spec.rb create mode 100644 spec/features/projects/issues/user_views_issues_spec.rb create mode 100644 spec/features/projects/user_views_details_spec.rb (limited to 'spec/features') diff --git a/spec/features/explore/user_explores_projects_spec.rb b/spec/features/explore/user_explores_projects_spec.rb new file mode 100644 index 00000000000..6ac9497b024 --- /dev/null +++ b/spec/features/explore/user_explores_projects_spec.rb @@ -0,0 +1,72 @@ +require 'spec_helper' + +describe 'User explores projects' do + set(:archived_project) { create(:project, :archived) } + set(:internal_project) { create(:project, :internal) } + set(:private_project) { create(:project, :private) } + set(:public_project) { create(:project, :public) } + + shared_examples_for 'shows public projects' do + it 'shows projects' do + expect(page).to have_content(public_project.title) + expect(page).not_to have_content(internal_project.title) + expect(page).not_to have_content(private_project.title) + expect(page).not_to have_content(archived_project.title) + end + end + + shared_examples_for 'shows public and internal projects' do + it 'shows projects' do + expect(page).to have_content(public_project.title) + expect(page).to have_content(internal_project.title) + expect(page).not_to have_content(private_project.title) + expect(page).not_to have_content(archived_project.title) + end + end + + context 'when not signed in' do + context 'when viewing public projects' do + before do + visit(explore_projects_path) + end + + include_examples 'shows public projects' + end + end + + context 'when signed in' do + set(:user) { create(:user) } + + before do + sign_in(user) + end + + context 'when viewing public projects' do + before do + visit(explore_projects_path) + end + + include_examples 'shows public and internal projects' + end + + context 'when viewing most starred projects' do + before do + visit(starred_explore_projects_path) + end + + include_examples 'shows public and internal projects' + end + + context 'when viewing trending projects' do + before do + [archived_project, public_project].each { |project| create(:note_on_issue, project: project) } + + TrendingProject.refresh! + + visit(trending_explore_projects_path) + end + + include_examples 'shows public projects' + end + end +end diff --git a/spec/features/projects/issues/list_spec.rb b/spec/features/projects/issues/list_spec.rb deleted file mode 100644 index 9fc03f49f5b..00000000000 --- a/spec/features/projects/issues/list_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' - -feature 'Issues List' do - let(:user) { create(:user) } - let(:project) { create(:project) } - - background do - project.team << [user, :developer] - - sign_in(user) - end - - scenario 'user does not see create new list button' do - create(:issue, project: project) - - visit project_issues_path(project) - - expect(page).not_to have_selector('.js-new-board-list') - end -end diff --git a/spec/features/projects/issues/user_views_issues_spec.rb b/spec/features/projects/issues/user_views_issues_spec.rb new file mode 100644 index 00000000000..d35009b8974 --- /dev/null +++ b/spec/features/projects/issues/user_views_issues_spec.rb @@ -0,0 +1,56 @@ +require 'spec_helper' + +describe 'User views issues' do + set(:user) { create(:user) } + + shared_examples_for 'shows issues' do + it 'shows issues' do + expect(page).to have_content(project.name) + .and have_content(issue1.title) + .and have_content(issue2.title) + .and have_no_selector('.js-new-board-list') + end + end + + context 'when project is public' do + set(:project) { create(:project_empty_repo, :public) } + set(:issue1) { create(:issue, project: project) } + set(:issue2) { create(:issue, project: project) } + + context 'when signed in' do + before do + project.add_developer(user) + sign_in(user) + + visit(project_issues_path(project)) + end + + include_examples 'shows issues' + end + + context 'when not signed in' do + before do + visit(project_issues_path(project)) + end + + include_examples 'shows issues' + end + end + + context 'when project is internal' do + set(:project) { create(:project_empty_repo, :internal) } + set(:issue1) { create(:issue, project: project) } + set(:issue2) { create(:issue, project: project) } + + context 'when signed in' do + before do + project.add_developer(user) + sign_in(user) + + visit(project_issues_path(project)) + end + + include_examples 'shows issues' + end + end +end diff --git a/spec/features/projects/merge_requests/user_views_open_merge_requests_spec.rb b/spec/features/projects/merge_requests/user_views_open_merge_requests_spec.rb index 07b8c1ef479..bf95dbb7d09 100644 --- a/spec/features/projects/merge_requests/user_views_open_merge_requests_spec.rb +++ b/spec/features/projects/merge_requests/user_views_open_merge_requests_spec.rb @@ -1,72 +1,115 @@ require 'spec_helper' describe 'User views open merge requests' do - let(:project) { create(:project, :public, :repository) } + set(:user) { create(:user) } - context "when the target branch is the project's default branch" do - let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } - let!(:closed_merge_request) { create(:closed_merge_request, source_project: project, target_project: project) } - - before do - visit(project_merge_requests_path(project)) + shared_examples_for 'shows merge requests' do + it 'shows merge requests' do + expect(page).to have_content(project.name).and have_content(merge_request.source_project.name) end + end - it 'shows open merge requests' do - expect(page).to have_content(merge_request.title).and have_no_content(closed_merge_request.title) - end + context 'when project is public' do + set(:project) { create(:project, :public, :repository) } - it 'does not show target branch name' do - expect(page).to have_content(merge_request.title) - expect(find('.issuable-info')).not_to have_content(project.default_branch) - end - end + context 'when not signed in' do + context "when the target branch is the project's default branch" do + let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + let!(:closed_merge_request) { create(:closed_merge_request, source_project: project, target_project: project) } - context "when the target branch is different from the project's default branch" do - let!(:merge_request) do - create(:merge_request, - source_project: project, - target_project: project, - source_branch: 'fix', - target_branch: 'feature_conflict') - end + before do + visit(project_merge_requests_path(project)) + end - before do - visit(project_merge_requests_path(project)) - end + include_examples 'shows merge requests' - it 'shows target branch name' do - expect(page).to have_content(merge_request.target_branch) - end - end + it 'shows open merge requests' do + expect(page).to have_content(merge_request.title).and have_no_content(closed_merge_request.title) + end - context 'when a merge request has pipelines' do - let!(:build) { create :ci_build, pipeline: pipeline } + it 'does not show target branch name' do + expect(page).to have_content(merge_request.title) + expect(find('.issuable-info')).not_to have_content(project.default_branch) + end + end - let(:merge_request) do - create(:merge_request_with_diffs, - source_project: project, - target_project: project, - source_branch: 'merge-test') - end + context "when the target branch is different from the project's default branch" do + let!(:merge_request) do + create(:merge_request, + source_project: project, + target_project: project, + source_branch: 'fix', + target_branch: 'feature_conflict') + end + + before do + visit(project_merge_requests_path(project)) + end + + it 'shows target branch name' do + expect(page).to have_content(merge_request.target_branch) + end + end - let(:pipeline) do - create(:ci_pipeline, - project: project, - sha: merge_request.diff_head_sha, - ref: merge_request.source_branch, - head_pipeline_of: merge_request) + context 'when a merge request has pipelines' do + let!(:build) { create :ci_build, pipeline: pipeline } + + let(:merge_request) do + create(:merge_request_with_diffs, + source_project: project, + target_project: project, + source_branch: 'merge-test') + end + + let(:pipeline) do + create(:ci_pipeline, + project: project, + sha: merge_request.diff_head_sha, + ref: merge_request.source_branch, + head_pipeline_of: merge_request) + end + + before do + project.enable_ci + + visit(project_merge_requests_path(project)) + end + + it 'shows pipeline status' do + page.within('.mr-list') do + expect(page).to have_link('Pipeline: pending') + end + end + end end - before do - project.enable_ci + context 'when signed in' do + let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + + before do + project.add_developer(user) + sign_in(user) - visit(project_merge_requests_path(project)) + visit(project_merge_requests_path(project)) + end + + include_examples 'shows merge requests' end + end - it 'shows pipeline status' do - page.within('.mr-list') do - expect(page).to have_link('Pipeline: pending') + context 'when project is internal' do + let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + set(:project) { create(:project, :internal, :repository) } + + context 'when signed in' do + before do + project.add_developer(user) + sign_in(user) + + visit(project_merge_requests_path(project)) end + + include_examples 'shows merge requests' end end end diff --git a/spec/features/projects/user_views_details_spec.rb b/spec/features/projects/user_views_details_spec.rb new file mode 100644 index 00000000000..ffc063654cd --- /dev/null +++ b/spec/features/projects/user_views_details_spec.rb @@ -0,0 +1,151 @@ +require 'spec_helper' + +describe 'User views details' do + set(:user) { create(:user) } + + shared_examples_for 'redirects to the sign in page' do + it 'redirects to the sign in page' do + expect(current_path).to eq(new_user_session_path) + end + end + + shared_examples_for 'shows details of empty project' do + let(:user_has_ssh_key) { false } + + it 'shows details' do + expect(page).not_to have_content('Git global setup') + + page.all(:css, '.git-empty .clone').each do |element| + expect(element.text).to include(project.http_url_to_repo) + end + + expect(page).to have_field('project_clone', with: project.http_url_to_repo) unless user_has_ssh_key + end + end + + shared_examples_for 'shows details of non empty project' do + let(:user_has_ssh_key) { false } + + it 'shows details' do + page.within('.breadcrumbs .breadcrumb-item-text') do + expect(page).to have_content(project.title) + end + + expect(page).to have_field('project_clone', with: project.http_url_to_repo) unless user_has_ssh_key + end + end + + context 'when project is public' do + context 'when project is empty' do + set(:project) { create(:project_empty_repo, :public) } + + context 'when not signed in' do + before do + visit(project_path(project)) + end + + include_examples 'shows details of empty project' + end + + context 'when signed in' do + before do + sign_in(user) + end + + context 'when user does not have ssh keys' do + before do + visit(project_path(project)) + end + + include_examples 'shows details of empty project' + end + + context 'when user has ssh keys' do + before do + create(:personal_key, user: user) + + visit(project_path(project)) + end + + include_examples 'shows details of empty project' do + let(:user_has_ssh_key) { true } + end + end + end + end + + context 'when project is not empty' do + set(:project) { create(:project, :public, :repository) } + + before do + visit(project_path(project)) + end + + context 'when not signed in' do + before do + allow(Gitlab.config.gitlab).to receive(:host).and_return('www.example.com') + end + + include_examples 'shows details of non empty project' + end + + context 'when signed in' do + before do + sign_in(user) + end + + context 'when user does not have ssh keys' do + before do + visit(project_path(project)) + end + + include_examples 'shows details of non empty project' + end + + context 'when user has ssh keys' do + before do + create(:personal_key, user: user) + + visit(project_path(project)) + end + + include_examples 'shows details of non empty project' do + let(:user_has_ssh_key) { true } + end + end + end + end + end + + context 'when project is internal' do + set(:project) { create(:project, :internal, :repository) } + + context 'when not signed in' do + before do + visit(project_path(project)) + end + + include_examples 'redirects to the sign in page' + end + + context 'when signed in' do + before do + sign_in(user) + + visit(project_path(project)) + end + + include_examples 'shows details of non empty project' + end + end + + context 'when project is private' do + set(:project) { create(:project, :private) } + + before do + visit(project_path(project)) + end + + include_examples 'redirects to the sign in page' + end +end -- cgit v1.2.1 From 64bb19069dba585c6e4622073e5140f052c2661a Mon Sep 17 00:00:00 2001 From: "Vitaliy @blackst0ne Klachkov" Date: Wed, 11 Oct 2017 20:03:19 +1100 Subject: Add support for markdown preview to group milestones --- spec/features/groups/milestone_spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'spec/features') diff --git a/spec/features/groups/milestone_spec.rb b/spec/features/groups/milestone_spec.rb index 56144d17d4f..12aa54a3da1 100644 --- a/spec/features/groups/milestone_spec.rb +++ b/spec/features/groups/milestone_spec.rb @@ -18,6 +18,27 @@ feature 'Group milestones', :js do visit new_group_milestone_path(group) end + it 'renders description preview' do + form = find('.gfm-form') + + form.fill_in(:milestone_description, with: '') + + click_link('Preview') + + preview = find('.js-md-preview') + + expect(preview).to have_content('Nothing to preview.') + + click_link('Write') + + form.fill_in(:milestone_description, with: ':+1: Nice') + + click_link('Preview') + + expect(preview).to have_css('gl-emoji') + expect(find('#milestone_description', visible: false)).not_to be_visible + end + it 'creates milestone with start date' do fill_in 'Title', with: 'testing' find('#milestone_start_date').click -- cgit v1.2.1 From bd0248307dae9c62f62177ef7d5f87ec0a7acf22 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Wed, 11 Oct 2017 09:07:19 +0000 Subject: Simplify project page --- .../projects/import_export/import_file_spec.rb | 20 ++++-------- spec/features/projects/new_project_spec.rb | 37 ++++++++++++++-------- spec/features/projects_spec.rb | 5 +-- 3 files changed, 34 insertions(+), 28 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb index c928459f911..026aa03f7cf 100644 --- a/spec/features/projects/import_export/import_file_spec.rb +++ b/spec/features/projects/import_export/import_file_spec.rb @@ -27,6 +27,7 @@ feature 'Import/Export - project import integration test', :js do select2(namespace.id, from: '#project_namespace_id') fill_in :project_path, with: project_path, visible: true + click_import_project_tab click_link 'GitLab export' expect(page).to have_content('Import an exported GitLab project') @@ -51,6 +52,7 @@ feature 'Import/Export - project import integration test', :js do context 'path is not prefilled' do scenario 'user imports an exported project successfully' do visit new_project_path + click_import_project_tab click_link 'GitLab export' fill_in :path, with: 'test-project-path', visible: true @@ -72,6 +74,7 @@ feature 'Import/Export - project import integration test', :js do select2(user.namespace.id, from: '#project_namespace_id') fill_in :project_path, with: project.name, visible: true + click_import_project_tab click_link 'GitLab export' attach_file('file', file) click_on 'Import project' @@ -81,19 +84,6 @@ feature 'Import/Export - project import integration test', :js do end end - context 'when limited to the default user namespace' do - scenario 'passes correct namespace ID in the URL' do - visit new_project_path - - fill_in :project_path, with: 'test-project-path', visible: true - - click_link 'GitLab export' - - expect(page).to have_content('GitLab project export') - expect(URI.parse(current_url).query).to eq("namespace_id=#{user.namespace.id}&path=test-project-path") - end - end - def wiki_exists?(project) wiki = ProjectWiki.new(project) File.exist?(wiki.repository.path_to_repo) && !wiki.repository.empty? @@ -102,4 +92,8 @@ feature 'Import/Export - project import integration test', :js do def project_hook_exists?(project) Gitlab::Git::Hook.new('post-receive', project.repository.raw_repository).exists? end + + def click_import_project_tab + find('#import-project-tab').trigger('click') + end end diff --git a/spec/features/projects/new_project_spec.rb b/spec/features/projects/new_project_spec.rb index cd3dc72d3c6..8e11cb94350 100644 --- a/spec/features/projects/new_project_spec.rb +++ b/spec/features/projects/new_project_spec.rb @@ -9,12 +9,14 @@ feature 'New project' do sign_in(user) end - it 'shows "New project" page' do + it 'shows "New project" page', :js do visit new_project_path expect(page).to have_content('Project path') expect(page).to have_content('Project name') + find('#import-project-tab').trigger('click') + expect(page).to have_link('GitHub') expect(page).to have_link('Bitbucket') expect(page).to have_link('GitLab.com') @@ -23,14 +25,15 @@ feature 'New project' do expect(page).to have_link('GitLab export') end - context 'Visibility level selector' do + context 'Visibility level selector', :js do Gitlab::VisibilityLevel.options.each do |key, level| it "sets selector to #{key}" do stub_application_setting(default_project_visibility: level) visit new_project_path - - expect(find_field("project_visibility_level_#{level}")).to be_checked + page.within('#blank-project-pane') do + expect(find_field("project_visibility_level_#{level}")).to be_checked + end end it "saves visibility level #{level} on validation error" do @@ -38,8 +41,9 @@ feature 'New project' do choose(s_(key)) click_button('Create project') - - expect(find_field("project_visibility_level_#{level}")).to be_checked + page.within('#blank-project-pane') do + expect(find_field("project_visibility_level_#{level}")).to be_checked + end end end end @@ -51,9 +55,11 @@ feature 'New project' do end it 'selects the user namespace' do - namespace = find('#project_namespace_id') + page.within('#blank-project-pane') do + namespace = find('#project_namespace_id') - expect(namespace.text).to eq user.username + expect(namespace.text).to eq user.username + end end end @@ -66,9 +72,11 @@ feature 'New project' do end it 'selects the group namespace' do - namespace = find('#project_namespace_id option[selected]') + page.within('#blank-project-pane') do + namespace = find('#project_namespace_id option[selected]') - expect(namespace.text).to eq group.name + expect(namespace.text).to eq group.name + end end end @@ -82,9 +90,11 @@ feature 'New project' do end it 'selects the group namespace' do - namespace = find('#project_namespace_id option[selected]') + page.within('#blank-project-pane') do + namespace = find('#project_namespace_id option[selected]') - expect(namespace.text).to eq subgroup.full_path + expect(namespace.text).to eq subgroup.full_path + end end end @@ -124,9 +134,10 @@ feature 'New project' do end end - context 'Import project options' do + context 'Import project options', :js do before do visit new_project_path + find('#import-project-tab').trigger('click') end context 'from git repository url' do diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index ac62280e4ca..3bc7ec3123f 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -12,8 +12,9 @@ feature 'Project' do visit new_project_path end - it "allows creation from templates" do - page.choose(template.name) + it "allows creation from templates", :js do + find('#create-from-template-tab').trigger('click') + find("##{template.name}").trigger('click') fill_in("project_path", with: template.name) page.within '#content-body' do -- cgit v1.2.1 From be3facd9ff39e9287c257ba71501b6f09a37ea1d Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 11 Oct 2017 13:38:12 +0200 Subject: Fix a feature spec failing only on MySQL --- spec/features/dashboard/groups_list_spec.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'spec/features') diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index 533df7a325c..a6329b5c78d 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -1,14 +1,15 @@ require 'spec_helper' feature 'Dashboard Groups page', :js do - let!(:user) { create :user } - let!(:group) { create(:group) } - let!(:nested_group) { create(:group, :nested) } - let!(:another_group) { create(:group) } + let(:user) { create :user } + let(:group) { create(:group) } + let(:nested_group) { create(:group, :nested) } + let(:another_group) { create(:group) } it 'shows groups user is member of' do group.add_owner(user) nested_group.add_owner(user) + expect(another_group).to be_persisted sign_in(user) visit dashboard_groups_path @@ -22,6 +23,7 @@ feature 'Dashboard Groups page', :js do before do group.add_owner(user) nested_group.add_owner(user) + expect(another_group).to be_persisted sign_in(user) @@ -51,7 +53,7 @@ feature 'Dashboard Groups page', :js do end end - describe 'group with subgroups' do + describe 'group with subgroups', :nested_groups do let!(:subgroup) { create(:group, :public, parent: group) } before do @@ -90,7 +92,8 @@ feature 'Dashboard Groups page', :js do end describe 'when using pagination' do - let(:group2) { create(:group) } + let(:group) { create(:group, created_at: 5.days.ago) } + let(:group2) { create(:group, created_at: 2.days.ago) } before do group.add_owner(user) @@ -102,12 +105,9 @@ feature 'Dashboard Groups page', :js do visit dashboard_groups_path end - it 'shows pagination' do - expect(page).to have_selector('.gl-pagination') + it 'loads results for next page' do expect(page).to have_selector('.gl-pagination .page', count: 2) - end - it 'loads results for next page' do # Check first page expect(page).to have_content(group2.full_name) expect(page).to have_selector("#group-#{group2.id}") -- cgit v1.2.1 From 3ac444b8da3a570cf79c3f9532e6e2d60b4033bd Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Wed, 11 Oct 2017 16:54:05 -0500 Subject: Fix trigger elements and element is not clickable at this position --- .../projects/merge_requests/user_comments_on_diff_spec.rb | 12 +++++++----- spec/features/protected_branches_spec.rb | 8 ++++---- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb b/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb index f34302f25f8..94cd167c36a 100644 --- a/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb +++ b/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb @@ -31,7 +31,7 @@ describe 'User comments on a diff', :js do page.within('.files > div:nth-child(3)') do expect(page).to have_content('Line is wrong') - find('.js-toggle-diff-comments').trigger('click') + find('.js-toggle-diff-comments').click expect(page).not_to have_content('Line is wrong') end @@ -64,7 +64,7 @@ describe 'User comments on a diff', :js do # Hide the comment. page.within('.files > div:nth-child(3)') do - find('.js-toggle-diff-comments').trigger('click') + find('.js-toggle-diff-comments').click expect(page).not_to have_content('Line is wrong') end @@ -77,7 +77,7 @@ describe 'User comments on a diff', :js do # Show the comment. page.within('.files > div:nth-child(3)') do - find('.js-toggle-diff-comments').trigger('click') + find('.js-toggle-diff-comments').click end # Now both the comments should be shown. @@ -90,7 +90,9 @@ describe 'User comments on a diff', :js do end # Check the same comments in the side-by-side view. - click_link('Side-by-side') + page.execute_script( + "document.querySelector('#parallel-diff-btn').click()" + ) wait_for_requests @@ -157,7 +159,7 @@ describe 'User comments on a diff', :js do end page.within('.merge-request-tabs') do - find('.notes-tab').trigger('click') + find('.notes-tab').click end wait_for_requests diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index 2ab1eda90f1..a4084818284 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -48,7 +48,7 @@ feature 'Protected Branches', :js do expect(page).to have_content('fix') expect(find('.all-branches')).to have_selector('li', count: 1) - page.find('[data-target="#modal-delete-branch"]').trigger(:click) + page.find('[data-target="#modal-delete-branch"]').click expect(page).to have_css('.js-delete-branch[disabled]') fill_in 'delete_branch_input', with: 'fix' @@ -67,9 +67,9 @@ feature 'Protected Branches', :js do form = '.js-new-protected-branch' within form do - find(".js-allowed-to-merge").trigger('click') + find(".js-allowed-to-merge").click click_link 'No one' - find(".js-allowed-to-push").trigger('click') + find(".js-allowed-to-push").click click_link 'Developers + Masters' end @@ -171,7 +171,7 @@ feature 'Protected Branches', :js do end def set_protected_branch_name(branch_name) - find(".js-protected-branch-select").trigger('click') + find(".js-protected-branch-select").click find(".dropdown-input-field").set(branch_name) click_on("Create wildcard #{branch_name}") end -- cgit v1.2.1 From d2a9d95a2237aa3d6a93be5df012838180b704b7 Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Thu, 12 Oct 2017 09:44:53 +0200 Subject: Skip some nested group specs when using MySQL --- spec/features/dashboard/groups_list_spec.rb | 19 ++++++++++++++----- spec/features/groups/show_spec.rb | 3 ++- 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'spec/features') diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index c9d9371f5ab..3f68e63797d 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -22,15 +22,24 @@ feature 'Dashboard Groups page', :js do wait_for_requests expect(page).to have_content(group.name) - expect(page).to have_content(nested_group.parent.name) + expect(page).not_to have_content(another_group.name) + end + + it 'shows subgroups the user is member of', :nested_groups do + group.add_owner(user) + nested_group.add_owner(user) + + sign_in(user) + visit dashboard_groups_path + wait_for_requests + + expect(page).to have_content(nested_group.parent.name) click_group_caret(nested_group.parent) expect(page).to have_content(nested_group.name) - - expect(page).not_to have_content(another_group.name) end - describe 'when filtering groups' do + describe 'when filtering groups', :nested_groups do before do group.add_owner(user) nested_group.add_owner(user) @@ -64,7 +73,7 @@ feature 'Dashboard Groups page', :js do end end - describe 'group with subgroups' do + describe 'group with subgroups', :nested_groups do let!(:subgroup) { create(:group, :public, parent: group) } before do diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb index 501086fce80..7fc2b383749 100644 --- a/spec/features/groups/show_spec.rb +++ b/spec/features/groups/show_spec.rb @@ -32,7 +32,8 @@ feature 'Group show page' do group.add_owner(user) sign_in(user) end - context 'when subgroups are supported', :js do + + context 'when subgroups are supported', :js, :nested_groups do before do allow(Group).to receive(:supports_nested_groups?) { true } visit path -- cgit v1.2.1 From 0a933ec97f8e3ba7ca5d97bb74b93d282dc063d7 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 12 Oct 2017 17:22:14 -0500 Subject: fix element click methods --- spec/features/merge_requests/user_posts_diff_notes_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/user_posts_diff_notes_spec.rb b/spec/features/merge_requests/user_posts_diff_notes_spec.rb index e520b0b817f..4b155aff86f 100644 --- a/spec/features/merge_requests/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_diff_notes_spec.rb @@ -77,7 +77,7 @@ feature 'Merge requests > User posts diff notes', :js do context 'with an unfolded line' do before do - find('.js-unfold', match: :first).send_keys(:return) + find('.js-unfold', match: :first).click wait_for_requests end @@ -136,7 +136,7 @@ feature 'Merge requests > User posts diff notes', :js do context 'with an unfolded line' do before do - find('.js-unfold', match: :first).send_keys(:return) + find('.js-unfold', match: :first).click wait_for_requests end -- cgit v1.2.1 From fcfd60b58adfc6a7af152cda17bcf7423969a23c Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 12 Oct 2017 17:33:39 -0500 Subject: ensure delete option is visible before attempting to click on it --- spec/features/merge_requests/user_posts_diff_notes_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/user_posts_diff_notes_spec.rb b/spec/features/merge_requests/user_posts_diff_notes_spec.rb index 4b155aff86f..cf62f042b90 100644 --- a/spec/features/merge_requests/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_diff_notes_spec.rb @@ -104,7 +104,10 @@ feature 'Merge requests > User posts diff notes', :js do it 'allows commenting' do should_allow_commenting(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]')) - first('.js-note-delete', visible: false).click + accept_confirm do + first('button.more-actions-toggle').click + first('.js-note-delete').click + end should_allow_commenting(find('[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]')) end -- cgit v1.2.1 From d8cc4540ab83c98a09b11d1654fac593c47384c8 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 12 Oct 2017 17:44:53 -0500 Subject: fix assignment to hidden input --- spec/features/dashboard/issues_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index 96485f0ba04..36eb3d4923a 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -33,7 +33,7 @@ RSpec.describe 'Dashboard Issues' do end it 'shows issues when current user is author', :js do - find('#assignee_id', visible: false).set('') + execute_script("document.querySelector('#assignee_id').value=''") find('.js-author-search', match: :first).click expect(find('li[data-user-id="null"] a.is-active')).to be_visible -- cgit v1.2.1 From c9a7f51b0f5b1c15c71762a59e9297424ac2af31 Mon Sep 17 00:00:00 2001 From: Simon Knox Date: Tue, 19 Sep 2017 23:01:01 +1000 Subject: backport for gitlab-ee!2869 --- spec/features/boards/sidebar_spec.rb | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'spec/features') diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index c4817eb947b..4965f803883 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -1,6 +1,8 @@ require 'rails_helper' describe 'Issue Boards', :js do + include BoardHelpers + let(:user) { create(:user) } let(:user2) { create(:user) } let(:project) { create(:project, :public) } @@ -309,6 +311,21 @@ describe 'Issue Boards', :js do expect(card).to have_selector('.label', count: 1) expect(card).not_to have_content(stretch.title) end + + it 'creates new label' do + click_card(card) + + page.within('.labels') do + click_link 'Edit' + click_link 'Create new label' + fill_in 'new_label_name', with: 'test label' + first('.suggest-colors-dropdown a').click + click_button 'Create' + wait_for_requests + + expect(page).to have_link 'test label' + end + end end context 'subscription' do @@ -322,19 +339,4 @@ describe 'Issue Boards', :js do end end end - - def click_card(card) - page.within(card) do - first('.card-number').click - end - - wait_for_sidebar - end - - def wait_for_sidebar - # loop until the CSS transition is complete - Timeout.timeout(0.5) do - loop until evaluate_script('$(".right-sidebar").outerWidth()') == 290 - end - end end -- cgit v1.2.1 From c30f92464e1fcdb507d0d22b36be2d31e83064ec Mon Sep 17 00:00:00 2001 From: Jacopo Date: Thu, 12 Oct 2017 14:53:46 +0200 Subject: Replaces 'WikiPage::CreateService' calls with 'wiki_page' factory We replace the usage of WikiPage::CreateService with the wiki_page factory in the specs. --- spec/features/projects/wiki/markdown_preview_spec.rb | 1 - spec/features/projects/wiki/shortcuts_spec.rb | 4 +--- spec/features/projects/wiki/user_git_access_wiki_page_spec.rb | 9 +-------- .../projects/wiki/user_views_wiki_in_project_page_spec.rb | 7 +------ 4 files changed, 3 insertions(+), 18 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/wiki/markdown_preview_spec.rb b/spec/features/projects/wiki/markdown_preview_spec.rb index 78c350c8ee4..d63cbe578d8 100644 --- a/spec/features/projects/wiki/markdown_preview_spec.rb +++ b/spec/features/projects/wiki/markdown_preview_spec.rb @@ -14,7 +14,6 @@ feature 'Projects > Wiki > User previews markdown changes', :js do background do project.team << [user, :master] - WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute sign_in(user) diff --git a/spec/features/projects/wiki/shortcuts_spec.rb b/spec/features/projects/wiki/shortcuts_spec.rb index eaff5f876b6..f70d1e710dd 100644 --- a/spec/features/projects/wiki/shortcuts_spec.rb +++ b/spec/features/projects/wiki/shortcuts_spec.rb @@ -3,9 +3,7 @@ require 'spec_helper' feature 'Wiki shortcuts', :js do let(:user) { create(:user) } let(:project) { create(:project, namespace: user.namespace) } - let(:wiki_page) do - WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute - end + let(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: { title: 'home', content: 'Home page' }) } before do sign_in(user) diff --git a/spec/features/projects/wiki/user_git_access_wiki_page_spec.rb b/spec/features/projects/wiki/user_git_access_wiki_page_spec.rb index 9a92622ba2b..37a118c34ab 100644 --- a/spec/features/projects/wiki/user_git_access_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_git_access_wiki_page_spec.rb @@ -3,14 +3,7 @@ require 'spec_helper' describe 'Projects > Wiki > User views Git access wiki page' do let(:user) { create(:user) } let(:project) { create(:project, :public) } - let(:wiki_page) do - WikiPages::CreateService.new( - project, - user, - title: 'home', - content: '[some link](other-page)' - ).execute - end + let(:wiki_page) { create(:wiki_page, wiki: project.wiki, attrs: { title: 'home', content: '[some link](other-page)' }) } before do sign_in(user) diff --git a/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb index cf9fe4c1ad1..ebb3bd044c1 100644 --- a/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb @@ -18,12 +18,7 @@ describe 'Projects > Wiki > User views wiki in project page' do context 'when wiki homepage contains a link' do before do - WikiPages::CreateService.new( - project, - user, - title: 'home', - content: '[some link](other-page)' - ).execute + create(:wiki_page, wiki: project.wiki, attrs: { title: 'home', content: '[some link](other-page)' }) end it 'displays the correct URL for the link' do -- cgit v1.2.1 From c207122fd2b4439ff8303a1860c35de658d6bdfb Mon Sep 17 00:00:00 2001 From: Matt Coleman Date: Thu, 21 Sep 2017 16:05:44 -0400 Subject: Add Packagist project service --- .../services/user_activates_packagist_spec.rb | 24 ++++++++++++++++++++++ .../projects/services/user_views_services_spec.rb | 1 + 2 files changed, 25 insertions(+) create mode 100644 spec/features/projects/services/user_activates_packagist_spec.rb (limited to 'spec/features') diff --git a/spec/features/projects/services/user_activates_packagist_spec.rb b/spec/features/projects/services/user_activates_packagist_spec.rb new file mode 100644 index 00000000000..b0cc818f093 --- /dev/null +++ b/spec/features/projects/services/user_activates_packagist_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe 'User activates Packagist' do + let(:project) { create(:project) } + let(:user) { create(:user) } + + before do + project.add_master(user) + sign_in(user) + + visit(project_settings_integrations_path(project)) + + click_link('Packagist') + end + + it 'activates service' do + check('Active') + fill_in('Username', with: 'theUser') + fill_in('Token', with: 'verySecret') + click_button('Save') + + expect(page).to have_content('Packagist activated.') + end +end diff --git a/spec/features/projects/services/user_views_services_spec.rb b/spec/features/projects/services/user_views_services_spec.rb index f86591c2633..5c5e8b66642 100644 --- a/spec/features/projects/services/user_views_services_spec.rb +++ b/spec/features/projects/services/user_views_services_spec.rb @@ -21,5 +21,6 @@ describe 'User views services' do expect(page).to have_content('JetBrains TeamCity') expect(page).to have_content('Asana') expect(page).to have_content('Irker (IRC gateway)') + expect(page).to have_content('Packagist') end end -- cgit v1.2.1 From c489b237086fca89591802b956b9fe8b6b973425 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 13 Oct 2017 00:13:07 -0500 Subject: fix shared discussion_comments examples (for realz this time!) --- spec/features/discussion_comments/commit_spec.rb | 2 +- spec/features/discussion_comments/snippets_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/discussion_comments/commit_spec.rb b/spec/features/discussion_comments/commit_spec.rb index 0375d0bf8ff..69d35cdbc72 100644 --- a/spec/features/discussion_comments/commit_spec.rb +++ b/spec/features/discussion_comments/commit_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Discussion Comments Merge Request', :js do +describe 'Discussion Comments Commit', :js do include RepoHelpers let(:user) { create(:user) } diff --git a/spec/features/discussion_comments/snippets_spec.rb b/spec/features/discussion_comments/snippets_spec.rb index 1e6389d9a13..4a236c4639b 100644 --- a/spec/features/discussion_comments/snippets_spec.rb +++ b/spec/features/discussion_comments/snippets_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Discussion Comments Issue', :js do +describe 'Discussion Comments Snippet', :js do let(:user) { create(:user) } let(:project) { create(:project) } let(:snippet) { create(:project_snippet, :private, project: project, author: user) } -- cgit v1.2.1 From 341557d1b22aca1bec86c76446240c04f4ce756c Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 13 Oct 2017 16:32:23 -0500 Subject: route around issue with trailing quotes in issue filters (see gitlab-org/gitlab-ce#39121) --- spec/features/boards/boards_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 08581bf19ba..86820a0c4a6 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -378,7 +378,7 @@ describe 'Issue Boards', :js do end it 'filters by milestone' do - set_filter("milestone", "\"#{milestone.title}\"") + set_filter("milestone", "\"#{milestone.title}") click_filter_link(milestone.title) submit_filter @@ -399,7 +399,7 @@ describe 'Issue Boards', :js do end it 'filters by label with space after reload' do - set_filter("label", "\"#{accepting.title}\"") + set_filter("label", "\"#{accepting.title}") click_filter_link(accepting.title) submit_filter -- cgit v1.2.1 From 8ee9843e3526f52f93620dd5c1dfc1967361dca9 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Fri, 13 Oct 2017 17:39:13 -0500 Subject: Add accept_confirm for admin_users_impersonation_tokens_spec --- spec/features/admin/admin_users_impersonation_tokens_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb index 0d6c729746b..e16eae219a4 100644 --- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb +++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb @@ -60,7 +60,7 @@ describe 'Admin > Users > Impersonation Tokens', :js do it "allows revocation of an active impersonation token" do visit admin_user_impersonation_tokens_path(user_id: user.username) - click_on "Revoke" + accept_confirm { click_on "Revoke" } expect(page).to have_selector(".settings-message") expect(no_personal_access_tokens_message).to have_text("This user has no active Impersonation Tokens.") -- cgit v1.2.1 From 4f5fda8b3419b67e6108528b8eb94f8f98334324 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 13 Oct 2017 16:40:28 -0500 Subject: accept javascript confirm dialog on admin delete label link --- spec/features/admin/admin_labels_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/admin/admin_labels_spec.rb b/spec/features/admin/admin_labels_spec.rb index a5834056a1d..de406d7d966 100644 --- a/spec/features/admin/admin_labels_spec.rb +++ b/spec/features/admin/admin_labels_spec.rb @@ -33,7 +33,7 @@ RSpec.describe 'admin issues labels' do it 'deletes all labels', :js do page.within '.labels' do page.all('.btn-remove').each do |remove| - remove.click + accept_confirm { remove.click } wait_for_requests end end -- cgit v1.2.1 From 585a2ab577bc5714817f643ce4afd72ae8d832c3 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 13 Oct 2017 19:01:04 -0500 Subject: fix cmd+click emulation for selenium webdriver --- spec/features/projects/pipelines/pipelines_spec.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index be8ff727a43..46289ee8727 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -362,10 +362,15 @@ describe 'Pipelines', :js do context 'dropdown jobs list' do it 'should keep the dropdown open when the user ctr/cmd + clicks in the job name' do find('.js-builds-dropdown-button').click - - execute_script('var e = $.Event("keydown", { keyCode: 64 }); $("body").trigger(e);') - - find('.mini-pipeline-graph-dropdown-item').click + dropdown_item = find('.mini-pipeline-graph-dropdown-item').native + + %i(control command alt).each do |command| + page.driver.browser.action + .key_down(:command) + .click(dropdown_item) + .key_up(:command) + .perform + end expect(page).to have_selector('.js-ci-action-icon') end -- cgit v1.2.1 From 619021fd7a6ac68e2821f89f746fea3a72c25e3b Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Thu, 12 Oct 2017 14:13:59 +0200 Subject: Read circuitbreaker settings from `Gitlab::CurrentSettings` Instead of from the configuration file --- spec/features/admin/admin_health_check_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/admin/admin_health_check_spec.rb b/spec/features/admin/admin_health_check_spec.rb index 09e6965849a..4430fc15501 100644 --- a/spec/features/admin/admin_health_check_spec.rb +++ b/spec/features/admin/admin_health_check_spec.rb @@ -65,9 +65,11 @@ feature "Admin Health Check", :feature, :broken_storage do it 'shows storage failure information' do hostname = Gitlab::Environment.hostname + maximum_failures = Gitlab::CurrentSettings.current_application_settings + .circuitbreaker_failure_count_threshold expect(page).to have_content('broken: failed storage access attempt on host:') - expect(page).to have_content("#{hostname}: 1 of 10 failures.") + expect(page).to have_content("#{hostname}: 1 of #{maximum_failures} failures.") end it 'allows resetting storage failures' do -- cgit v1.2.1 From fc68a3aeaff713de13e2f709588c82fdb8b48cfe Mon Sep 17 00:00:00 2001 From: Winnie Hellmann Date: Tue, 17 Oct 2017 16:44:34 +0000 Subject: Change project deletion message from alert to notice --- spec/features/projects_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 3bc7ec3123f..3b01ed442bf 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -139,7 +139,7 @@ feature 'Project' do it 'removes a project' do expect { remove_with_confirm('Remove project', project.path) }.to change {Project.count}.by(-1) - expect(page).to have_content "Project 'test / project1' will be deleted." + expect(page).to have_content "Project 'test / project1' is in the process of being deleted." expect(Project.all.count).to be_zero expect(project.issues).to be_empty expect(project.merge_requests).to be_empty -- cgit v1.2.1 From 5e63566bf1fde65de8894f3fd588846853d139d9 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 17 Oct 2017 21:30:36 -0500 Subject: add InputHelper rspec helper to simulate non-BMP character input --- spec/features/issues/gfm_autocomplete_spec.rb | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index c00631d9c8f..640e29183be 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -1,6 +1,8 @@ require 'rails_helper' feature 'GFM autocomplete', :js do + include InputHelper + let(:user) { create(:user, name: '💃speciąl someone💃', username: 'someone.special') } let(:project) { create(:project) } let(:label) { create(:label, project: project, title: 'special+') } @@ -14,10 +16,14 @@ feature 'GFM autocomplete', :js do wait_for_requests end + after do + execute_script("localStorage.clear();"); + end + it 'updates issue descripton with GFM reference' do find('.issuable-edit').click - find('#issue-description').native.send_keys("@#{user.name[0...3]}") + simulateInput('#issue-description', "@#{user.name[0...3]}") find('.atwho-view .cur').click @@ -100,7 +106,7 @@ feature 'GFM autocomplete', :js do it 'includes items for assignee dropdowns with non-ASCII characters in name' do page.within '.timeline-content-form' do find('#note-body').native.send_keys('') - find('#note-body').native.send_keys("@#{user.name[0...8]}") + simulateInput('#note-body', "@#{user.name[0...8]}"); end expect(page).to have_selector('.atwho-container') @@ -128,7 +134,7 @@ feature 'GFM autocomplete', :js do note = find('#note-body') page.within '.timeline-content-form' do note.native.send_keys('') - note.native.send_keys("~#{label.title[0]}") + simulateInput('#note-body', "~#{label.title[0]}") note.click end @@ -195,7 +201,7 @@ feature 'GFM autocomplete', :js do note = find('#note-body') page.within '.timeline-content-form' do note.native.send_keys('') - note.native.send_keys(":cartwheel") + note.native.send_keys(":cartwheel_") note.click end @@ -228,7 +234,8 @@ feature 'GFM autocomplete', :js do note.click end - find('.atwho-view li', text: '/assign').native.send_keys(:tab) + find('.atwho-view li', text: '/assign') + note.native.send_keys(:tab) user_item = find('.atwho-view li', text: user.username) expect(user_item).to have_content(user.username) -- cgit v1.2.1 From a28a0c60d51e1d9eeb1b55f8f5c032f1d1fe4b51 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Wed, 18 Oct 2017 12:13:11 +0000 Subject: Fix resolved discussions not expanding on side by side view --- .../merge_requests/diff_notes_resolve_spec.rb | 29 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/diff_notes_resolve_spec.rb b/spec/features/merge_requests/diff_notes_resolve_spec.rb index 475c8586f45..3db0729cafb 100644 --- a/spec/features/merge_requests/diff_notes_resolve_spec.rb +++ b/spec/features/merge_requests/diff_notes_resolve_spec.rb @@ -97,14 +97,33 @@ feature 'Diff notes resolve', :js do visit_merge_request end - it 'hides when resolve discussion is clicked' do - expect(page).to have_selector('.discussion-body', visible: false) + describe 'timeline view' do + it 'hides when resolve discussion is clicked' do + expect(page).to have_selector('.discussion-body', visible: false) + end + + it 'shows resolved discussion when toggled' do + find(".timeline-content .discussion[data-discussion-id='#{note.discussion_id}'] .discussion-toggle-button").click + + expect(page.find(".timeline-content #note_#{note.noteable_id}")).to be_visible + end end - it 'shows resolved discussion when toggled' do - find(".timeline-content .discussion[data-discussion-id='#{note.discussion_id}'] .discussion-toggle-button").click + describe 'side-by-side view' do + before do + page.within('.merge-request-tabs') { click_link 'Changes' } + page.find('#parallel-diff-btn').click + end - expect(page.find(".timeline-content #note_#{note.noteable_id}")).to be_visible + it 'hides when resolve discussion is clicked' do + expect(page).to have_selector('.diffs .diff-file .notes_holder', visible: false) + end + + it 'shows resolved discussion when toggled' do + find('.diff-comment-avatar-holders').click + + expect(find('.diffs .diff-file .notes_holder')).to be_visible + end end end -- cgit v1.2.1 From dfa79ebf12aca3d2784c754c53520a2fd34f28a9 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 19 Oct 2017 10:00:54 +0100 Subject: Fix failing tests --- spec/features/merge_requests/created_from_fork_spec.rb | 1 - spec/features/projects/commit/builds_spec.rb | 1 - 2 files changed, 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/created_from_fork_spec.rb b/spec/features/merge_requests/created_from_fork_spec.rb index d03ddfece74..ca2225318cd 100644 --- a/spec/features/merge_requests/created_from_fork_spec.rb +++ b/spec/features/merge_requests/created_from_fork_spec.rb @@ -83,7 +83,6 @@ feature 'Merge request created from fork' do page.within('.merge-request-tabs') { click_link 'Pipelines' } page.within('.ci-table') do - expect(page).to have_content pipeline.status expect(page).to have_content pipeline.id end end diff --git a/spec/features/projects/commit/builds_spec.rb b/spec/features/projects/commit/builds_spec.rb index 9c57626ea1d..79e84a4f0a6 100644 --- a/spec/features/projects/commit/builds_spec.rb +++ b/spec/features/projects/commit/builds_spec.rb @@ -20,7 +20,6 @@ feature 'project commit pipelines', :js do visit pipelines_project_commit_path(project, project.commit.sha) page.within('.table-holder') do - expect(page).to have_content project.pipelines[0].status # pipeline status expect(page).to have_content project.pipelines[0].id # pipeline ids end end -- cgit v1.2.1 From b673fcc14fceb7553a3e2ddf375ad45b93106ea9 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 19 Oct 2017 16:59:49 +0200 Subject: clear localstorage between tests --- spec/features/issues/markdown_toolbar_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'spec/features') diff --git a/spec/features/issues/markdown_toolbar_spec.rb b/spec/features/issues/markdown_toolbar_spec.rb index 6869c2c869d..c50a676d959 100644 --- a/spec/features/issues/markdown_toolbar_spec.rb +++ b/spec/features/issues/markdown_toolbar_spec.rb @@ -11,6 +11,10 @@ feature 'Issue markdown toolbar', :js do visit project_issue_path(project, issue) end + after do + execute_script("localStorage.clear();"); + end + it "doesn't include first new line when adding bold" do find('#note-body').native.send_keys('test') find('#note-body').native.send_key(:enter) -- cgit v1.2.1 From 43377979c6cfee922702a5dc6324fded96b1f111 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Mon, 16 Oct 2017 12:37:52 -0500 Subject: Check for element before evaluate_script Tip from https://robots.thoughtbot.com/write-reliable-asynchronous-integration-tests-with-capybara#directly-interacting-with-javascript --- spec/features/boards/boards_spec.rb | 4 ++++ spec/features/ci_lint_spec.rb | 1 + spec/features/dashboard/issues_spec.rb | 4 +++- spec/features/issues/markdown_toolbar_spec.rb | 2 ++ spec/features/merge_requests/conflicts_spec.rb | 3 +++ spec/features/merge_requests/edit_mr_spec.rb | 1 + spec/features/merge_requests/mini_pipeline_graph_spec.rb | 2 ++ spec/features/projects/blobs/edit_spec.rb | 1 + spec/features/projects/user_creates_files_spec.rb | 6 ++++++ spec/features/projects/user_edits_files_spec.rb | 7 +++++++ 10 files changed, 30 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 91c4e5037de..60ed17c0c81 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -171,12 +171,14 @@ describe 'Issue Boards', :js do expect(page).to have_selector('.card', count: 20) expect(page).to have_content('Showing 20 of 58 issues') + find('.board .board-list') evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight") wait_for_requests expect(page).to have_selector('.card', count: 40) expect(page).to have_content('Showing 40 of 58 issues') + find('.board .board-list') evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight") wait_for_requests @@ -449,11 +451,13 @@ describe 'Issue Boards', :js do expect(page).to have_selector('.card', count: 20) expect(page).to have_content('Showing 20 of 51 issues') + find('.board .board-list') evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight") expect(page).to have_selector('.card', count: 40) expect(page).to have_content('Showing 40 of 51 issues') + find('.board .board-list') evaluate_script("document.querySelectorAll('.board .board-list')[1].scrollTop = document.querySelectorAll('.board .board-list')[1].scrollHeight") expect(page).to have_selector('.card', count: 51) diff --git a/spec/features/ci_lint_spec.rb b/spec/features/ci_lint_spec.rb index 9accd7bb07c..9bc23baf6cf 100644 --- a/spec/features/ci_lint_spec.rb +++ b/spec/features/ci_lint_spec.rb @@ -10,6 +10,7 @@ describe 'CI Lint', :js do visit ci_lint_path # Ace editor updates a hidden textarea and it happens asynchronously # `sleep 0.1` is actually needed here because of this + find('#ci-editor') execute_script("ace.edit('ci-editor').setValue(" + yaml_content.to_json + ");") sleep 0.1 click_on 'Validate' diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index 5610894fd9a..a8919976c31 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -87,8 +87,10 @@ RSpec.describe 'Dashboard Issues' do project_path = "/#{project.path_with_namespace}" project_json = { name: project.name_with_namespace, url: project_path }.to_json - # similate selection, and prevent overlap by dropdown menu + # simulate selection, and prevent overlap by dropdown menu + first('.project-item-select', visible: false) execute_script("$('.project-item-select').val('#{project_json}').trigger('change');") + find('#select2-drop-mask', visible: false) execute_script("$('#select2-drop-mask').remove();") find('.new-project-item-link').trigger('click') diff --git a/spec/features/issues/markdown_toolbar_spec.rb b/spec/features/issues/markdown_toolbar_spec.rb index 6869c2c869d..fee8fd9b365 100644 --- a/spec/features/issues/markdown_toolbar_spec.rb +++ b/spec/features/issues/markdown_toolbar_spec.rb @@ -16,6 +16,7 @@ feature 'Issue markdown toolbar', :js do find('#note-body').native.send_key(:enter) find('#note-body').native.send_keys('bold') + find('.js-main-target-form #note-body') page.evaluate_script('document.querySelectorAll(".js-main-target-form #note-body")[0].setSelectionRange(4, 9)') first('.toolbar-btn').click @@ -28,6 +29,7 @@ feature 'Issue markdown toolbar', :js do find('#note-body').native.send_key(:enter) find('#note-body').native.send_keys('underline') + find('.js-main-target-form #note-body') page.evaluate_script('document.querySelectorAll(".js-main-target-form #note-body")[0].setSelectionRange(4, 50)') find('.toolbar-btn:nth-child(2)').click diff --git a/spec/features/merge_requests/conflicts_spec.rb b/spec/features/merge_requests/conflicts_spec.rb index b0432ed8fc6..ba976bc7216 100644 --- a/spec/features/merge_requests/conflicts_spec.rb +++ b/spec/features/merge_requests/conflicts_spec.rb @@ -60,12 +60,14 @@ feature 'Merge request conflict resolution', :js do within find('.files-wrapper .diff-file', text: 'files/ruby/popen.rb') do click_button 'Edit inline' wait_for_requests + find('.files-wrapper .diff-file pre') execute_script('ace.edit($(".files-wrapper .diff-file pre")[0]).setValue("One morning");') end within find('.files-wrapper .diff-file', text: 'files/ruby/regex.rb') do click_button 'Edit inline' wait_for_requests + find('.files-wrapper .diff-file pre') execute_script('ace.edit($(".files-wrapper .diff-file pre")[1]).setValue("Gregor Samsa woke from troubled dreams");') end @@ -139,6 +141,7 @@ feature 'Merge request conflict resolution', :js do it 'conflicts are resolved in Edit inline mode' do within find('.files-wrapper .diff-file', text: 'files/markdown/ruby-style-guide.md') do wait_for_requests + find('.files-wrapper .diff-file pre') execute_script('ace.edit($(".files-wrapper .diff-file pre")[0]).setValue("Gregor Samsa woke from troubled dreams");') end diff --git a/spec/features/merge_requests/edit_mr_spec.rb b/spec/features/merge_requests/edit_mr_spec.rb index 4538555c168..4362f8b3fcc 100644 --- a/spec/features/merge_requests/edit_mr_spec.rb +++ b/spec/features/merge_requests/edit_mr_spec.rb @@ -66,6 +66,7 @@ feature 'Edit Merge Request' do end def get_textarea_height + find('#merge_request_description') page.evaluate_script('document.getElementById("merge_request_description").offsetHeight') end end diff --git a/spec/features/merge_requests/mini_pipeline_graph_spec.rb b/spec/features/merge_requests/mini_pipeline_graph_spec.rb index dcc70338d7f..bf21a719901 100644 --- a/spec/features/merge_requests/mini_pipeline_graph_spec.rb +++ b/spec/features/merge_requests/mini_pipeline_graph_spec.rb @@ -52,10 +52,12 @@ feature 'Mini Pipeline Graph', :js do end it 'should expand when hovered' do + find('.mini-pipeline-graph-dropdown-toggle') before_width = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').outerWidth();") toggle.hover + find('.mini-pipeline-graph-dropdown-toggle') after_width = evaluate_script("$('.mini-pipeline-graph-dropdown-toggle:visible').outerWidth();") expect(before_width).to be < after_width diff --git a/spec/features/projects/blobs/edit_spec.rb b/spec/features/projects/blobs/edit_spec.rb index 6c625ed17aa..965028a6f90 100644 --- a/spec/features/projects/blobs/edit_spec.rb +++ b/spec/features/projects/blobs/edit_spec.rb @@ -20,6 +20,7 @@ feature 'Editing file blob', :js do def edit_and_commit wait_for_requests find('.js-edit-blob').click + find('#editor') execute_script('ace.edit("editor").setValue("class NextFeature\nend\n")') click_button 'Commit changes' end diff --git a/spec/features/projects/user_creates_files_spec.rb b/spec/features/projects/user_creates_files_spec.rb index cbe70a93942..d84b91ddc32 100644 --- a/spec/features/projects/user_creates_files_spec.rb +++ b/spec/features/projects/user_creates_files_spec.rb @@ -60,6 +60,7 @@ describe 'User creates files' do end it 'creates and commit a new file', :js do + find('#editor') execute_script("ace.edit('editor').setValue('*.rbca')") fill_in(:file_name, with: 'not_a_file.md') fill_in(:commit_message, with: 'New commit message', visible: true) @@ -75,6 +76,7 @@ describe 'User creates files' do end it 'creates and commit a new file with new lines at the end of file', :js do + find('#editor') execute_script('ace.edit("editor").setValue("Sample\n\n\n")') fill_in(:file_name, with: 'not_a_file.md') fill_in(:commit_message, with: 'New commit message', visible: true) @@ -86,6 +88,7 @@ describe 'User creates files' do find('.js-edit-blob').click + find('#editor') expect(evaluate_script('ace.edit("editor").getValue()')).to eq("Sample\n\n\n") end @@ -94,6 +97,7 @@ describe 'User creates files' do expect(page).to have_selector('.file-editor') + find('#editor') execute_script("ace.edit('editor').setValue('*.rbca')") fill_in(:commit_message, with: 'New commit message', visible: true) click_button('Commit changes') @@ -108,6 +112,7 @@ describe 'User creates files' do it 'creates and commit a new file specifying a new branch', :js do expect(page).to have_selector('.file-editor') + find('#editor') execute_script("ace.edit('editor').setValue('*.rbca')") fill_in(:file_name, with: 'not_a_file.md') fill_in(:commit_message, with: 'New commit message', visible: true) @@ -136,6 +141,7 @@ describe 'User creates files' do expect(page).to have_selector('.file-editor') + find('#editor') execute_script("ace.edit('editor').setValue('*.rbca')") fill_in(:file_name, with: 'not_a_file.md') diff --git a/spec/features/projects/user_edits_files_spec.rb b/spec/features/projects/user_edits_files_spec.rb index e8d83a661d4..d26ee653415 100644 --- a/spec/features/projects/user_edits_files_spec.rb +++ b/spec/features/projects/user_edits_files_spec.rb @@ -23,6 +23,7 @@ describe 'User edits files' do find('.js-edit-blob').click find('.file-editor', match: :first) + find('#editor') execute_script("ace.edit('editor').setValue('*.rbca')") expect(evaluate_script('ace.edit("editor").getValue()')).to eq('*.rbca') @@ -40,6 +41,7 @@ describe 'User edits files' do find('.js-edit-blob').click find('.file-editor', match: :first) + find('#editor') execute_script("ace.edit('editor').setValue('*.rbca')") fill_in(:commit_message, with: 'New commit message', visible: true) click_button('Commit changes') @@ -57,6 +59,7 @@ describe 'User edits files' do find('.file-editor', match: :first) + find('#editor') execute_script("ace.edit('editor').setValue('*.rbca')") fill_in(:commit_message, with: 'New commit message', visible: true) fill_in(:branch_name, with: 'new_branch_name', visible: true) @@ -74,6 +77,7 @@ describe 'User edits files' do find('.js-edit-blob').click find('.file-editor', match: :first) + find('#editor') execute_script("ace.edit('editor').setValue('*.rbca')") click_link('Preview changes') @@ -103,6 +107,7 @@ describe 'User edits files' do find('.file-editor', match: :first) + find('#editor') execute_script("ace.edit('editor').setValue('*.rbca')") expect(evaluate_script('ace.edit("editor").getValue()')).to eq('*.rbca') @@ -119,6 +124,7 @@ describe 'User edits files' do find('.file-editor', match: :first) + find('#editor') execute_script("ace.edit('editor').setValue('*.rbca')") fill_in(:commit_message, with: 'New commit message', visible: true) click_button('Commit changes') @@ -145,6 +151,7 @@ describe 'User edits files' do expect(page).not_to have_link('Fork') expect(page).not_to have_button('Cancel') + find('#editor') execute_script("ace.edit('editor').setValue('*.rbca')") fill_in(:commit_message, with: 'Another commit', visible: true) click_button('Commit changes') -- cgit v1.2.1 From 95d629a1ea20f84e9286fbe5ae73ed3302a67c1c Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 20 Oct 2017 08:28:38 +0300 Subject: fix rubocop (oops) --- spec/features/issues/gfm_autocomplete_spec.rb | 8 ++++---- spec/features/issues/markdown_toolbar_spec.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 640e29183be..31291aed349 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -17,13 +17,13 @@ feature 'GFM autocomplete', :js do end after do - execute_script("localStorage.clear();"); + execute_script("localStorage.clear();") end it 'updates issue descripton with GFM reference' do find('.issuable-edit').click - simulateInput('#issue-description', "@#{user.name[0...3]}") + simulate_input('#issue-description', "@#{user.name[0...3]}") find('.atwho-view .cur').click @@ -106,7 +106,7 @@ feature 'GFM autocomplete', :js do it 'includes items for assignee dropdowns with non-ASCII characters in name' do page.within '.timeline-content-form' do find('#note-body').native.send_keys('') - simulateInput('#note-body', "@#{user.name[0...8]}"); + simulate_input('#note-body', "@#{user.name[0...8]}") end expect(page).to have_selector('.atwho-container') @@ -134,7 +134,7 @@ feature 'GFM autocomplete', :js do note = find('#note-body') page.within '.timeline-content-form' do note.native.send_keys('') - simulateInput('#note-body', "~#{label.title[0]}") + simulate_input('#note-body', "~#{label.title[0]}") note.click end diff --git a/spec/features/issues/markdown_toolbar_spec.rb b/spec/features/issues/markdown_toolbar_spec.rb index c50a676d959..ee68dfc7a04 100644 --- a/spec/features/issues/markdown_toolbar_spec.rb +++ b/spec/features/issues/markdown_toolbar_spec.rb @@ -12,7 +12,7 @@ feature 'Issue markdown toolbar', :js do end after do - execute_script("localStorage.clear();"); + execute_script("localStorage.clear();") end it "doesn't include first new line when adding bold" do -- cgit v1.2.1 From ce7449ce032039467c7b6b1271b4b00a642a1c81 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 20 Oct 2017 09:05:18 +0300 Subject: clear localStorage after each capybara test (global) --- spec/features/issues/gfm_autocomplete_spec.rb | 4 ---- spec/features/issues/markdown_toolbar_spec.rb | 4 ---- 2 files changed, 8 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 31291aed349..ac75b1fcdba 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -16,10 +16,6 @@ feature 'GFM autocomplete', :js do wait_for_requests end - after do - execute_script("localStorage.clear();") - end - it 'updates issue descripton with GFM reference' do find('.issuable-edit').click diff --git a/spec/features/issues/markdown_toolbar_spec.rb b/spec/features/issues/markdown_toolbar_spec.rb index ee68dfc7a04..6869c2c869d 100644 --- a/spec/features/issues/markdown_toolbar_spec.rb +++ b/spec/features/issues/markdown_toolbar_spec.rb @@ -11,10 +11,6 @@ feature 'Issue markdown toolbar', :js do visit project_issue_path(project, issue) end - after do - execute_script("localStorage.clear();") - end - it "doesn't include first new line when adding bold" do find('#note-body').native.send_keys('test') find('#note-body').native.send_key(:enter) -- cgit v1.2.1 From 2f40dac35280f9de9af8c47bdf85c2f0b2d53680 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Thu, 19 Oct 2017 20:28:19 +0200 Subject: Refactor `have_http_status` into `have_gitlab_http_status` in the specs --- spec/features/profiles/chat_names_spec.rb | 4 ++-- spec/features/profiles/password_spec.rb | 4 ++-- spec/features/projects/badges/coverage_spec.rb | 2 +- spec/features/projects/environments/environment_spec.rb | 2 +- spec/features/projects/jobs_spec.rb | 2 +- spec/features/projects/pipelines/pipelines_spec.rb | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'spec/features') diff --git a/spec/features/profiles/chat_names_spec.rb b/spec/features/profiles/chat_names_spec.rb index 35793539e0e..5c959acbbc9 100644 --- a/spec/features/profiles/chat_names_spec.rb +++ b/spec/features/profiles/chat_names_spec.rb @@ -33,7 +33,7 @@ feature 'Profile > Chat' do scenario 'second use of link is denied' do visit authorize_path - expect(page).to have_http_status(:not_found) + expect(page).to have_gitlab_http_status(:not_found) end end @@ -51,7 +51,7 @@ feature 'Profile > Chat' do scenario 'second use of link is denied' do visit authorize_path - expect(page).to have_http_status(:not_found) + expect(page).to have_gitlab_http_status(:not_found) end end end diff --git a/spec/features/profiles/password_spec.rb b/spec/features/profiles/password_spec.rb index 225d4c16841..fb4355074df 100644 --- a/spec/features/profiles/password_spec.rb +++ b/spec/features/profiles/password_spec.rb @@ -58,7 +58,7 @@ describe 'Profile > Password' do visit edit_profile_password_path - expect(page).to have_http_status(200) + expect(page).to have_gitlab_http_status(200) end end @@ -68,7 +68,7 @@ describe 'Profile > Password' do it 'renders 404' do visit edit_profile_password_path - expect(page).to have_http_status(404) + expect(page).to have_gitlab_http_status(404) end end end diff --git a/spec/features/projects/badges/coverage_spec.rb b/spec/features/projects/badges/coverage_spec.rb index 368a046f741..c68e10a2563 100644 --- a/spec/features/projects/badges/coverage_spec.rb +++ b/spec/features/projects/badges/coverage_spec.rb @@ -50,7 +50,7 @@ feature 'test coverage badge' do scenario 'user requests test coverage badge image' do show_test_coverage_badge - expect(page).to have_http_status(404) + expect(page).to have_gitlab_http_status(404) end end diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index 56addd64056..0fe1eb4c293 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -198,7 +198,7 @@ feature 'Environment' do end it 'renders a correct environment folder' do - expect(page).to have_http_status(:ok) + expect(page).to have_gitlab_http_status(:ok) expect(page).to have_content('Environments / staging-1.0') end end diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 576870ea0f3..b095c3e6f7b 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -396,7 +396,7 @@ feature 'Jobs' do end it 'shows the right status and buttons', :js do - expect(page).to have_http_status(200) + expect(page).to have_gitlab_http_status(200) page.within('aside.right-sidebar') do expect(page).to have_content 'Cancel' end diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index c35b0840248..ae888fd4343 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -525,7 +525,7 @@ describe 'Pipelines', :js do let(:project) { create(:project, :public, :repository) } it { expect(page).to have_content 'Build with confidence' } - it { expect(page).to have_http_status(:success) } + it { expect(page).to have_gitlab_http_status(:success) } end context 'when project is private' do -- cgit v1.2.1 From c8d29d17aef6ac4fd0620dc0d69df5ef454fd102 Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" Date: Fri, 20 Oct 2017 17:11:31 +0100 Subject: Added group milestones form spec --- spec/features/groups/milestone_spec.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'spec/features') diff --git a/spec/features/groups/milestone_spec.rb b/spec/features/groups/milestone_spec.rb index 12aa54a3da1..1b41b3842c8 100644 --- a/spec/features/groups/milestone_spec.rb +++ b/spec/features/groups/milestone_spec.rb @@ -19,9 +19,9 @@ feature 'Group milestones', :js do end it 'renders description preview' do - form = find('.gfm-form') + description = find('.note-textarea') - form.fill_in(:milestone_description, with: '') + description.native.send_keys('') click_link('Preview') @@ -31,7 +31,7 @@ feature 'Group milestones', :js do click_link('Write') - form.fill_in(:milestone_description, with: ':+1: Nice') + description.native.send_keys(':+1: Nice') click_link('Preview') @@ -51,6 +51,13 @@ feature 'Group milestones', :js do expect(find('.start_date')).to have_content(Date.today.at_beginning_of_month.strftime('%b %-d, %Y')) end + + it 'description input does not support autocomplete' do + description = find('.note-textarea') + description.native.send_keys('!') + + expect(page).not_to have_selector('.atwho-view') + end end context 'milestones list' do -- cgit v1.2.1 From 59c03de56d697370e723037a4fb84ca67434cea1 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Fri, 20 Oct 2017 19:26:51 +0000 Subject: Use title as placeholder instead of issue title for reusability --- spec/features/issues/issue_detail_spec.rb | 2 +- spec/features/projects/issuable_templates_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/issue_detail_spec.rb b/spec/features/issues/issue_detail_spec.rb index c0c396af93f..6fbee0ebcb5 100644 --- a/spec/features/issues/issue_detail_spec.rb +++ b/spec/features/issues/issue_detail_spec.rb @@ -25,7 +25,7 @@ feature 'Issue Detail', :js do wait_for_requests click_link 'Edit' - fill_in 'issue-title', with: 'issue title' + fill_in 'issuable-title', with: 'issue title' click_button 'Save' Users::DestroyService.new(user).execute(user) diff --git a/spec/features/projects/issuable_templates_spec.rb b/spec/features/projects/issuable_templates_spec.rb index 9f67216705d..a012db8fd27 100644 --- a/spec/features/projects/issuable_templates_spec.rb +++ b/spec/features/projects/issuable_templates_spec.rb @@ -35,7 +35,7 @@ feature 'issuable templates', :js do page.within('.content .issuable-actions') do click_on 'Edit' end - fill_in :'issue-title', with: 'test issue title' + fill_in :'issuable-title', with: 'test issue title' end scenario 'user selects "bug" template' do @@ -80,7 +80,7 @@ feature 'issuable templates', :js do page.within('.content .issuable-actions') do click_on 'Edit' end - fill_in :'issue-title', with: 'test issue title' + fill_in :'issuable-title', with: 'test issue title' fill_in :'issue-description', with: prior_description end -- cgit v1.2.1 From 1e78c627d4c6630df3bbfd4e905018314d692b6d Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 23 Oct 2017 10:17:31 +0300 Subject: explicitly specify search for hidden element [ci-skip] --- spec/features/groups_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index 862823d862e..563e8a65b6e 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -65,7 +65,7 @@ feature 'Group' do end it 'updates the team URL on graph path update', :js do - out_span = find('span[data-bind-out="create_chat_team"]') + out_span = find('span[data-bind-out="create_chat_team"]', visible: false) expect(out_span.text).to be_empty -- cgit v1.2.1 From 4699cf77b6a0f5261ae382ac1a55882424efe4fb Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 20 Oct 2017 10:47:45 +0100 Subject: added feature spec --- .../projects/tree/create_directory_spec.rb | 43 ++++++++++++++++++++++ spec/features/projects/tree/create_file_spec.rb | 40 ++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 spec/features/projects/tree/create_directory_spec.rb create mode 100644 spec/features/projects/tree/create_file_spec.rb (limited to 'spec/features') diff --git a/spec/features/projects/tree/create_directory_spec.rb b/spec/features/projects/tree/create_directory_spec.rb new file mode 100644 index 00000000000..4c1fa5a666e --- /dev/null +++ b/spec/features/projects/tree/create_directory_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' + +feature 'Multi-file editor new directory', :js do + include WaitForRequests + + let(:user) { create(:user) } + let(:project) { create(:project, :repository) } + + before do + project.add_master(user) + sign_in(user) + + page.driver.set_cookie('new_repo', 'true') + + visit project_tree_path(project, :master) + + wait_for_requests + end + + it 'creates directory in current directory' do + find('.add-to-tree').click + + click_link('New directory') + + page.within('.popup-dialog') do + find('.form-control').set('foldername') + + click_button('Create directory') + end + + fill_in('commit-message', with: 'commit message') + + click_button('Commit 1 file') + + expect(page).to have_content('Your changes have been committed') + expect(page).to have_selector('td', text: 'commit message') + + click_link('foldername') + + expect(page).to have_selector('td', text: 'commit message', count: 2) + expect(page).to have_selector('td', text: '.gitkeep') + end +end diff --git a/spec/features/projects/tree/create_file_spec.rb b/spec/features/projects/tree/create_file_spec.rb new file mode 100644 index 00000000000..a67ec891e7c --- /dev/null +++ b/spec/features/projects/tree/create_file_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +feature 'Multi-file editor new file', :js do + include WaitForRequests + + let(:user) { create(:user) } + let(:project) { create(:project, :repository) } + + before do + project.add_master(user) + sign_in(user) + + page.driver.set_cookie('new_repo', 'true') + + visit project_tree_path(project, :master) + + wait_for_requests + end + + it 'creates file in current directory' do + find('.add-to-tree').click + + click_link('New file') + + page.within('.popup-dialog') do + find('.form-control').set('filename') + + click_button('Create file') + end + + find('.inputarea').send_keys('file content') + + fill_in('commit-message', with: 'commit message') + + click_button('Commit 1 file') + + expect(page).to have_content('Your changes have been committed') + expect(page).to have_selector('td', text: 'commit message') + end +end -- cgit v1.2.1 From df20c6fe46c14905f90fa92bbc88529106382988 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Mon, 23 Oct 2017 13:54:10 +0300 Subject: add accept_confirm to spec --- spec/features/projects/members/user_requests_access_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/members/user_requests_access_spec.rb b/spec/features/projects/members/user_requests_access_spec.rb index 0fbe1ddb2a5..4eb36156812 100644 --- a/spec/features/projects/members/user_requests_access_spec.rb +++ b/spec/features/projects/members/user_requests_access_spec.rb @@ -60,7 +60,7 @@ feature 'Projects > Members > User requests access', :js do expect(project.requesters.exists?(user_id: user)).to be_truthy - click_link 'Withdraw Access Request' + accept_confirm { click_link 'Withdraw Access Request' } expect(project.requesters.exists?(user_id: user)).to be_falsey expect(page).to have_content 'Your access request to the project has been withdrawn.' -- cgit v1.2.1 From 04149dccab97aad4350cae9a6c6054b7de5c9850 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Mon, 23 Oct 2017 13:55:15 +0300 Subject: Changed trigger click calls to click() --- spec/features/projects/import_export/import_file_spec.rb | 2 +- spec/features/projects/new_project_spec.rb | 4 ++-- spec/features/projects_spec.rb | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb index 026aa03f7cf..af125e1b9d3 100644 --- a/spec/features/projects/import_export/import_file_spec.rb +++ b/spec/features/projects/import_export/import_file_spec.rb @@ -94,6 +94,6 @@ feature 'Import/Export - project import integration test', :js do end def click_import_project_tab - find('#import-project-tab').trigger('click') + find('#import-project-tab').click end end diff --git a/spec/features/projects/new_project_spec.rb b/spec/features/projects/new_project_spec.rb index 8e11cb94350..6f097ad16c7 100644 --- a/spec/features/projects/new_project_spec.rb +++ b/spec/features/projects/new_project_spec.rb @@ -15,7 +15,7 @@ feature 'New project' do expect(page).to have_content('Project path') expect(page).to have_content('Project name') - find('#import-project-tab').trigger('click') + find('#import-project-tab').click expect(page).to have_link('GitHub') expect(page).to have_link('Bitbucket') @@ -137,7 +137,7 @@ feature 'New project' do context 'Import project options', :js do before do visit new_project_path - find('#import-project-tab').trigger('click') + find('#import-project-tab').click end context 'from git repository url' do diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index 3b01ed442bf..d7e46f3525f 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -13,8 +13,10 @@ feature 'Project' do end it "allows creation from templates", :js do - find('#create-from-template-tab').trigger('click') - find("##{template.name}").trigger('click') + find('#create-from-template-tab').click + page.execute_script( + "document.querySelector('##{template.name}').click()" + ) fill_in("project_path", with: template.name) page.within '#content-body' do -- cgit v1.2.1 From 07a8c54355d3b5d51319edcef397fd998d9d5999 Mon Sep 17 00:00:00 2001 From: Jacob Schatz Date: Mon, 23 Oct 2017 10:57:23 +0000 Subject: Create new branch from dropdown. --- spec/features/projects/ref_switcher_spec.rb | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'spec/features') diff --git a/spec/features/projects/ref_switcher_spec.rb b/spec/features/projects/ref_switcher_spec.rb index f8695403857..50c0bfd580d 100644 --- a/spec/features/projects/ref_switcher_spec.rb +++ b/spec/features/projects/ref_switcher_spec.rb @@ -6,6 +6,7 @@ feature 'Ref switcher', :js do before do project.team << [user, :master] + page.driver.set_cookie('new_repo', 'true') sign_in(user) visit project_tree_path(project, 'master') end @@ -40,4 +41,38 @@ feature 'Ref switcher', :js do expect(page).to have_title "'test'" end + + context "create branch" do + let(:input) { find('.js-new-branch-name') } + + before do + click_button 'master' + wait_for_requests + + page.within '.project-refs-form' do + find(".dropdown-footer-list a").click + end + end + + it "shows error message for the invalid branch name" do + input.set 'foo bar' + click_button('Create') + wait_for_requests + expect(page).to have_content 'Branch name is invalid' + end + + it "should create new branch properly" do + input.set 'new-branch-name' + click_button('Create') + wait_for_requests + expect(find('.js-project-refs-dropdown')).to have_content 'new-branch-name' + end + + it "should create new branch by Enter key" do + input.set 'new-branch-name-2' + input.native.send_keys :enter + wait_for_requests + expect(find('.js-project-refs-dropdown')).to have_content 'new-branch-name-2' + end + end end -- cgit v1.2.1 From a92693df7742214a44caa521f9be7ab52f99d6b6 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 23 Oct 2017 15:57:06 +0300 Subject: add InspectRequests helper --- spec/features/projects/environments/environment_spec.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index c9f12e877b3..e0fc60e45ae 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' feature 'Environment' do + include InspectRequests + given(:project) { create(:project) } given(:user) { create(:user) } given(:role) { :developer } @@ -193,11 +195,14 @@ feature 'Environment' do create(:environment, project: project, name: 'staging-1.0/review', state: :available) - - visit folder_project_environments_path(project, id: 'staging-1.0') end it 'renders a correct environment folder' do + reqs = inspect_requests do + visit folder_project_environments_path(project, id: 'staging-1.0') + end + + expect(reqs.first.status_code).to eq(200) expect(page).to have_content('Environments / staging-1.0') end end -- cgit v1.2.1 From 1ad8a42eff6df2b3caa7e2e704f9e61935d905e1 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 23 Oct 2017 17:37:58 +0300 Subject: remove unnecessary :js option in download_spec --- spec/features/projects/artifacts/download_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/artifacts/download_spec.rb b/spec/features/projects/artifacts/download_spec.rb index f1bdb2812c6..6f76c14910b 100644 --- a/spec/features/projects/artifacts/download_spec.rb +++ b/spec/features/projects/artifacts/download_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'Download artifact', :js do +feature 'Download artifact' do let(:project) { create(:project, :public) } let(:pipeline) { create(:ci_empty_pipeline, status: :success, project: project) } let(:job) { create(:ci_build, :artifacts, :success, pipeline: pipeline) } -- cgit v1.2.1 From b2273415bfa251e4d7604a7dc5677996bda80725 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Oct 2017 14:00:46 +0300 Subject: fix race condition when loading labels in filter bar --- spec/features/issues/filtered_search/dropdown_label_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/issues/filtered_search/dropdown_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb index cbc4f8d4c50..40a59f834ba 100644 --- a/spec/features/issues/filtered_search/dropdown_label_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_label_spec.rb @@ -68,7 +68,7 @@ describe 'Dropdown label', :js do it 'shows loading indicator when opened and hides it when loaded' do filtered_search.set('label:') - expect(find(js_dropdown_label)).to have_css('.filter-dropdown-loading') + expect(page).to have_css("#{js_dropdown_label} .filter-dropdown-loading", visible: true) expect(find(js_dropdown_label)).not_to have_css('.filter-dropdown-loading') end -- cgit v1.2.1 From 80c25e8b9ab4ed3a8e38c40e0b257476df61ed75 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Oct 2017 14:32:42 +0300 Subject: fix string escaping within latex example --- spec/features/projects/wiki/user_creates_wiki_page_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb index e72b7dc0dd5..4a9d1cb87e1 100644 --- a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb @@ -77,14 +77,14 @@ describe 'User creates wiki page' do [stem] ++++ - \sqrt{4} = 2 + \\sqrt{4} = 2 ++++ another part [latexmath] ++++ - \beta_x \gamma + \\beta_x \\gamma ++++ stem:[2+2] is 4 -- cgit v1.2.1 From 01605bc78c57e3c6e1fbdb5d2397e1ebf78d7b2b Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Oct 2017 15:29:37 +0300 Subject: fix body scrollTop references --- spec/features/merge_requests/diff_notes_resolve_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/diff_notes_resolve_spec.rb b/spec/features/merge_requests/diff_notes_resolve_spec.rb index 7264b3b6517..a1a6792d677 100644 --- a/spec/features/merge_requests/diff_notes_resolve_spec.rb +++ b/spec/features/merge_requests/diff_notes_resolve_spec.rb @@ -192,7 +192,7 @@ feature 'Diff notes resolve', :js do page.find('.discussion-next-btn').click end - expect(page.evaluate_script("$('body').scrollTop()")).to be > 0 + expect(page.evaluate_script("window.pageYOffset")).to be > 0 end it 'hides jump to next button when all resolved' do @@ -308,7 +308,7 @@ feature 'Diff notes resolve', :js do page.find('.discussion-next-btn').click end - expect(page.evaluate_script("$('body').scrollTop()")).to be > 0 + expect(page.evaluate_script("window.pageYOffset")).to be > 0 end it 'updates updated text after resolving note' do -- cgit v1.2.1 From 5d9377275b3a5fe054ff29e2644d80846ec7ba58 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Oct 2017 15:53:33 +0300 Subject: fix issue in which enter key from fill_in command was intercepted by autocomplete code --- spec/features/issues/user_uses_slash_commands_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/user_uses_slash_commands_spec.rb b/spec/features/issues/user_uses_slash_commands_spec.rb index 9f5e25ff2cb..c4c06ed514b 100644 --- a/spec/features/issues/user_uses_slash_commands_spec.rb +++ b/spec/features/issues/user_uses_slash_commands_spec.rb @@ -226,7 +226,7 @@ feature 'Issues > User uses quick actions', :js do end it 'applies the commands to both issues and moves the issue' do - write_note("/label ~#{bug.title} ~#{wontfix.title}\n/milestone %\"#{milestone.title}\"\n/move #{target_project.full_path}") + write_note("/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"\n\n/move #{target_project.full_path}") expect(page).to have_content 'Commands applied' expect(issue.reload).to be_closed @@ -245,7 +245,7 @@ feature 'Issues > User uses quick actions', :js do end it 'moves the issue and applies the commands to both issues' do - write_note("/move #{target_project.full_path}\n/label ~#{bug.title} ~#{wontfix.title}\n/milestone %\"#{milestone.title}\"") + write_note("/move #{target_project.full_path}\n\n/label ~#{bug.title} ~#{wontfix.title}\n\n/milestone %\"#{milestone.title}\"") expect(page).to have_content 'Commands applied' expect(issue.reload).to be_closed -- cgit v1.2.1 From 9e538fd0129a08ba1b45ce3babfdf7a20198137f Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Oct 2017 16:01:11 +0300 Subject: remove unneeded accept header --- spec/features/merge_requests/diffs_spec.rb | 4 ---- 1 file changed, 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/diffs_spec.rb b/spec/features/merge_requests/diffs_spec.rb index 21bbf82be77..d56149173a1 100644 --- a/spec/features/merge_requests/diffs_spec.rb +++ b/spec/features/merge_requests/diffs_spec.rb @@ -7,10 +7,6 @@ feature 'Diffs URL', :js do let(:merge_request) { create(:merge_request, source_project: project) } context 'when visit with */* as accept header' do - before do - page.driver.add_header('Accept', '*/*') - end - it 'renders the notes' do create :note_on_merge_request, project: project, noteable: merge_request, note: 'Rebasing with master' -- cgit v1.2.1 From f44665c893a1d54dd7f69d559e404b285e25b611 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Oct 2017 16:25:04 +0300 Subject: slow down requests for dropzone uploads to avoid race conditions --- spec/features/uploads/user_uploads_file_to_note_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/features') diff --git a/spec/features/uploads/user_uploads_file_to_note_spec.rb b/spec/features/uploads/user_uploads_file_to_note_spec.rb index 1261ffdc2ee..47b89d262f3 100644 --- a/spec/features/uploads/user_uploads_file_to_note_spec.rb +++ b/spec/features/uploads/user_uploads_file_to_note_spec.rb @@ -21,6 +21,14 @@ feature 'User uploads file to note' do end context 'uploading is in progress' do + before do + Gitlab::Testing::RequestBlockerMiddleware.slow_requests! + end + + after do + Gitlab::Testing::RequestBlockerMiddleware.allow_requests! + end + it 'shows "Cancel" button on uploading', :js do dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) -- cgit v1.2.1 From 72717b591d8b2cb963ceb8266015e1b80a036ac0 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Oct 2017 16:52:33 +0300 Subject: correct the issues list count for label:none filter --- spec/features/issues/filtered_search/filter_issues_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb index 2974016c6a7..b3c50964810 100644 --- a/spec/features/issues/filtered_search/filter_issues_spec.rb +++ b/spec/features/issues/filtered_search/filter_issues_spec.rb @@ -139,7 +139,7 @@ describe 'Filter issues', :js do input_filtered_search('label:none') expect_tokens([label_token('none', false)]) - expect_issues_list_count(8) + expect_issues_list_count(4) expect_filtered_search_input_empty end -- cgit v1.2.1 From 34f7e825635ed8ce963a4b587ae37a6e7c0696e3 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Oct 2017 16:59:29 +0300 Subject: add accept_confirm around "delete comment" button --- spec/features/snippets/notes_on_personal_snippets_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/snippets/notes_on_personal_snippets_spec.rb b/spec/features/snippets/notes_on_personal_snippets_spec.rb index d089fb5b730..269351e55c9 100644 --- a/spec/features/snippets/notes_on_personal_snippets_spec.rb +++ b/spec/features/snippets/notes_on_personal_snippets_spec.rb @@ -110,7 +110,7 @@ describe 'Comments on personal snippets', :js do open_more_actions_dropdown(snippet_notes[0]) page.within("#notes-list li#note_#{snippet_notes[0].id}") do - click_on 'Delete comment' + accept_confirm { click_on 'Delete comment' } end wait_for_requests -- cgit v1.2.1 From 03fbdde7cd6fbd07027a14b676ca580f831ed015 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Oct 2017 17:55:30 +0300 Subject: add accept_confirm around "delete tag" button --- spec/features/tags/master_deletes_tag_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/tags/master_deletes_tag_spec.rb b/spec/features/tags/master_deletes_tag_spec.rb index f5b3774122b..dfda664d673 100644 --- a/spec/features/tags/master_deletes_tag_spec.rb +++ b/spec/features/tags/master_deletes_tag_spec.rb @@ -64,7 +64,7 @@ feature 'Master deletes tag' do def delete_first_tag page.within('.content') do - first('.btn-remove').click + accept_confirm { first('.btn-remove').click } end end end -- cgit v1.2.1 From c09e5004e5f35b34c03c8d14a8f8b7b38af687c3 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Oct 2017 18:03:18 +0300 Subject: add accept_confirm around "remove" button --- spec/features/projects/members/groups_with_access_list_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/members/groups_with_access_list_spec.rb b/spec/features/projects/members/groups_with_access_list_spec.rb index b1053982eee..a51c09102e1 100644 --- a/spec/features/projects/members/groups_with_access_list_spec.rb +++ b/spec/features/projects/members/groups_with_access_list_spec.rb @@ -40,7 +40,7 @@ feature 'Projects > Members > Groups with access list', :js do scenario 'deletes group link' do page.within(first('.group_member')) do - find('.btn-remove').click + accept_confirm { find('.btn-remove').click } end wait_for_requests -- cgit v1.2.1 From ecc5160aa9680783241571a67658b23f4f121ccc Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Oct 2017 18:10:48 +0300 Subject: fix member expire calendar selection by triggering blur --- spec/features/projects/members/groups_with_access_list_spec.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'spec/features') diff --git a/spec/features/projects/members/groups_with_access_list_spec.rb b/spec/features/projects/members/groups_with_access_list_spec.rb index a51c09102e1..7f067aadec6 100644 --- a/spec/features/projects/members/groups_with_access_list_spec.rb +++ b/spec/features/projects/members/groups_with_access_list_spec.rb @@ -31,6 +31,7 @@ feature 'Projects > Members > Groups with access list', :js do tomorrow = Date.today + 3 fill_in "member_expires_at_#{group.id}", with: tomorrow.strftime("%F") + find('body').click wait_for_requests page.within(find('li.group_member')) do -- cgit v1.2.1 From ff5b9115ddae3e281d0626707011ed9ebae5b02c Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 24 Oct 2017 18:21:09 +0300 Subject: add accept_confirm around "destroy/revoke" buttons --- spec/features/profiles/oauth_applications_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/profiles/oauth_applications_spec.rb b/spec/features/profiles/oauth_applications_spec.rb index 8cb240077eb..d1edeef8da4 100644 --- a/spec/features/profiles/oauth_applications_spec.rb +++ b/spec/features/profiles/oauth_applications_spec.rb @@ -14,7 +14,7 @@ describe 'Profile > Applications' do page.within('.oauth-applications') do expect(page).to have_content('Your applications (1)') - click_button 'Destroy' + accept_confirm { click_button 'Destroy' } end expect(page).to have_content('The application was deleted successfully') @@ -28,7 +28,7 @@ describe 'Profile > Applications' do page.within('.oauth-authorized-applications') do expect(page).to have_content('Authorized applications (1)') - click_button 'Revoke' + accept_confirm { click_button 'Revoke' } end expect(page).to have_content('The application was revoked access.') -- cgit v1.2.1 From 17b4367045ec7943717d11cf1cafc19560da5f40 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Thu, 26 Oct 2017 12:04:07 +0100 Subject: Revert "Merge branch '36670-remove-edit-form' into 'master'" This reverts commit 915e35a2992a4e51db2ac32aac8d7a29b1f4449e, reversing changes made to 9533786f522e358f372d8a0ec4b4990ae9d88f37. --- spec/features/issues/form_spec.rb | 49 +++++++++- spec/features/issues_spec.rb | 108 +++++++++++++++++++-- .../security/project/internal_access_spec.rb | 15 +++ .../security/project/private_access_spec.rb | 15 +++ .../security/project/public_access_spec.rb | 15 +++ 5 files changed, 190 insertions(+), 12 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/form_spec.rb b/spec/features/issues/form_spec.rb index 8ce470fc288..2db6f9a2982 100644 --- a/spec/features/issues/form_spec.rb +++ b/spec/features/issues/form_spec.rb @@ -218,15 +218,54 @@ describe 'New/edit issue', :js do context 'edit issue' do before do - visit project_issue_path(project, issue) - page.within('.content .issuable-actions') do - click_on 'Edit' + visit edit_project_issue_path(project, issue) + end + + it 'allows user to update issue' do + expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match(user.id.to_s) + expect(find('input[name="issue[milestone_id]"]', visible: false).value).to match(milestone.id.to_s) + expect(find('a', text: 'Assign to me', visible: false)).not_to be_visible + + page.within '.js-user-search' do + expect(page).to have_content user.name + end + + page.within '.js-milestone-select' do + expect(page).to have_content milestone.title + end + + click_button 'Labels' + page.within '.dropdown-menu-labels' do + click_link label.title + click_link label2.title + end + page.within '.js-label-select' do + expect(page).to have_content label.title + end + expect(page.all('input[name="issue[label_ids][]"]', visible: false)[1].value).to match(label.id.to_s) + expect(page.all('input[name="issue[label_ids][]"]', visible: false)[2].value).to match(label2.id.to_s) + + click_button 'Save changes' + + page.within '.issuable-sidebar' do + page.within '.assignee' do + expect(page).to have_content user.name + end + + page.within '.milestone' do + expect(page).to have_content milestone.title + end + + page.within '.labels' do + expect(page).to have_content label.title + expect(page).to have_content label2.title + end end end it 'description has autocomplete' do - find_field('issue-description').native.send_keys('') - fill_in 'issue-description', with: '@' + find('#issue_description').native.send_keys('') + fill_in 'issue_description', with: '@' expect(page).to have_selector('.atwho-view') end diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 25e99774575..d4fd3a50008 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Issues', :js do +describe 'Issues' do include DropzoneHelper include IssueHelpers include SortingHelper @@ -24,15 +24,109 @@ describe 'Issues', :js do end before do - visit project_issue_path(project, issue) - page.within('.content .issuable-actions') do - find('.issuable-edit').click - end - find('.issue-details .content-block .js-zen-enter').click + visit edit_project_issue_path(project, issue) + find('.js-zen-enter').click end it 'opens new issue popup' do - expect(page).to have_content(issue.description) + expect(page).to have_content("Issue ##{issue.iid}") + end + end + + describe 'Editing issue assignee' do + let!(:issue) do + create(:issue, + author: user, + assignees: [user], + project: project) + end + + it 'allows user to select unassigned', :js do + visit edit_project_issue_path(project, issue) + + expect(page).to have_content "Assignee #{user.name}" + + first('.js-user-search').click + click_link 'Unassigned' + + click_button 'Save changes' + + page.within('.assignee') do + expect(page).to have_content 'No assignee - assign yourself' + end + + expect(issue.reload.assignees).to be_empty + end + end + + describe 'due date', :js do + context 'on new form' do + before do + visit new_project_issue_path(project) + end + + it 'saves with due date' do + date = Date.today.at_beginning_of_month + + fill_in 'issue_title', with: 'bug 345' + fill_in 'issue_description', with: 'bug description' + find('#issuable-due-date').click + + page.within '.pika-single' do + click_button date.day + end + + expect(find('#issuable-due-date').value).to eq date.to_s + + click_button 'Submit issue' + + page.within '.issuable-sidebar' do + expect(page).to have_content date.to_s(:medium) + end + end + end + + context 'on edit form' do + let(:issue) { create(:issue, author: user, project: project, due_date: Date.today.at_beginning_of_month.to_s) } + + before do + visit edit_project_issue_path(project, issue) + end + + it 'saves with due date' do + date = Date.today.at_beginning_of_month + + expect(find('#issuable-due-date').value).to eq date.to_s + + date = date.tomorrow + + fill_in 'issue_title', with: 'bug 345' + fill_in 'issue_description', with: 'bug description' + find('#issuable-due-date').click + + page.within '.pika-single' do + click_button date.day + end + + expect(find('#issuable-due-date').value).to eq date.to_s + + click_button 'Save changes' + + page.within '.issuable-sidebar' do + expect(page).to have_content date.to_s(:medium) + end + end + + it 'warns about version conflict' do + issue.update(title: "New title") + + fill_in 'issue_title', with: 'bug 345' + fill_in 'issue_description', with: 'bug description' + + click_button 'Save changes' + + expect(page).to have_content 'Someone edited the issue the same time you did' + end end end diff --git a/spec/features/security/project/internal_access_spec.rb b/spec/features/security/project/internal_access_spec.rb index d70cf1527e7..a7928857b7d 100644 --- a/spec/features/security/project/internal_access_spec.rb +++ b/spec/features/security/project/internal_access_spec.rb @@ -181,6 +181,21 @@ describe "Internal Project Access" do it { is_expected.to be_denied_for(:visitor) } end + describe "GET /:project_path/issues/:id/edit" do + let(:issue) { create(:issue, project: project) } + subject { edit_project_issue_path(project, issue) } + + it { is_expected.to be_allowed_for(:admin) } + it { is_expected.to be_allowed_for(:owner).of(project) } + it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:developer).of(project) } + it { is_expected.to be_allowed_for(:reporter).of(project) } + it { is_expected.to be_denied_for(:guest).of(project) } + it { is_expected.to be_denied_for(:user) } + it { is_expected.to be_denied_for(:external) } + it { is_expected.to be_denied_for(:visitor) } + end + describe "GET /:project_path/snippets" do subject { project_snippets_path(project) } diff --git a/spec/features/security/project/private_access_spec.rb b/spec/features/security/project/private_access_spec.rb index ea130606545..a4396b20afd 100644 --- a/spec/features/security/project/private_access_spec.rb +++ b/spec/features/security/project/private_access_spec.rb @@ -181,6 +181,21 @@ describe "Private Project Access" do it { is_expected.to be_denied_for(:visitor) } end + describe "GET /:project_path/issues/:id/edit" do + let(:issue) { create(:issue, project: project) } + subject { edit_project_issue_path(project, issue) } + + it { is_expected.to be_allowed_for(:admin) } + it { is_expected.to be_allowed_for(:owner).of(project) } + it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:developer).of(project) } + it { is_expected.to be_allowed_for(:reporter).of(project) } + it { is_expected.to be_denied_for(:guest).of(project) } + it { is_expected.to be_denied_for(:user) } + it { is_expected.to be_denied_for(:external) } + it { is_expected.to be_denied_for(:visitor) } + end + describe "GET /:project_path/snippets" do subject { project_snippets_path(project) } diff --git a/spec/features/security/project/public_access_spec.rb b/spec/features/security/project/public_access_spec.rb index d15f5af66c9..fccdeb0e5b7 100644 --- a/spec/features/security/project/public_access_spec.rb +++ b/spec/features/security/project/public_access_spec.rb @@ -394,6 +394,21 @@ describe "Public Project Access" do it { is_expected.to be_allowed_for(:visitor) } end + describe "GET /:project_path/issues/:id/edit" do + let(:issue) { create(:issue, project: project) } + subject { edit_project_issue_path(project, issue) } + + it { is_expected.to be_allowed_for(:admin) } + it { is_expected.to be_allowed_for(:owner).of(project) } + it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_allowed_for(:developer).of(project) } + it { is_expected.to be_allowed_for(:reporter).of(project) } + it { is_expected.to be_denied_for(:guest).of(project) } + it { is_expected.to be_denied_for(:user) } + it { is_expected.to be_denied_for(:external) } + it { is_expected.to be_denied_for(:visitor) } + end + describe "GET /:project_path/snippets" do subject { project_snippets_path(project) } -- cgit v1.2.1 From 443c2e3f02624ceb1059f9c8e2063e9f8b956c9a Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 26 Oct 2017 18:10:19 +0200 Subject: fix select2 commands in user_edits_merge_request_spec.rb --- .../projects/merge_requests/user_edits_merge_request_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/merge_requests/user_edits_merge_request_spec.rb b/spec/features/projects/merge_requests/user_edits_merge_request_spec.rb index f6e3997383f..3d19a2923b9 100644 --- a/spec/features/projects/merge_requests/user_edits_merge_request_spec.rb +++ b/spec/features/projects/merge_requests/user_edits_merge_request_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' describe 'User edits a merge request', :js do + include Select2Helper + let(:project) { create(:project, :repository) } let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let(:user) { create(:user) } @@ -15,8 +17,7 @@ describe 'User edits a merge request', :js do it 'changes the target branch' do expect(page).to have_content('Target branch') - first('.target_branch').click - select('merge-test', from: 'merge_request_target_branch', visible: false) + select2('merge-test', from: '#merge_request_target_branch') click_button('Save changes') expect(page).to have_content("Request to merge #{merge_request.source_branch} into merge-test") -- cgit v1.2.1 From 20f1b823d1ec88b34fbe50e0cbd0a2f918fa9c0c Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 26 Oct 2017 18:15:09 +0200 Subject: remove unnecessary use of url_blacklist override --- spec/features/projects/artifacts/file_spec.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/artifacts/file_spec.rb b/spec/features/projects/artifacts/file_spec.rb index b2be10a7e0c..df1d17bdcb7 100644 --- a/spec/features/projects/artifacts/file_spec.rb +++ b/spec/features/projects/artifacts/file_spec.rb @@ -39,7 +39,6 @@ feature 'Artifact file', :js do context 'JPG file' do before do - page.driver.browser.url_blacklist = [] visit_file('rails_sample.jpg') wait_for_requests -- cgit v1.2.1 From b5c211bada185aa4728ab1df62c8756c83f20646 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 26 Oct 2017 18:37:57 +0200 Subject: use click instead of send(:return) so that open select dropdowns are blurred --- spec/features/issues/bulk_assignment_labels_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/issues/bulk_assignment_labels_spec.rb b/spec/features/issues/bulk_assignment_labels_spec.rb index c64cb0c2e11..fa4d3a55c62 100644 --- a/spec/features/issues/bulk_assignment_labels_spec.rb +++ b/spec/features/issues/bulk_assignment_labels_spec.rb @@ -405,7 +405,7 @@ feature 'Issues > Labels bulk assignment' do end def update_issues - find('.update-selected-issues').send_keys(:return) + find('.update-selected-issues').click wait_for_requests end -- cgit v1.2.1 From 6c5e20c15ab1b7ef25f946e8457944f9d7d9f008 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 26 Oct 2017 18:48:29 +0200 Subject: update all status_code calls to use new inspect_requests helper --- spec/features/snippets/user_creates_snippet_spec.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'spec/features') diff --git a/spec/features/snippets/user_creates_snippet_spec.rb b/spec/features/snippets/user_creates_snippet_spec.rb index 1c73b86c5fb..5020eb7d137 100644 --- a/spec/features/snippets/user_creates_snippet_spec.rb +++ b/spec/features/snippets/user_creates_snippet_spec.rb @@ -2,6 +2,7 @@ require 'rails_helper' feature 'User creates snippet', :js do include DropzoneHelper + include InspectRequests let(:user) { create(:user) } @@ -43,8 +44,8 @@ feature 'User creates snippet', :js do link = find('a.no-attachment-icon img[alt="banana_sample"]')['src'] expect(link).to match(%r{/uploads/-/system/temp/\h{32}/banana_sample\.gif\z}) - visit(link) - expect(page.status_code).to eq(200) + reqs = inspect_requests { visit(link) } + expect(reqs.first.status_code).to eq(200) end end @@ -61,8 +62,8 @@ feature 'User creates snippet', :js do link = find('a.no-attachment-icon img[alt="banana_sample"]')['src'] expect(link).to match(%r{/uploads/-/system/personal_snippet/#{Snippet.last.id}/\h{32}/banana_sample\.gif\z}) - visit(link) - expect(page.status_code).to eq(200) + reqs = inspect_requests { visit(link) } + expect(reqs.first.status_code).to eq(200) end scenario 'validation fails for the first time' do @@ -86,8 +87,8 @@ feature 'User creates snippet', :js do link = find('a.no-attachment-icon img[alt="banana_sample"]')['src'] expect(link).to match(%r{/uploads/-/system/personal_snippet/#{Snippet.last.id}/\h{32}/banana_sample\.gif\z}) - visit(link) - expect(page.status_code).to eq(200) + reqs = inspect_requests { visit(link) } + expect(reqs.first.status_code).to eq(200) end scenario 'Authenticated user creates a snippet with + in filename' do -- cgit v1.2.1 From 8b7672697fd5c33a7d0a589bd1427f32f8692872 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 26 Oct 2017 18:57:57 +0200 Subject: accept modal confirm dialog when disabling 2FA --- spec/features/admin/admin_disables_two_factor_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/admin/admin_disables_two_factor_spec.rb b/spec/features/admin/admin_disables_two_factor_spec.rb index 6a97378391b..2abdd3c9ef2 100644 --- a/spec/features/admin/admin_disables_two_factor_spec.rb +++ b/spec/features/admin/admin_disables_two_factor_spec.rb @@ -7,7 +7,7 @@ feature 'Admin disables 2FA for a user' do edit_user(user) page.within('.two-factor-status') do - click_link 'Disable' + accept_confirm { click_link 'Disable' } end page.within('.two-factor-status') do -- cgit v1.2.1 From 8b573b1dfc2d60fc960b1ea2f5d0e854bfabf549 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 26 Oct 2017 20:10:11 +0200 Subject: fix use of unsupported webdriver feature "network_requests" --- spec/features/raven_js_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/raven_js_spec.rb b/spec/features/raven_js_spec.rb index b1f51959d54..e4738932314 100644 --- a/spec/features/raven_js_spec.rb +++ b/spec/features/raven_js_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'RavenJS', :js do +feature 'RavenJS' do let(:raven_path) { '/raven.bundle.js' } it 'should not load raven if sentry is disabled' do @@ -18,6 +18,8 @@ feature 'RavenJS', :js do end def has_requested_raven - page.driver.network_traffic.one? {|request| request.url.end_with?(raven_path)} + page.all('script', visible: false).one? do | elm | + elm[:src] =~ /#{raven_path}$/ + end end end -- cgit v1.2.1 From 59bd8ac83074c95ac04507cfd2e10a4601fa9257 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 26 Oct 2017 20:19:12 +0200 Subject: remove unnecessary capybara process invocation --- spec/features/projects/settings/pipelines_settings_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/settings/pipelines_settings_spec.rb b/spec/features/projects/settings/pipelines_settings_spec.rb index de8fbb15b9c..ea8f997409d 100644 --- a/spec/features/projects/settings/pipelines_settings_spec.rb +++ b/spec/features/projects/settings/pipelines_settings_spec.rb @@ -22,7 +22,7 @@ feature "Pipelines settings" do context 'for master' do given(:role) { :master } - scenario 'be allowed to change', :js do + scenario 'be allowed to change' do fill_in('Test coverage parsing', with: 'coverage_regex') click_on 'Save changes' -- cgit v1.2.1 From fed51d1eaacc0d9e327cb2b67b19848d6cafd666 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Fri, 27 Oct 2017 09:05:03 +0000 Subject: Remove groups_select from global namespace & simplifies the code --- spec/features/projects/members/share_with_group_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/members/share_with_group_spec.rb b/spec/features/projects/members/share_with_group_spec.rb index 3b368f8e25d..63b5df5a8f5 100644 --- a/spec/features/projects/members/share_with_group_spec.rb +++ b/spec/features/projects/members/share_with_group_spec.rb @@ -149,7 +149,7 @@ feature 'Project > Members > Share with Group', :js do create(:group).add_owner(master) visit project_settings_members_path(project) - execute_script 'GroupsSelect.PER_PAGE = 1;' + execute_script 'GROUP_SELECT_PER_PAGE = 1;' open_select2 '#link_group_id' end -- cgit v1.2.1 From ad3a0b318feaf91b9141f9e7ef1b6a3617056345 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Sun, 29 Oct 2017 08:04:49 -0500 Subject: fix rubocop violation --- spec/features/raven_js_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/raven_js_spec.rb b/spec/features/raven_js_spec.rb index e4738932314..74890c86047 100644 --- a/spec/features/raven_js_spec.rb +++ b/spec/features/raven_js_spec.rb @@ -18,7 +18,7 @@ feature 'RavenJS' do end def has_requested_raven - page.all('script', visible: false).one? do | elm | + page.all('script', visible: false).one? do |elm| elm[:src] =~ /#{raven_path}$/ end end -- cgit v1.2.1 From 40ee89bc7da8b1c0500f2358d2548f2395bc2323 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Sun, 29 Oct 2017 08:11:59 -0500 Subject: accept modal confirm dialog when deleting note --- spec/features/projects/merge_requests/user_comments_on_diff_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb b/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb index 94cd167c36a..62f776375c9 100644 --- a/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb +++ b/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb @@ -155,7 +155,7 @@ describe 'User comments on a diff', :js do find('.more-actions').click find('.more-actions .dropdown-menu li', match: :first) - find('.js-note-delete').click + accept_confirm { find('.js-note-delete').click } end page.within('.merge-request-tabs') do -- cgit v1.2.1 From ce75de08f076ced6c68dfcf90e92254123dfdf48 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Tue, 10 Oct 2017 10:19:20 +0200 Subject: Fixes for Tests --- spec/features/projects/pipelines/pipeline_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index acbc5b046e6..70f476382a8 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -67,7 +67,7 @@ describe 'Pipeline', :js do it 'shows a running icon and a cancel action for the running build' do page.within('#ci-badge-deploy') do expect(page).to have_selector('.js-ci-status-icon-running') - expect(page).to have_selector('.js-icon-action-cancel') + expect(page).to have_selector('.js-icon-cancel') expect(page).to have_content('deploy') end end @@ -87,7 +87,7 @@ describe 'Pipeline', :js do end page.within('#ci-badge-build .ci-action-icon-container') do - expect(page).to have_selector('.js-icon-action-retry') + expect(page).to have_selector('.js-icon-retry') end end @@ -106,7 +106,7 @@ describe 'Pipeline', :js do end page.within('#ci-badge-test .ci-action-icon-container') do - expect(page).to have_selector('.js-icon-action-retry') + expect(page).to have_selector('.js-icon-retry') end end @@ -125,7 +125,7 @@ describe 'Pipeline', :js do end page.within('#ci-badge-manual-build .ci-action-icon-container') do - expect(page).to have_selector('.js-icon-action-play') + expect(page).to have_selector('.js-icon-play') end end -- cgit v1.2.1 From 33ca696666e8acb7ebaa427bfe0ed8f8d9471d77 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Thu, 12 Oct 2017 11:35:16 +0200 Subject: Fixing Tests and CSS display --- spec/features/projects/pipelines/pipeline_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index 70f476382a8..931811e0ee6 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -86,8 +86,8 @@ describe 'Pipeline', :js do expect(page).to have_content('build') end - page.within('#ci-badge-build .ci-action-icon-container') do - expect(page).to have_selector('.js-icon-retry') + page.within('#ci-badge-build .ci-action-icon-container.js-icon-retry') do + expect(page).to have_selector('svg') end end @@ -105,8 +105,8 @@ describe 'Pipeline', :js do expect(page).to have_content('test') end - page.within('#ci-badge-test .ci-action-icon-container') do - expect(page).to have_selector('.js-icon-retry') + page.within('#ci-badge-test .ci-action-icon-container.js-icon-retry') do + expect(page).to have_selector('svg') end end @@ -124,8 +124,8 @@ describe 'Pipeline', :js do expect(page).to have_content('manual') end - page.within('#ci-badge-manual-build .ci-action-icon-container') do - expect(page).to have_selector('.js-icon-play') + page.within('#ci-badge-manual-build .ci-action-icon-container.js-icon-play') do + expect(page).to have_selector('svg') end end -- cgit v1.2.1 From 3f3153702b982f3638f85ea9eb20a5b729258476 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Fri, 13 Oct 2017 09:26:39 +0200 Subject: Lets try with trigger('click') --- spec/features/merge_requests/mini_pipeline_graph_spec.rb | 2 +- spec/features/projects/commit/mini_pipeline_graph_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/mini_pipeline_graph_spec.rb b/spec/features/merge_requests/mini_pipeline_graph_spec.rb index bf21a719901..0ae43e226b9 100644 --- a/spec/features/merge_requests/mini_pipeline_graph_spec.rb +++ b/spec/features/merge_requests/mini_pipeline_graph_spec.rb @@ -83,7 +83,7 @@ feature 'Mini Pipeline Graph', :js do end before do - toggle.click + toggle.trigger('click') wait_for_requests end diff --git a/spec/features/projects/commit/mini_pipeline_graph_spec.rb b/spec/features/projects/commit/mini_pipeline_graph_spec.rb index 807a2189cc4..6f6d562c7b6 100644 --- a/spec/features/projects/commit/mini_pipeline_graph_spec.rb +++ b/spec/features/projects/commit/mini_pipeline_graph_spec.rb @@ -18,7 +18,7 @@ feature 'Mini Pipeline Graph in Commit View', :js do expect(page).to have_selector('.mr-widget-pipeline-graph') - first('.mini-pipeline-graph-dropdown-toggle').click + first('.mini-pipeline-graph-dropdown-toggle').trigger('click') wait_for_requests -- cgit v1.2.1 From 5c75d750cf3b86e7e61df89b4b0efef1207829e0 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Mon, 30 Oct 2017 14:36:24 +0000 Subject: addressed feedback from review spec fixes --- spec/features/projects/tree/create_file_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/tree/create_file_spec.rb b/spec/features/projects/tree/create_file_spec.rb index a67ec891e7c..f75122abad3 100644 --- a/spec/features/projects/tree/create_file_spec.rb +++ b/spec/features/projects/tree/create_file_spec.rb @@ -28,7 +28,7 @@ feature 'Multi-file editor new file', :js do click_button('Create file') end - find('.inputarea').send_keys('file content') + find('.inputarea', visible: false).send_keys('file content') fill_in('commit-message', with: 'commit message') -- cgit v1.2.1 From d7942f223cd30c28933c65bb8efa0cb9277b808e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Mon, 30 Oct 2017 15:01:37 +0100 Subject: Allow to disable the Performance Bar and document the `p b` shortcut in its doc page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- spec/features/admin/admin_settings_spec.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'spec/features') diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index c490dce7ab0..85561511101 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -95,6 +95,29 @@ feature 'Admin updates settings' do expect(find_field('ED25519 SSH keys').value).to eq(forbidden) end + scenario 'Change Performance Bar settings' do + group = create(:group) + + check 'Enable the Performance Bar' + fill_in 'Allowed group', with: group.path + + click_on 'Save' + + expect(page).to have_content 'Application settings saved successfully' + + expect(find_field('Enable the Performance Bar')).to be_checked + expect(find_field('Allowed group').value).to eq group.path + + uncheck 'Enable the Performance Bar' + + click_on 'Save' + + expect(page).to have_content 'Application settings saved successfully' + + expect(find_field('Enable the Performance Bar')).not_to be_checked + expect(find_field('Allowed group').value).to be_nil + end + def check_all_events page.check('Active') page.check('Push') -- cgit v1.2.1 From 2fbbf45ea646958cba488830c3321c48d38ecece Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 30 Oct 2017 10:17:27 -0500 Subject: fix page render issues on contribution calendar while tests are run --- spec/features/calendar_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/calendar_spec.rb b/spec/features/calendar_spec.rb index 4fc6956d111..9143a417bec 100644 --- a/spec/features/calendar_spec.rb +++ b/spec/features/calendar_spec.rb @@ -112,7 +112,7 @@ feature 'Contributions Calendar', :js do end it 'hides calendar day activities' do - expect(selected_day_activities).to be_empty + expect(find('.user-calendar-activities', visible: false).text).to be_empty end end end -- cgit v1.2.1 From 5a0e41a58a1a5de4a755abd6709792d5c10f6205 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 30 Oct 2017 11:07:13 -0500 Subject: add accept_confirm when attempting to stop an environment in widget_deployments_spec.rb --- spec/features/merge_requests/widget_deployments_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/widget_deployments_spec.rb b/spec/features/merge_requests/widget_deployments_spec.rb index 5658c2c5122..72a52c979b3 100644 --- a/spec/features/merge_requests/widget_deployments_spec.rb +++ b/spec/features/merge_requests/widget_deployments_spec.rb @@ -42,7 +42,7 @@ feature 'Widget Deployments Header', :js do end scenario 'does start build when stop button clicked' do - click_button('Stop environment') + accept_confirm { click_button('Stop environment') } expect(page).to have_content('close_app') end -- cgit v1.2.1 From e0ca65c5144d4f6de91e3c808437bd85c0323b14 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 30 Oct 2017 11:17:31 -0500 Subject: add accept_confirm around attempts to revoke personal access tokens --- spec/features/profiles/personal_access_tokens_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb index 7fd6f4a26bd..8461cd0027c 100644 --- a/spec/features/profiles/personal_access_tokens_spec.rb +++ b/spec/features/profiles/personal_access_tokens_spec.rb @@ -78,7 +78,7 @@ describe 'Profile > Personal Access Tokens', :js do it "allows revocation of an active token" do visit profile_personal_access_tokens_path - click_on "Revoke" + accept_confirm { click_on "Revoke" } expect(page).to have_selector(".settings-message") expect(no_personal_access_tokens_message).to have_text("This user has no active Personal Access Tokens.") @@ -100,7 +100,7 @@ describe 'Profile > Personal Access Tokens', :js do errors = ActiveModel::Errors.new(PersonalAccessToken.new).tap { |e| e.add(:name, "cannot be nil") } allow_any_instance_of(PersonalAccessToken).to receive(:errors).and_return(errors) - click_on "Revoke" + accept_confirm { click_on "Revoke" } expect(active_personal_access_tokens).to have_text(personal_access_token.name) expect(page).to have_content("Could not revoke") end -- cgit v1.2.1 From 098a98055abd32a7049b5429064f1ed45e45eea8 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Mon, 30 Oct 2017 16:25:32 +0000 Subject: spec fixes increased perf of scrolling tabs into view --- spec/features/projects/tree/create_file_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/tree/create_file_spec.rb b/spec/features/projects/tree/create_file_spec.rb index f75122abad3..a67ec891e7c 100644 --- a/spec/features/projects/tree/create_file_spec.rb +++ b/spec/features/projects/tree/create_file_spec.rb @@ -28,7 +28,7 @@ feature 'Multi-file editor new file', :js do click_button('Create file') end - find('.inputarea', visible: false).send_keys('file content') + find('.inputarea').send_keys('file content') fill_in('commit-message', with: 'commit message') -- cgit v1.2.1 From 5445f839e8a1f8bb6ff1a3cf68c3b5d59f3681bc Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 30 Oct 2017 15:06:08 -0500 Subject: allow inspect_request to inject request headers in order to test Sendfile requests in jobs_spec.rb --- spec/features/projects/jobs_spec.rb | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 171b001aa7a..5e1d81184b5 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -2,6 +2,8 @@ require 'spec_helper' require 'tempfile' feature 'Jobs' do + include InspectRequests + let(:user) { create(:user) } let(:user_access_level) { :developer } let(:project) { create(:project, :repository) } @@ -441,27 +443,30 @@ feature 'Jobs' do context 'access source' do context 'job from project' do before do - Capybara.current_session.driver.headers = { 'X-Sendfile-Type' => 'X-Sendfile' } job.run! - visit project_job_path(project, job) - find('.js-raw-link-controller').click() end it 'sends the right headers' do - expect(page.response_headers['Content-Type']).to eq('text/plain; charset=utf-8') - expect(page.response_headers['X-Sendfile']).to eq(job.trace.send(:current_path)) + requests = inspect_requests(inject_headers: { 'X-Sendfile-Type' => 'X-Sendfile' }) do + visit raw_project_job_path(project, job) + end + + expect(requests.first.status_code).to eq(200) + expect(requests.first.response_headers['Content-Type']).to eq('text/plain; charset=utf-8') + expect(requests.first.response_headers['X-Sendfile']).to eq(job.trace.send(:current_path)) end end context 'job from other project' do before do - Capybara.current_session.driver.headers = { 'X-Sendfile-Type' => 'X-Sendfile' } job2.run! - visit raw_project_job_path(project, job2) end it 'sends the right headers' do - expect(page.status_code).to eq(404) + requests = inspect_requests(inject_headers: { 'X-Sendfile-Type' => 'X-Sendfile' }) do + visit raw_project_job_path(project, job2) + end + expect(requests.first.status_code).to eq(404) end end end @@ -470,8 +475,6 @@ feature 'Jobs' do let(:existing_file) { Tempfile.new('existing-trace-file').path } before do - Capybara.current_session.driver.headers = { 'X-Sendfile-Type' => 'X-Sendfile' } - job.run! end @@ -480,15 +483,14 @@ feature 'Jobs' do allow_any_instance_of(Gitlab::Ci::Trace) .to receive(:paths) .and_return([existing_file]) - - visit project_job_path(project, job) - - find('.js-raw-link-controller').click end it 'sends the right headers' do - expect(page.response_headers['Content-Type']).to eq('text/plain; charset=utf-8') - expect(page.response_headers['X-Sendfile']).to eq(existing_file) + requests = inspect_requests(inject_headers: { 'X-Sendfile-Type' => 'X-Sendfile' }) do + visit raw_project_job_path(project, job) + end + expect(requests.first.response_headers['Content-Type']).to eq('text/plain; charset=utf-8') + expect(requests.first.response_headers['X-Sendfile']).to eq(existing_file) end end -- cgit v1.2.1 From 7513bd06c81c7ff320da68a537bb2dfc2b2ab1d3 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 30 Oct 2017 15:57:53 -0500 Subject: fix set_cookie references within ref_switcher_spec.rb --- spec/features/projects/ref_switcher_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/ref_switcher_spec.rb b/spec/features/projects/ref_switcher_spec.rb index 50c0bfd580d..44b70b7b52a 100644 --- a/spec/features/projects/ref_switcher_spec.rb +++ b/spec/features/projects/ref_switcher_spec.rb @@ -1,12 +1,14 @@ require 'rails_helper' feature 'Ref switcher', :js do + include CookieHelper + let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } before do project.team << [user, :master] - page.driver.set_cookie('new_repo', 'true') + set_cookie('new_repo', 'true') sign_in(user) visit project_tree_path(project, 'master') end -- cgit v1.2.1 From 945a262dfa31bdd595d2d92fd56e6fdc702f3fa5 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 30 Oct 2017 16:24:44 -0500 Subject: flash message broken in rspec but already covered by repo_service_spec.js --- spec/features/projects/tree/create_directory_spec.rb | 1 - spec/features/projects/tree/create_file_spec.rb | 1 - 2 files changed, 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/tree/create_directory_spec.rb b/spec/features/projects/tree/create_directory_spec.rb index 4c1fa5a666e..798c15912c6 100644 --- a/spec/features/projects/tree/create_directory_spec.rb +++ b/spec/features/projects/tree/create_directory_spec.rb @@ -32,7 +32,6 @@ feature 'Multi-file editor new directory', :js do click_button('Commit 1 file') - expect(page).to have_content('Your changes have been committed') expect(page).to have_selector('td', text: 'commit message') click_link('foldername') diff --git a/spec/features/projects/tree/create_file_spec.rb b/spec/features/projects/tree/create_file_spec.rb index a67ec891e7c..40c43b844fd 100644 --- a/spec/features/projects/tree/create_file_spec.rb +++ b/spec/features/projects/tree/create_file_spec.rb @@ -34,7 +34,6 @@ feature 'Multi-file editor new file', :js do click_button('Commit 1 file') - expect(page).to have_content('Your changes have been committed') expect(page).to have_selector('td', text: 'commit message') end end -- cgit v1.2.1 From d5bee2c6e06c00081c17536538f94cab829e7d73 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 30 Oct 2017 16:26:01 -0500 Subject: fix set_cookie references within multi-file editor specs --- spec/features/projects/tree/create_directory_spec.rb | 3 ++- spec/features/projects/tree/create_file_spec.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/tree/create_directory_spec.rb b/spec/features/projects/tree/create_directory_spec.rb index 798c15912c6..174d4cb4e08 100644 --- a/spec/features/projects/tree/create_directory_spec.rb +++ b/spec/features/projects/tree/create_directory_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' feature 'Multi-file editor new directory', :js do + include CookieHelper include WaitForRequests let(:user) { create(:user) } @@ -10,7 +11,7 @@ feature 'Multi-file editor new directory', :js do project.add_master(user) sign_in(user) - page.driver.set_cookie('new_repo', 'true') + set_cookie('new_repo', 'true') visit project_tree_path(project, :master) diff --git a/spec/features/projects/tree/create_file_spec.rb b/spec/features/projects/tree/create_file_spec.rb index 40c43b844fd..d8e6a3179cb 100644 --- a/spec/features/projects/tree/create_file_spec.rb +++ b/spec/features/projects/tree/create_file_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' feature 'Multi-file editor new file', :js do + include CookieHelper include WaitForRequests let(:user) { create(:user) } @@ -10,7 +11,7 @@ feature 'Multi-file editor new file', :js do project.add_master(user) sign_in(user) - page.driver.set_cookie('new_repo', 'true') + set_cookie('new_repo', 'true') visit project_tree_path(project, :master) -- cgit v1.2.1 From 662f87ca372515f0b739796b31c7e242f1ebcd7f Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 31 Oct 2017 09:06:23 +0000 Subject: spec fixes --- spec/features/projects/tree/create_file_spec.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/tree/create_file_spec.rb b/spec/features/projects/tree/create_file_spec.rb index a67ec891e7c..ed3b52a5790 100644 --- a/spec/features/projects/tree/create_file_spec.rb +++ b/spec/features/projects/tree/create_file_spec.rb @@ -28,8 +28,6 @@ feature 'Multi-file editor new file', :js do click_button('Create file') end - find('.inputarea').send_keys('file content') - fill_in('commit-message', with: 'commit message') click_button('Commit 1 file') -- cgit v1.2.1 From 68d1e9d1c42f34d3fb2d58779d862dcf47d5f17e Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 31 Oct 2017 10:47:10 +0000 Subject: Upload files through the multi-file editor --- spec/features/projects/tree/upload_file_spec.rb | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 spec/features/projects/tree/upload_file_spec.rb (limited to 'spec/features') diff --git a/spec/features/projects/tree/upload_file_spec.rb b/spec/features/projects/tree/upload_file_spec.rb new file mode 100644 index 00000000000..7dbe4fd0aa5 --- /dev/null +++ b/spec/features/projects/tree/upload_file_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + +feature 'Multi-file editor upload file', :js do + include WaitForRequests + + let(:user) { create(:user) } + let(:project) { create(:project, :repository) } + let(:txt_file) { File.join(Rails.root, 'spec', 'fixtures', 'doc_sample.txt') } + let(:img_file) { File.join(Rails.root, 'spec', 'fixtures', 'dk.png') } + + before do + project.add_master(user) + sign_in(user) + + page.driver.set_cookie('new_repo', 'true') + + visit project_tree_path(project, :master) + + wait_for_requests + end + + it 'uploads text file' do + find('.add-to-tree').click + + # make the field visible so capybara can use it + execute_script('document.querySelector("#file-upload").classList.remove("hidden")') + attach_file('file-upload', txt_file) + + find('.add-to-tree').click + + expect(page).to have_selector('.repo-tab', text: 'doc_sample.txt') + expect(page).to have_content(File.open(txt_file, &:readline)) + end + + it 'uploads image file' do + find('.add-to-tree').click + + # make the field visible so capybara can use it + execute_script('document.querySelector("#file-upload").classList.remove("hidden")') + attach_file('file-upload', img_file) + + find('.add-to-tree').click + + expect(page).to have_selector('.repo-tab', text: 'dk.png') + expect(page).not_to have_selector('.monaco-editor') + expect(page).to have_content('The source could not be displayed for this temporary file.') + end +end -- cgit v1.2.1 From ae1be64b66b5d4a22a2ebab8d5691cac40f85c87 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 31 Oct 2017 10:01:32 -0500 Subject: accept confirmation modal when erasing job trace in user_browses_job_spec.rb --- spec/features/projects/jobs/user_browses_job_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/jobs/user_browses_job_spec.rb b/spec/features/projects/jobs/user_browses_job_spec.rb index 21c9acc7ac0..5d9208ebadd 100644 --- a/spec/features/projects/jobs/user_browses_job_spec.rb +++ b/spec/features/projects/jobs/user_browses_job_spec.rb @@ -21,12 +21,12 @@ describe 'User browses a job', :js do expect(page).to have_content("Job ##{build.id}") expect(page).to have_css('#build-trace') - click_link('Erase') + accept_confirm { click_link('Erase') } + expect(page).to have_no_css('.artifacts') expect(build).not_to have_trace expect(build.artifacts_file.exists?).to be_falsy expect(build.artifacts_metadata.exists?).to be_falsy - expect(page).to have_no_css('.artifacts') page.within('.erased') do expect(page).to have_content('Job has been erased') -- cgit v1.2.1 From 6dc9028fbb3856c8c7814446ed176880f7d5213f Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 31 Oct 2017 16:15:03 +0000 Subject: Load participants async --- spec/features/boards/boards_spec.rb | 2 +- spec/features/projects/merge_requests/user_manages_subscription_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 60ed17c0c81..ebe6939df4c 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -538,7 +538,7 @@ describe 'Issue Boards', :js do end it 'does not show create new list' do - expect(page).not_to have_selector('.js-new-board-list') + expect(page).not_to have_button('.js-new-board-list') end it 'does not allow dragging' do diff --git a/spec/features/projects/merge_requests/user_manages_subscription_spec.rb b/spec/features/projects/merge_requests/user_manages_subscription_spec.rb index 30a80f8e652..4ca435491cb 100644 --- a/spec/features/projects/merge_requests/user_manages_subscription_spec.rb +++ b/spec/features/projects/merge_requests/user_manages_subscription_spec.rb @@ -13,7 +13,7 @@ describe 'User manages subscription', :js do end it 'toggles subscription' do - subscribe_button = find('.issuable-subscribe-button span') + subscribe_button = find('.js-issuable-subscribe-button') expect(subscribe_button).to have_content('Subscribe') -- cgit v1.2.1 From 6b662718e07ee6e2c51c11525bc6b95927065f4c Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 19 Oct 2017 13:36:47 -0500 Subject: Use count expectation so `all` finder will wait (patience) Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/34435 Address flakey specs --- .../issues/filtered_search/recent_searches_spec.rb | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/filtered_search/recent_searches_spec.rb b/spec/features/issues/filtered_search/recent_searches_spec.rb index eef7988e2bd..4fff056cb70 100644 --- a/spec/features/issues/filtered_search/recent_searches_spec.rb +++ b/spec/features/issues/filtered_search/recent_searches_spec.rb @@ -27,9 +27,8 @@ describe 'Recent searches', :js do input_filtered_search('foo', submit: true) input_filtered_search('bar', submit: true) - items = all('.filtered-search-history-dropdown-item', visible: false) + items = all('.filtered-search-history-dropdown-item', visible: false, count: 2) - expect(items.count).to eq(2) expect(items[0].text).to eq('bar') expect(items[1].text).to eq('foo') end @@ -38,9 +37,8 @@ describe 'Recent searches', :js do visit project_issues_path(project_1, label_name: 'foo', search: 'bar') visit project_issues_path(project_1, label_name: 'qux', search: 'garply') - items = all('.filtered-search-history-dropdown-item', visible: false) + items = all('.filtered-search-history-dropdown-item', visible: false, count: 2) - expect(items.count).to eq(2) expect(items[0].text).to eq('label:~qux garply') expect(items[1].text).to eq('label:~foo bar') end @@ -50,9 +48,8 @@ describe 'Recent searches', :js do visit project_issues_path(project_1, search: 'foo') - items = all('.filtered-search-history-dropdown-item', visible: false) + items = all('.filtered-search-history-dropdown-item', visible: false, count: 3) - expect(items.count).to eq(3) expect(items[0].text).to eq('foo') expect(items[1].text).to eq('saved1') expect(items[2].text).to eq('saved2') @@ -69,9 +66,8 @@ describe 'Recent searches', :js do input_filtered_search('more', submit: true) input_filtered_search('things', submit: true) - items = all('.filtered-search-history-dropdown-item', visible: false) + items = all('.filtered-search-history-dropdown-item', visible: false, count: 2) - expect(items.count).to eq(2) expect(items[0].text).to eq('things') expect(items[1].text).to eq('more') end @@ -80,7 +76,7 @@ describe 'Recent searches', :js do set_recent_searches(project_1_local_storage_key, '["foo", "bar"]') visit project_issues_path(project_1) - all('.filtered-search-history-dropdown-item', visible: false)[0].trigger('click') + all('.filtered-search-history-dropdown-item', visible: false, count: 2)[0].trigger('click') wait_for_filtered_search('foo') expect(find('.filtered-search').value.strip).to eq('foo') @@ -90,12 +86,10 @@ describe 'Recent searches', :js do set_recent_searches(project_1_local_storage_key, '["foo"]') visit project_issues_path(project_1) - items_before = all('.filtered-search-history-dropdown-item', visible: false) - - expect(items_before.count).to eq(1) + all('.filtered-search-history-dropdown-item', visible: false, count: 1) find('.filtered-search-history-clear-button', visible: false).trigger('click') - items_after = all('.filtered-search-history-dropdown-item', visible: false) + items_after = all('.filtered-search-history-dropdown-item', visible: false, count: 0) expect(items_after.count).to eq(0) end -- cgit v1.2.1 From 248319d7f47155845f60c1850509393bf3727669 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 31 Oct 2017 10:50:30 -0500 Subject: remove "command" key from test since it only applies on macOS --- spec/features/projects/pipelines/pipelines_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 46289ee8727..fc689bbb486 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -364,11 +364,11 @@ describe 'Pipelines', :js do find('.js-builds-dropdown-button').click dropdown_item = find('.mini-pipeline-graph-dropdown-item').native - %i(control command alt).each do |command| + %i(alt control).each do |meta_key| page.driver.browser.action - .key_down(:command) + .key_down(meta_key) .click(dropdown_item) - .key_up(:command) + .key_up(meta_key) .perform end -- cgit v1.2.1 From 56e53556c538236a040dcd0e499cc198d66e7cf6 Mon Sep 17 00:00:00 2001 From: Ahmad Sherif Date: Mon, 23 Oct 2017 22:12:11 +0200 Subject: Migrate Gitlab::Git::Wiki#file to Gitaly Closes gitaly#689 --- spec/features/projects/wiki/user_views_wiki_page_spec.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/wiki/user_views_wiki_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_page_spec.rb index 470391dc66b..89f6901eb01 100644 --- a/spec/features/projects/wiki/user_views_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_page_spec.rb @@ -81,10 +81,15 @@ describe 'User views a wiki page' do end it 'shows a file stored in a page' do - file = Gollum::File.new(project.wiki) - - allow_any_instance_of(Gollum::Wiki).to receive(:file).with('image.jpg', 'master').and_return(file) - allow_any_instance_of(Gollum::File).to receive(:mime_type).and_return('image/jpeg') + gollum_file_double = double('Gollum::File', + mime_type: 'image/jpeg', + name: 'images/image.jpg', + path: 'images/image.jpg', + raw_data: '') + wiki_file = Gitlab::Git::WikiFile.new(gollum_file_double) + + allow(wiki_file).to receive(:mime_type).and_return('image/jpeg') + allow_any_instance_of(ProjectWiki).to receive(:find_file).with('image.jpg', nil).and_return(wiki_file) expect(page).to have_xpath('//img[@data-src="image.jpg"]') expect(page).to have_link('image', href: "#{project.wiki.wiki_base_path}/image.jpg") -- cgit v1.2.1 From 376b26b3efa7eb1c76358cc978605fec01bd44c5 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Tue, 31 Oct 2017 17:24:50 -0600 Subject: Added cookie_helper to the upload_file_spec --- spec/features/projects/tree/upload_file_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/tree/upload_file_spec.rb b/spec/features/projects/tree/upload_file_spec.rb index 7dbe4fd0aa5..432739612d8 100644 --- a/spec/features/projects/tree/upload_file_spec.rb +++ b/spec/features/projects/tree/upload_file_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' feature 'Multi-file editor upload file', :js do + include CookieHelper include WaitForRequests let(:user) { create(:user) } @@ -12,7 +13,7 @@ feature 'Multi-file editor upload file', :js do project.add_master(user) sign_in(user) - page.driver.set_cookie('new_repo', 'true') + set_cookie('new_repo', 'true') visit project_tree_path(project, :master) -- cgit v1.2.1 From 9985406a9137dfed1f2e84546d255889165e11ad Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 31 Oct 2017 21:22:42 -0500 Subject: add accept_confirm around "remove" button --- spec/features/variables_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb index 5d8e818f7bf..c78f7d0d9be 100644 --- a/spec/features/variables_spec.rb +++ b/spec/features/variables_spec.rb @@ -82,7 +82,7 @@ describe 'Project variables', :js do it 'deletes variable' do page.within('.variables-table') do - click_on 'Remove' + accept_confirm { click_on 'Remove' } end expect(page).not_to have_selector('variables-table') -- cgit v1.2.1 From 2ea76a4130bb90b105580a1980e0390a0a097f6f Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 1 Nov 2017 09:17:09 -0500 Subject: prevent resolve buttons from being clicked twice triggering a race condition --- spec/features/merge_requests/diff_notes_resolve_spec.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/diff_notes_resolve_spec.rb b/spec/features/merge_requests/diff_notes_resolve_spec.rb index a1a6792d677..15d380b1bf4 100644 --- a/spec/features/merge_requests/diff_notes_resolve_spec.rb +++ b/spec/features/merge_requests/diff_notes_resolve_spec.rb @@ -241,10 +241,8 @@ feature 'Diff notes resolve', :js do end it 'resolves discussion' do - page.all('.note').each do |note| - note.all('.line-resolve-btn').each do |button| - button.click - end + page.all('.note .line-resolve-btn').each do |button| + button.click end expect(page).to have_content('Resolved by') -- cgit v1.2.1 From c2f8eeb490f8ba2c2f9db3eb4cd8960443c694aa Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 1 Nov 2017 09:47:20 -0500 Subject: explicitly check innerText since selenium webdriver only looks at visible text --- spec/features/projects/tree/upload_file_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/projects/tree/upload_file_spec.rb b/spec/features/projects/tree/upload_file_spec.rb index 432739612d8..b7e940eac43 100644 --- a/spec/features/projects/tree/upload_file_spec.rb +++ b/spec/features/projects/tree/upload_file_spec.rb @@ -30,7 +30,7 @@ feature 'Multi-file editor upload file', :js do find('.add-to-tree').click expect(page).to have_selector('.repo-tab', text: 'doc_sample.txt') - expect(page).to have_content(File.open(txt_file, &:readline)) + expect(find('.blob-editor-container .lines-content')['innerText']).to have_content(File.open(txt_file, &:readline)) end it 'uploads image file' do -- cgit v1.2.1 From 0c49b5eb17a35a3b1929e5dc6decf9a1cc7bd910 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Wed, 1 Nov 2017 11:58:11 -0600 Subject: Fix cancel button not working when uploading a file on the new issue page --- spec/features/issues_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/features') diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index d4fd3a50008..9b94452fb0d 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -583,6 +583,16 @@ describe 'Issues' do expect(page.find_field("issue_description").value).not_to match /\n\n$/ end + + it "cancels a file upload correctly" do + dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) + + click_button 'Cancel' + + expect(page).to have_button('Attach a file') + expect(page).not_to have_button('Cancel') + expect(page).not_to have_selector('.uploading-progress-container', visible: true) + end end context 'form filled by URL parameters' do -- cgit v1.2.1 From 53281e09e486acdca8c9ca9adba3bd4d4d50514a Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Wed, 1 Nov 2017 14:33:16 -0500 Subject: add slow_requests! to filtered search tests which expect to see a loading spinner --- spec/features/issues/filtered_search/dropdown_assignee_spec.rb | 2 ++ spec/features/issues/filtered_search/dropdown_author_spec.rb | 2 ++ spec/features/issues/filtered_search/dropdown_emoji_spec.rb | 2 ++ spec/features/issues/filtered_search/dropdown_label_spec.rb | 2 ++ spec/features/issues/filtered_search/dropdown_milestone_spec.rb | 2 ++ 5 files changed, 10 insertions(+) (limited to 'spec/features') diff --git a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb index 550a778bda1..9fa26327d7e 100644 --- a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb @@ -43,9 +43,11 @@ describe 'Dropdown assignee', :js do end it 'should show loading indicator when opened' do + Gitlab::Testing::RequestBlockerMiddleware.slow_requests! filtered_search.set('assignee:') expect(page).to have_css('#js-dropdown-assignee .filter-dropdown-loading', visible: true) + Gitlab::Testing::RequestBlockerMiddleware.allow_requests! end it 'should hide loading indicator when loaded' do diff --git a/spec/features/issues/filtered_search/dropdown_author_spec.rb b/spec/features/issues/filtered_search/dropdown_author_spec.rb index 5e20fb48768..305b6830faa 100644 --- a/spec/features/issues/filtered_search/dropdown_author_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_author_spec.rb @@ -51,9 +51,11 @@ describe 'Dropdown author', :js do end it 'should show loading indicator when opened' do + Gitlab::Testing::RequestBlockerMiddleware.slow_requests! filtered_search.set('author:') expect(page).to have_css('#js-dropdown-author .filter-dropdown-loading', visible: true) + Gitlab::Testing::RequestBlockerMiddleware.allow_requests! end it 'should hide loading indicator when loaded' do diff --git a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb index 3012c77f2b9..f502219484f 100644 --- a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb @@ -70,9 +70,11 @@ describe 'Dropdown emoji', :js do end it 'should show loading indicator when opened' do + Gitlab::Testing::RequestBlockerMiddleware.slow_requests! filtered_search.set('my-reaction:') expect(page).to have_css('#js-dropdown-my-reaction .filter-dropdown-loading', visible: true) + Gitlab::Testing::RequestBlockerMiddleware.allow_requests! end it 'should hide loading indicator when loaded' do diff --git a/spec/features/issues/filtered_search/dropdown_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb index 40a59f834ba..223f6e9de16 100644 --- a/spec/features/issues/filtered_search/dropdown_label_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_label_spec.rb @@ -66,10 +66,12 @@ describe 'Dropdown label', :js do end it 'shows loading indicator when opened and hides it when loaded' do + Gitlab::Testing::RequestBlockerMiddleware.slow_requests! filtered_search.set('label:') expect(page).to have_css("#{js_dropdown_label} .filter-dropdown-loading", visible: true) expect(find(js_dropdown_label)).not_to have_css('.filter-dropdown-loading') + Gitlab::Testing::RequestBlockerMiddleware.allow_requests! end it 'loads all the labels when opened' do diff --git a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb index 8536686e611..4a531b8d568 100644 --- a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb @@ -50,9 +50,11 @@ describe 'Dropdown milestone', :js do end it 'should show loading indicator when opened' do + Gitlab::Testing::RequestBlockerMiddleware.slow_requests! filtered_search.set('milestone:') expect(page).to have_css('#js-dropdown-milestone .filter-dropdown-loading', visible: true) + Gitlab::Testing::RequestBlockerMiddleware.allow_requests! end it 'should hide loading indicator when loaded' do -- cgit v1.2.1 From 294fa6fcdcfa7d76bc97b754d2930f3686f54997 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 12 Oct 2017 11:01:12 +0200 Subject: Remove authentication using user.private_token --- spec/features/atom/dashboard_issues_spec.rb | 6 ++++-- spec/features/atom/dashboard_spec.rb | 6 ++++-- spec/features/atom/issues_spec.rb | 6 ++++-- spec/features/atom/users_spec.rb | 6 ++++-- spec/features/profile_spec.rb | 14 -------------- 5 files changed, 16 insertions(+), 22 deletions(-) (limited to 'spec/features') diff --git a/spec/features/atom/dashboard_issues_spec.rb b/spec/features/atom/dashboard_issues_spec.rb index 5aae2dbaf91..89c9d377003 100644 --- a/spec/features/atom/dashboard_issues_spec.rb +++ b/spec/features/atom/dashboard_issues_spec.rb @@ -13,8 +13,10 @@ describe "Dashboard Issues Feed" do end describe "atom feed" do - it "renders atom feed via private token" do - visit issues_dashboard_path(:atom, private_token: user.private_token) + it "renders atom feed via personal access token" do + personal_access_token = create(:personal_access_token, user: user) + + visit issues_dashboard_path(:atom, private_token: personal_access_token.token) expect(response_headers['Content-Type']).to have_content('application/atom+xml') expect(body).to have_selector('title', text: "#{user.name} issues") diff --git a/spec/features/atom/dashboard_spec.rb b/spec/features/atom/dashboard_spec.rb index 321c8a2a670..2c0c331b6db 100644 --- a/spec/features/atom/dashboard_spec.rb +++ b/spec/features/atom/dashboard_spec.rb @@ -4,9 +4,11 @@ describe "Dashboard Feed" do describe "GET /" do let!(:user) { create(:user, name: "Jonh") } - context "projects atom feed via private token" do + context "projects atom feed via personal access token" do it "renders projects atom feed" do - visit dashboard_projects_path(:atom, private_token: user.private_token) + personal_access_token = create(:personal_access_token, user: user) + + visit dashboard_projects_path(:atom, private_token: personal_access_token.token) expect(body).to have_selector('feed title') end end diff --git a/spec/features/atom/issues_spec.rb b/spec/features/atom/issues_spec.rb index 3eeb4d35131..4102ac0588a 100644 --- a/spec/features/atom/issues_spec.rb +++ b/spec/features/atom/issues_spec.rb @@ -28,10 +28,12 @@ describe 'Issues Feed' do end end - context 'when authenticated via private token' do + context 'when authenticated via personal access token' do it 'renders atom feed' do + personal_access_token = create(:personal_access_token, user: user) + visit project_issues_path(project, :atom, - private_token: user.private_token) + private_token: personal_access_token.token) expect(response_headers['Content-Type']) .to have_content('application/atom+xml') diff --git a/spec/features/atom/users_spec.rb b/spec/features/atom/users_spec.rb index 9ce687afb31..2b934d81674 100644 --- a/spec/features/atom/users_spec.rb +++ b/spec/features/atom/users_spec.rb @@ -4,9 +4,11 @@ describe "User Feed" do describe "GET /" do let!(:user) { create(:user) } - context 'user atom feed via private token' do + context 'user atom feed via personal access token' do it "renders user atom feed" do - visit user_path(user, :atom, private_token: user.private_token) + personal_access_token = create(:personal_access_token, user: user) + + visit user_path(user, :atom, private_token: personal_access_token.token) expect(body).to have_selector('feed title') end end diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index 1cddd35fd8a..e05853110fe 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -56,20 +56,6 @@ describe 'Profile account page' do end end - describe 'when I reset private token' do - before do - visit profile_account_path - end - - it 'resets private token' do - previous_token = find("#private-token").value - - click_link('Reset private token') - - expect(find('#private-token').value).not_to eq(previous_token) - end - end - describe 'when I reset RSS token' do before do visit profile_account_path -- cgit v1.2.1 From a6c462b28c920704661463b562dabbf9b8cb1b17 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 12 Oct 2017 16:17:54 +0200 Subject: Move RSS and incoming email tokens from User Settings > Accounts to User Settings > Access Tokens --- spec/features/profile_spec.rb | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'spec/features') diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index e05853110fe..0166ab8be99 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'Profile account page' do +describe 'Profile account page', :js do let(:user) { create(:user) } before do @@ -58,31 +58,36 @@ describe 'Profile account page' do describe 'when I reset RSS token' do before do - visit profile_account_path + visit profile_personal_access_tokens_path end it 'resets RSS token' do - previous_token = find("#rss-token").value + within('.rss-token-reset') do + previous_token = find("#rss_token").value + + click_link('reset it') - click_link('Reset RSS token') + expect(find('#rss_token').value).not_to eq(previous_token) + end expect(page).to have_content 'RSS token was successfully reset' - expect(find('#rss-token').value).not_to eq(previous_token) end end describe 'when I reset incoming email token' do before do allow(Gitlab.config.incoming_email).to receive(:enabled).and_return(true) - visit profile_account_path + visit profile_personal_access_tokens_path end it 'resets incoming email token' do - previous_token = find('#incoming-email-token').value + within('.incoming-email-token-reset') do + previous_token = find('#incoming_email_token').value - click_link('Reset incoming email token') + click_link('reset it') - expect(find('#incoming-email-token').value).not_to eq(previous_token) + expect(find('#incoming_email_token').value).not_to eq(previous_token) + end end end -- cgit v1.2.1 From 61865cfc935d760374c5bf6f8c538b3282b91e8b Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Nov 2017 10:26:09 -0500 Subject: add CookieHelper and InputHelper automatically to :js tests --- spec/features/boards/boards_spec.rb | 1 - spec/features/issues/filtered_search/visual_tokens_spec.rb | 2 -- spec/features/issues/gfm_autocomplete_spec.rb | 2 -- spec/features/merge_requests/diff_notes_avatars_spec.rb | 1 - spec/features/merge_requests/user_posts_diff_notes_spec.rb | 1 - spec/features/projects/ref_switcher_spec.rb | 2 -- spec/features/projects/tree/create_directory_spec.rb | 3 --- spec/features/projects/tree/create_file_spec.rb | 3 --- spec/features/projects/tree/upload_file_spec.rb | 3 --- 9 files changed, 18 deletions(-) (limited to 'spec/features') diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 49eecb34aaa..f91c9b66986 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -1,7 +1,6 @@ require 'rails_helper' describe 'Issue Boards', :js do - include CookieHelper include DragTo let(:group) { create(:group, :nested) } diff --git a/spec/features/issues/filtered_search/visual_tokens_spec.rb b/spec/features/issues/filtered_search/visual_tokens_spec.rb index 9d7d8f8ebff..0ae70c855db 100644 --- a/spec/features/issues/filtered_search/visual_tokens_spec.rb +++ b/spec/features/issues/filtered_search/visual_tokens_spec.rb @@ -1,9 +1,7 @@ require 'rails_helper' describe 'Visual tokens', :js do - include CookieHelper include FilteredSearchHelpers - include WaitForRequests let!(:project) { create(:project) } let!(:user) { create(:user, name: 'administrator', username: 'root') } diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index ac75b1fcdba..a04042a8c85 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -1,8 +1,6 @@ require 'rails_helper' feature 'GFM autocomplete', :js do - include InputHelper - let(:user) { create(:user, name: '💃speciąl someone💃', username: 'someone.special') } let(:project) { create(:project) } let(:label) { create(:label, project: project, title: 'special+') } diff --git a/spec/features/merge_requests/diff_notes_avatars_spec.rb b/spec/features/merge_requests/diff_notes_avatars_spec.rb index e28eb463199..9e816cf041b 100644 --- a/spec/features/merge_requests/diff_notes_avatars_spec.rb +++ b/spec/features/merge_requests/diff_notes_avatars_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper' feature 'Diff note avatars', :js do - include CookieHelper include NoteInteractionHelpers let(:user) { create(:user) } diff --git a/spec/features/merge_requests/user_posts_diff_notes_spec.rb b/spec/features/merge_requests/user_posts_diff_notes_spec.rb index cf62f042b90..d44eb23d7f4 100644 --- a/spec/features/merge_requests/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_requests/user_posts_diff_notes_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper' feature 'Merge requests > User posts diff notes', :js do - include CookieHelper include MergeRequestDiffHelpers let(:user) { create(:user) } diff --git a/spec/features/projects/ref_switcher_spec.rb b/spec/features/projects/ref_switcher_spec.rb index 44b70b7b52a..33ccbc1a29f 100644 --- a/spec/features/projects/ref_switcher_spec.rb +++ b/spec/features/projects/ref_switcher_spec.rb @@ -1,8 +1,6 @@ require 'rails_helper' feature 'Ref switcher', :js do - include CookieHelper - let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } diff --git a/spec/features/projects/tree/create_directory_spec.rb b/spec/features/projects/tree/create_directory_spec.rb index 174d4cb4e08..8ee7b9cf015 100644 --- a/spec/features/projects/tree/create_directory_spec.rb +++ b/spec/features/projects/tree/create_directory_spec.rb @@ -1,9 +1,6 @@ require 'spec_helper' feature 'Multi-file editor new directory', :js do - include CookieHelper - include WaitForRequests - let(:user) { create(:user) } let(:project) { create(:project, :repository) } diff --git a/spec/features/projects/tree/create_file_spec.rb b/spec/features/projects/tree/create_file_spec.rb index 7eea81d1e8d..1e2de0711b8 100644 --- a/spec/features/projects/tree/create_file_spec.rb +++ b/spec/features/projects/tree/create_file_spec.rb @@ -1,9 +1,6 @@ require 'spec_helper' feature 'Multi-file editor new file', :js do - include CookieHelper - include WaitForRequests - let(:user) { create(:user) } let(:project) { create(:project, :repository) } diff --git a/spec/features/projects/tree/upload_file_spec.rb b/spec/features/projects/tree/upload_file_spec.rb index b7e940eac43..8439bb5a69e 100644 --- a/spec/features/projects/tree/upload_file_spec.rb +++ b/spec/features/projects/tree/upload_file_spec.rb @@ -1,9 +1,6 @@ require 'spec_helper' feature 'Multi-file editor upload file', :js do - include CookieHelper - include WaitForRequests - let(:user) { create(:user) } let(:project) { create(:project, :repository) } let(:txt_file) { File.join(Rails.root, 'spec', 'fixtures', 'doc_sample.txt') } -- cgit v1.2.1 From b5d5da7b6f2076bbd72d929ae84dbd00582ff365 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Nov 2017 10:27:15 -0500 Subject: add InspectRequests helper automatically to :js tests --- spec/features/projects/environments/environment_spec.rb | 2 -- spec/features/projects/jobs_spec.rb | 2 -- spec/features/snippets/user_creates_snippet_spec.rb | 1 - 3 files changed, 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index e0fc60e45ae..5fc3ba54f65 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -1,8 +1,6 @@ require 'spec_helper' feature 'Environment' do - include InspectRequests - given(:project) { create(:project) } given(:user) { create(:user) } given(:role) { :developer } diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 5e1d81184b5..c2a0d2395a9 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -2,8 +2,6 @@ require 'spec_helper' require 'tempfile' feature 'Jobs' do - include InspectRequests - let(:user) { create(:user) } let(:user_access_level) { :developer } let(:project) { create(:project, :repository) } diff --git a/spec/features/snippets/user_creates_snippet_spec.rb b/spec/features/snippets/user_creates_snippet_spec.rb index 5020eb7d137..941765b7578 100644 --- a/spec/features/snippets/user_creates_snippet_spec.rb +++ b/spec/features/snippets/user_creates_snippet_spec.rb @@ -2,7 +2,6 @@ require 'rails_helper' feature 'User creates snippet', :js do include DropzoneHelper - include InspectRequests let(:user) { create(:user) } -- cgit v1.2.1 From b2932eb576427abcf6a9f71b1a1a5ef057b22eb8 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Nov 2017 13:54:05 -0500 Subject: add visible argument to helper rather than duplicating code --- spec/features/calendar_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/features') diff --git a/spec/features/calendar_spec.rb b/spec/features/calendar_spec.rb index 9143a417bec..a9530becb65 100644 --- a/spec/features/calendar_spec.rb +++ b/spec/features/calendar_spec.rb @@ -63,8 +63,8 @@ feature 'Contributions Calendar', :js do Event.create(note_comment_params) end - def selected_day_activities - find('.user-calendar-activities').text + def selected_day_activities(visible: true) + find('.user-calendar-activities', visible: visible).text end before do @@ -112,7 +112,7 @@ feature 'Contributions Calendar', :js do end it 'hides calendar day activities' do - expect(find('.user-calendar-activities', visible: false).text).to be_empty + expect(selected_day_activities(visible: false)).to be_empty end end end -- cgit v1.2.1 From 082b5954481abd041697add96619b6b5eb821250 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Nov 2017 13:54:36 -0500 Subject: explicitly add Accept: */* HTTP header back to test --- spec/features/merge_requests/diffs_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/diffs_spec.rb b/spec/features/merge_requests/diffs_spec.rb index d56149173a1..1bf77296ae6 100644 --- a/spec/features/merge_requests/diffs_spec.rb +++ b/spec/features/merge_requests/diffs_spec.rb @@ -10,7 +10,9 @@ feature 'Diffs URL', :js do it 'renders the notes' do create :note_on_merge_request, project: project, noteable: merge_request, note: 'Rebasing with master' - visit diffs_project_merge_request_path(project, merge_request) + inspect_requests(inject_headers: { 'Accept' => '*/*' }) do + visit diffs_project_merge_request_path(project, merge_request) + end # Load notes and diff through AJAX expect(page).to have_css('.note-text', visible: false, text: 'Rebasing with master') -- cgit v1.2.1 From f31bb83d8f6d3a9bc4589aeeec1524ff07d0c156 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Nov 2017 14:04:27 -0500 Subject: remove out-of-date comments about webdriver compatability --- spec/features/projects/branches_spec.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb index 2f712341a59..7a77df83034 100644 --- a/spec/features/projects/branches_spec.rb +++ b/spec/features/projects/branches_spec.rb @@ -67,11 +67,7 @@ describe 'Branches' do expect(page).to have_content('fix') expect(find('.all-branches')).to have_selector('li', count: 1) - # To work with Chrome headless, this needs an updated version of - # Capybara with two bug fixes: - # * https://github.com/teamcapybara/capybara/pull/1902/ - # * https://github.com/teamcapybara/capybara/pull/1903/ - accept_alert { find('.js-branch-fix .btn-remove').click } + accept_confirm { find('.js-branch-fix .btn-remove').click } expect(page).not_to have_content('fix') expect(find('.all-branches')).to have_selector('li', count: 0) -- cgit v1.2.1 From 351645fb1436ffa6b9d24dfabc8519805c56550b Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Nov 2017 14:41:48 -0500 Subject: scroll to top before attempting to click the "Side-by-side" button --- spec/features/projects/merge_requests/user_comments_on_diff_spec.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb b/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb index 62f776375c9..e3f90a78cb5 100644 --- a/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb +++ b/spec/features/projects/merge_requests/user_comments_on_diff_spec.rb @@ -90,9 +90,8 @@ describe 'User comments on a diff', :js do end # Check the same comments in the side-by-side view. - page.execute_script( - "document.querySelector('#parallel-diff-btn').click()" - ) + execute_script("window.scrollTo(0,0);") + click_link('Side-by-side') wait_for_requests -- cgit v1.2.1 From 187a4f6c81ab83945580a45ffe7a9e1bdcb1f192 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Nov 2017 14:56:10 -0500 Subject: target label instead of obscured input element --- spec/features/projects_spec.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'spec/features') diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb index d7e46f3525f..63e6051b571 100644 --- a/spec/features/projects_spec.rb +++ b/spec/features/projects_spec.rb @@ -14,9 +14,7 @@ feature 'Project' do it "allows creation from templates", :js do find('#create-from-template-tab').click - page.execute_script( - "document.querySelector('##{template.name}').click()" - ) + find("label[for=#{template.name}]").click fill_in("project_path", with: template.name) page.within '#content-body' do -- cgit v1.2.1 From ed3b23fec9f030fe7868c70265324a732bf34fe9 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Nov 2017 15:34:30 -0500 Subject: refactor wait_for_requests, add slow_requests block helper --- .../filtered_search/dropdown_assignee_spec.rb | 8 ++--- .../issues/filtered_search/dropdown_author_spec.rb | 8 ++--- .../issues/filtered_search/dropdown_emoji_spec.rb | 8 ++--- .../issues/filtered_search/dropdown_label_spec.rb | 8 ++--- .../filtered_search/dropdown_milestone_spec.rb | 8 ++--- spec/features/projects/user_browses_files_spec.rb | 2 +- .../uploads/user_uploads_file_to_note_spec.rb | 34 +++++++++------------- 7 files changed, 34 insertions(+), 42 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb index 9fa26327d7e..2e4a25ee15d 100644 --- a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb @@ -43,11 +43,11 @@ describe 'Dropdown assignee', :js do end it 'should show loading indicator when opened' do - Gitlab::Testing::RequestBlockerMiddleware.slow_requests! - filtered_search.set('assignee:') + slow_requests do + filtered_search.set('assignee:') - expect(page).to have_css('#js-dropdown-assignee .filter-dropdown-loading', visible: true) - Gitlab::Testing::RequestBlockerMiddleware.allow_requests! + expect(page).to have_css('#js-dropdown-assignee .filter-dropdown-loading', visible: true) + end end it 'should hide loading indicator when loaded' do diff --git a/spec/features/issues/filtered_search/dropdown_author_spec.rb b/spec/features/issues/filtered_search/dropdown_author_spec.rb index 305b6830faa..2fb5e7cdba4 100644 --- a/spec/features/issues/filtered_search/dropdown_author_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_author_spec.rb @@ -51,11 +51,11 @@ describe 'Dropdown author', :js do end it 'should show loading indicator when opened' do - Gitlab::Testing::RequestBlockerMiddleware.slow_requests! - filtered_search.set('author:') + slow_requests do + filtered_search.set('author:') - expect(page).to have_css('#js-dropdown-author .filter-dropdown-loading', visible: true) - Gitlab::Testing::RequestBlockerMiddleware.allow_requests! + expect(page).to have_css('#js-dropdown-author .filter-dropdown-loading', visible: true) + end end it 'should hide loading indicator when loaded' do diff --git a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb index f502219484f..8db435634fd 100644 --- a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb @@ -70,11 +70,11 @@ describe 'Dropdown emoji', :js do end it 'should show loading indicator when opened' do - Gitlab::Testing::RequestBlockerMiddleware.slow_requests! - filtered_search.set('my-reaction:') + slow_requests do + filtered_search.set('my-reaction:') - expect(page).to have_css('#js-dropdown-my-reaction .filter-dropdown-loading', visible: true) - Gitlab::Testing::RequestBlockerMiddleware.allow_requests! + expect(page).to have_css('#js-dropdown-my-reaction .filter-dropdown-loading', visible: true) + end end it 'should hide loading indicator when loaded' do diff --git a/spec/features/issues/filtered_search/dropdown_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb index 223f6e9de16..18cdb199c70 100644 --- a/spec/features/issues/filtered_search/dropdown_label_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_label_spec.rb @@ -66,12 +66,12 @@ describe 'Dropdown label', :js do end it 'shows loading indicator when opened and hides it when loaded' do - Gitlab::Testing::RequestBlockerMiddleware.slow_requests! - filtered_search.set('label:') + slow_requests do + filtered_search.set('label:') - expect(page).to have_css("#{js_dropdown_label} .filter-dropdown-loading", visible: true) + expect(page).to have_css("#{js_dropdown_label} .filter-dropdown-loading", visible: true) + end expect(find(js_dropdown_label)).not_to have_css('.filter-dropdown-loading') - Gitlab::Testing::RequestBlockerMiddleware.allow_requests! end it 'loads all the labels when opened' do diff --git a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb index 4a531b8d568..031eb06723a 100644 --- a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb @@ -50,11 +50,11 @@ describe 'Dropdown milestone', :js do end it 'should show loading indicator when opened' do - Gitlab::Testing::RequestBlockerMiddleware.slow_requests! - filtered_search.set('milestone:') + slow_requests do + filtered_search.set('milestone:') - expect(page).to have_css('#js-dropdown-milestone .filter-dropdown-loading', visible: true) - Gitlab::Testing::RequestBlockerMiddleware.allow_requests! + expect(page).to have_css('#js-dropdown-milestone .filter-dropdown-loading', visible: true) + end end it 'should hide loading indicator when loaded' do diff --git a/spec/features/projects/user_browses_files_spec.rb b/spec/features/projects/user_browses_files_spec.rb index 1d7c8a731f0..f5e4d7f5130 100644 --- a/spec/features/projects/user_browses_files_spec.rb +++ b/spec/features/projects/user_browses_files_spec.rb @@ -179,7 +179,7 @@ describe 'User browses files' do click_button('Upload file') end - block_and_wait_for_requests_complete + wait_for_all_requests visit(project_blob_path(project, 'new_branch_name/logo_sample.svg')) diff --git a/spec/features/uploads/user_uploads_file_to_note_spec.rb b/spec/features/uploads/user_uploads_file_to_note_spec.rb index 47b89d262f3..972c10aaf23 100644 --- a/spec/features/uploads/user_uploads_file_to_note_spec.rb +++ b/spec/features/uploads/user_uploads_file_to_note_spec.rb @@ -21,24 +21,12 @@ feature 'User uploads file to note' do end context 'uploading is in progress' do - before do - Gitlab::Testing::RequestBlockerMiddleware.slow_requests! - end - - after do - Gitlab::Testing::RequestBlockerMiddleware.allow_requests! - end - - it 'shows "Cancel" button on uploading', :js do - dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) - - expect(page).to have_button('Cancel') - end - it 'cancels uploading on clicking to "Cancel" button', :js do - dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) + slow_requests do + dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) - click_button 'Cancel' + click_button 'Cancel' + end expect(page).to have_button('Attach a file') expect(page).not_to have_button('Cancel') @@ -46,16 +34,20 @@ feature 'User uploads file to note' do end it 'shows "Attaching a file" message on uploading 1 file', :js do - dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) + slow_requests do + dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) - expect(page).to have_selector('.attaching-file-message', visible: true, text: 'Attaching a file -') + expect(page).to have_selector('.attaching-file-message', visible: true, text: 'Attaching a file -') + end end it 'shows "Attaching 2 files" message on uploading 2 file', :js do - dropzone_file([Rails.root.join('spec', 'fixtures', 'video_sample.mp4'), - Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) + slow_requests do + dropzone_file([Rails.root.join('spec', 'fixtures', 'video_sample.mp4'), + Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) - expect(page).to have_selector('.attaching-file-message', visible: true, text: 'Attaching 2 files -') + expect(page).to have_selector('.attaching-file-message', visible: true, text: 'Attaching 2 files -') + end end it 'shows error message, "retry" and "attach a new file" link a if file is too big', :js do -- cgit v1.2.1 From 2b29a4675bbaf79ed463e5ffc059e81aeb3251a8 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Thu, 2 Nov 2017 15:45:46 -0500 Subject: use resize_window helper --- spec/features/boards/boards_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index f91c9b66986..e8d779f5772 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -2,6 +2,7 @@ require 'rails_helper' describe 'Issue Boards', :js do include DragTo + include MobileHelpers let(:group) { create(:group, :nested) } let(:project) { create(:project, :public, namespace: group) } @@ -564,7 +565,7 @@ describe 'Issue Boards', :js do def drag(selector: '.board-list', list_from_index: 0, from_index: 0, to_index: 0, list_to_index: 0) # ensure there is enough horizontal space for four boards - page.current_window.resize_to(2000, 800) + resize_window(2000, 800) drag_to(selector: selector, scrollable: '#board-app', -- cgit v1.2.1 From 55bd24ab4f1910f4cb76e28e3cc674c67c6cf191 Mon Sep 17 00:00:00 2001 From: Victor Wu Date: Fri, 3 Nov 2017 00:01:56 +0000 Subject: Resolve ""To do" should be "Todos" on Todos list page" --- spec/features/dashboard/todos/todos_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'spec/features') diff --git a/spec/features/dashboard/todos/todos_spec.rb b/spec/features/dashboard/todos/todos_spec.rb index 01aca443f4a..39ac68af493 100644 --- a/spec/features/dashboard/todos/todos_spec.rb +++ b/spec/features/dashboard/todos/todos_spec.rb @@ -52,7 +52,7 @@ feature 'Dashboard Todos' do end it 'updates todo count' do - expect(page).to have_content 'To do 0' + expect(page).to have_content 'Todos 0' expect(page).to have_content 'Done 1' end @@ -81,7 +81,7 @@ feature 'Dashboard Todos' do end it 'updates todo count' do - expect(page).to have_content 'To do 1' + expect(page).to have_content 'Todos 1' expect(page).to have_content 'Done 0' end end @@ -200,7 +200,7 @@ feature 'Dashboard Todos' do end it 'updates todo count' do - expect(page).to have_content 'To do 1' + expect(page).to have_content 'Todos 1' expect(page).to have_content 'Done 0' end end @@ -256,7 +256,7 @@ feature 'Dashboard Todos' do end it 'shows "All done" message!' do - expect(page).to have_content 'To do 0' + expect(page).to have_content 'Todos 0' expect(page).to have_content "You're all done!" expect(page).not_to have_selector('.gl-pagination') end @@ -283,7 +283,7 @@ feature 'Dashboard Todos' do it 'updates todo count' do mark_all_and_undo - expect(page).to have_content 'To do 2' + expect(page).to have_content 'Todos 2' expect(page).to have_content 'Done 0' end -- cgit v1.2.1 From 39d00bddc494c7f13527887e005b53431642d24c Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Fri, 3 Nov 2017 11:08:36 +0100 Subject: Make sure the settings page renders when root of a fork is deleted --- .../settings/forked_project_settings_spec.rb | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 spec/features/projects/settings/forked_project_settings_spec.rb (limited to 'spec/features') diff --git a/spec/features/projects/settings/forked_project_settings_spec.rb b/spec/features/projects/settings/forked_project_settings_spec.rb new file mode 100644 index 00000000000..28954a4fb40 --- /dev/null +++ b/spec/features/projects/settings/forked_project_settings_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +feature 'Settings for a forked project', :js do + include ProjectForksHelper + let(:user) { create(:user) } + let(:original_project) { create(:project) } + let(:forked_project) { fork_project(original_project, user) } + + before do + original_project.add_master(user) + forked_project.add_master(user) + sign_in(user) + end + + shared_examples 'project settings for a forked projects' do + it 'allows deleting the link to the forked project' do + visit edit_project_path(forked_project) + + click_button 'Remove fork relationship' + + wait_for_requests + + fill_in('confirm_name_input', with: forked_project.name) + click_button('Confirm') + + expect(page).to have_content('The fork relationship has been removed.') + expect(forked_project.reload.forked?).to be_falsy + end + end + + it_behaves_like 'project settings for a forked projects' + + context 'when the original project is deleted' do + before do + original_project.destroy! + end + + it_behaves_like 'project settings for a forked projects' + end +end -- cgit v1.2.1 From 3e1168a14c60eb0a3859cc21ae4f44015bba687d Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 3 Nov 2017 11:02:57 -0500 Subject: confirm javascript modal when resetting email tokens --- spec/features/profile_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index 0166ab8be99..c60883911f7 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -65,7 +65,7 @@ describe 'Profile account page', :js do within('.rss-token-reset') do previous_token = find("#rss_token").value - click_link('reset it') + accept_confirm { click_link('reset it') } expect(find('#rss_token').value).not_to eq(previous_token) end @@ -84,7 +84,7 @@ describe 'Profile account page', :js do within('.incoming-email-token-reset') do previous_token = find('#incoming_email_token').value - click_link('reset it') + accept_confirm { click_link('reset it') } expect(find('#incoming_email_token').value).not_to eq(previous_token) end -- cgit v1.2.1 From 442248104c979afaa9b23512141602a9f77da871 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 3 Nov 2017 11:03:22 -0500 Subject: prevent race condition when attempting to cancel a file upload --- spec/features/issues_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index a5c24b362a2..b9af77f918a 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -585,9 +585,11 @@ describe 'Issues' do end it "cancels a file upload correctly" do - dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) + slow_requests do + dropzone_file([Rails.root.join('spec', 'fixtures', 'dk.png')], 0, false) - click_button 'Cancel' + click_button 'Cancel' + end expect(page).to have_button('Attach a file') expect(page).not_to have_button('Cancel') -- cgit v1.2.1 From 43b5bf26c003345d3281762b748f942b53ddce8a Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 3 Nov 2017 11:07:38 -0500 Subject: replace use of unsupported trigger method with click --- spec/features/merge_requests/mini_pipeline_graph_spec.rb | 2 +- spec/features/projects/commit/mini_pipeline_graph_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_requests/mini_pipeline_graph_spec.rb b/spec/features/merge_requests/mini_pipeline_graph_spec.rb index bd47599c2f9..bac56270362 100644 --- a/spec/features/merge_requests/mini_pipeline_graph_spec.rb +++ b/spec/features/merge_requests/mini_pipeline_graph_spec.rb @@ -83,7 +83,7 @@ feature 'Mini Pipeline Graph', :js do end before do - toggle.trigger('click') + toggle.click wait_for_requests end diff --git a/spec/features/projects/commit/mini_pipeline_graph_spec.rb b/spec/features/projects/commit/mini_pipeline_graph_spec.rb index 6f6d562c7b6..807a2189cc4 100644 --- a/spec/features/projects/commit/mini_pipeline_graph_spec.rb +++ b/spec/features/projects/commit/mini_pipeline_graph_spec.rb @@ -18,7 +18,7 @@ feature 'Mini Pipeline Graph in Commit View', :js do expect(page).to have_selector('.mr-widget-pipeline-graph') - first('.mini-pipeline-graph-dropdown-toggle').trigger('click') + first('.mini-pipeline-graph-dropdown-toggle').click wait_for_requests -- cgit v1.2.1 From ae76937bc60e44404bb26cb3f45cbad88194c5c9 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 3 Nov 2017 11:25:28 -0500 Subject: don't attempt to click on hidden elements --- spec/features/issues/filtered_search/recent_searches_spec.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/filtered_search/recent_searches_spec.rb b/spec/features/issues/filtered_search/recent_searches_spec.rb index 86f90e51d6b..f355cec3ba9 100644 --- a/spec/features/issues/filtered_search/recent_searches_spec.rb +++ b/spec/features/issues/filtered_search/recent_searches_spec.rb @@ -76,7 +76,8 @@ describe 'Recent searches', :js do set_recent_searches(project_1_local_storage_key, '["foo", "bar"]') visit project_issues_path(project_1) - all('.filtered-search-history-dropdown-item', visible: false, count: 2)[0].click + find('.filtered-search-history-dropdown-toggle-button').click + all('.filtered-search-history-dropdown-item', count: 2)[0].click wait_for_filtered_search('foo') expect(find('.filtered-search').value.strip).to eq('foo') @@ -86,10 +87,11 @@ describe 'Recent searches', :js do set_recent_searches(project_1_local_storage_key, '["foo"]') visit project_issues_path(project_1) - all('.filtered-search-history-dropdown-item', visible: false, count: 1) + find('.filtered-search-history-dropdown-toggle-button').click + all('.filtered-search-history-dropdown-item', count: 1) - find('.filtered-search-history-clear-button', visible: false).click - items_after = all('.filtered-search-history-dropdown-item', visible: false, count: 0) + find('.filtered-search-history-clear-button').click + items_after = all('.filtered-search-history-dropdown-item', count: 0) expect(items_after.count).to eq(0) end -- cgit v1.2.1 From 817c7fb1b0cbd0d008706e060c4cecd0401b5f0c Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 3 Nov 2017 13:51:49 -0500 Subject: fix flaky test in gfm_autocomplete_spec.rb --- spec/features/issues/gfm_autocomplete_spec.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'spec/features') diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index a04042a8c85..1fcf11bf4a6 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -183,7 +183,6 @@ feature 'GFM autocomplete', :js do page.within '.timeline-content-form' do note.native.send_keys('') note.native.send_keys("@#{user.username[0]}") - note.click end user_item = find('.atwho-view li', text: user.username) -- cgit v1.2.1 From cc00b289f9c466a9e4aa711a16ab8758b9e6656f Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 3 Nov 2017 15:26:17 -0500 Subject: fix flaky tests by removing unneeded clicks and focus actions --- spec/features/issues/gfm_autocomplete_spec.rb | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'spec/features') diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 1fcf11bf4a6..b8a66245153 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -28,7 +28,6 @@ feature 'GFM autocomplete', :js do it 'opens autocomplete menu when field starts with text' do page.within '.timeline-content-form' do - find('#note-body').native.send_keys('') find('#note-body').native.send_keys('@') end @@ -46,7 +45,6 @@ feature 'GFM autocomplete', :js do it 'doesnt select the first item for non-assignee dropdowns' do page.within '.timeline-content-form' do - find('#note-body').native.send_keys('') find('#note-body').native.send_keys(':') end @@ -86,7 +84,6 @@ feature 'GFM autocomplete', :js do it 'selects the first item for assignee dropdowns' do page.within '.timeline-content-form' do - find('#note-body').native.send_keys('') find('#note-body').native.send_keys('@') end @@ -112,7 +109,6 @@ feature 'GFM autocomplete', :js do it 'selects the first item for non-assignee dropdowns if a query is entered' do page.within '.timeline-content-form' do - find('#note-body').native.send_keys('') find('#note-body').native.send_keys(':1') end @@ -127,9 +123,8 @@ feature 'GFM autocomplete', :js do it 'wraps the result in double quotes' do note = find('#note-body') page.within '.timeline-content-form' do - note.native.send_keys('') + find('#note-body').native.send_keys('') simulate_input('#note-body', "~#{label.title[0]}") - note.click end label_item = find('.atwho-view li', text: label.title) @@ -152,16 +147,13 @@ feature 'GFM autocomplete', :js do it "does not show dropdown when preceded with a special character" do note = find('#note-body') page.within '.timeline-content-form' do - note.native.send_keys('') note.native.send_keys("@") - note.click end expect(page).to have_selector('.atwho-container') page.within '.timeline-content-form' do note.native.send_keys("@") - note.click end expect(page).to have_selector('.atwho-container', visible: false) @@ -170,9 +162,7 @@ feature 'GFM autocomplete', :js do it "does not throw an error if no labels exist" do note = find('#note-body') page.within '.timeline-content-form' do - note.native.send_keys('') note.native.send_keys('~') - note.click end expect(page).to have_selector('.atwho-container', visible: false) @@ -181,7 +171,6 @@ feature 'GFM autocomplete', :js do it 'doesn\'t wrap for assignee values' do note = find('#note-body') page.within '.timeline-content-form' do - note.native.send_keys('') note.native.send_keys("@#{user.username[0]}") end @@ -193,9 +182,7 @@ feature 'GFM autocomplete', :js do it 'doesn\'t wrap for emoji values' do note = find('#note-body') page.within '.timeline-content-form' do - note.native.send_keys('') note.native.send_keys(":cartwheel_") - note.click end emoji_item = find('.atwho-view li', text: 'cartwheel_tone1') @@ -222,9 +209,7 @@ feature 'GFM autocomplete', :js do it 'triggers autocomplete after selecting a quick action' do note = find('#note-body') page.within '.timeline-content-form' do - note.native.send_keys('') note.native.send_keys('/as') - note.click end find('.atwho-view li', text: '/assign') -- cgit v1.2.1