diff options
author | Jacob Schatz <jschatz@gitlab.com> | 2017-06-20 00:08:33 +0300 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2017-06-20 00:11:02 +0300 |
commit | efd1f2897d9b713127cfc37d55eebb879e3edb84 (patch) | |
tree | 9051761e3f727a964f72a14e0e4be01b0b3e7947 /spec/features | |
parent | dc8850d468cea327c8b333cb816d4c9bd1c2cdec (diff) |
Merge branch '33598-fix-autocomplete-disabled-in-gl-form-instances' into 'master'
Re-enable autocomplete for milestones, tags, releases, and wiki
Closes #33598
See merge request !12110
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/issues/form_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/merge_requests/form_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/projects/milestones/new_spec.rb | 18 | ||||
-rw-r--r-- | spec/features/projects/wiki/user_creates_wiki_page_spec.rb | 16 | ||||
-rw-r--r-- | spec/features/projects/wiki/user_updates_wiki_page_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/tags/master_creates_tag_spec.rb | 94 | ||||
-rw-r--r-- | spec/features/tags/master_updates_tag_spec.rb | 11 |
7 files changed, 140 insertions, 41 deletions
diff --git a/spec/features/issues/form_spec.rb b/spec/features/issues/form_spec.rb index 96d37e33f3d..ebc4a19599c 100644 --- a/spec/features/issues/form_spec.rb +++ b/spec/features/issues/form_spec.rb @@ -210,6 +210,13 @@ describe 'New/edit issue', :feature, :js do expect(find('.js-assignee-search')).to have_content(user2.name) end + + it 'description has autocomplete' do + find('#issue_description').native.send_keys('') + fill_in 'issue_description', with: '@' + + expect(page).to have_selector('.atwho-view') + end end context 'edit issue' do @@ -258,6 +265,13 @@ describe 'New/edit issue', :feature, :js do end end end + + it 'description has autocomplete' do + find('#issue_description').native.send_keys('') + fill_in 'issue_description', with: '@' + + expect(page).to have_selector('.atwho-view') + end end describe 'sub-group project' do diff --git a/spec/features/merge_requests/form_spec.rb b/spec/features/merge_requests/form_spec.rb index 00ef1ffdddc..486876d811d 100644 --- a/spec/features/merge_requests/form_spec.rb +++ b/spec/features/merge_requests/form_spec.rb @@ -96,6 +96,13 @@ describe 'New/edit merge request', feature: true, js: true do .to end_with(merge_request_path(merge_request)) end end + + it 'description has autocomplete' do + find('#merge_request_description').native.send_keys('') + fill_in 'merge_request_description', with: '@' + + expect(page).to have_selector('.atwho-view') + end end context 'edit merge request' do @@ -157,6 +164,13 @@ describe 'New/edit merge request', feature: true, js: true do end end end + + it 'description has autocomplete' do + find('#merge_request_description').native.send_keys('') + fill_in 'merge_request_description', with: '@' + + expect(page).to have_selector('.atwho-view') + end end end diff --git a/spec/features/projects/milestones/new_spec.rb b/spec/features/projects/milestones/new_spec.rb new file mode 100644 index 00000000000..7403822c7fb --- /dev/null +++ b/spec/features/projects/milestones/new_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +feature 'Creating a new project milestone', :feature, :js do + let(:user) { create(:user) } + let(:project) { create(:empty_project, name: 'test', namespace: user.namespace) } + + before do + login_as(user) + visit new_namespace_project_milestone_path(project.namespace, project) + end + + it 'description has autocomplete' do + find('#milestone_description').native.send_keys('') + fill_in 'milestone_description', with: '@' + + expect(page).to have_selector('.atwho-view') + end +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 8912d575878..16e64bd6207 100644 --- a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb @@ -133,6 +133,22 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do expect(page).to have_content('My awesome wiki!') end end + + scenario 'content has autocomplete', :js do + click_link 'New page' + + page.within '#modal-new-wiki' do + fill_in :new_wiki_path, with: 'test-autocomplete' + click_button 'Create page' + end + + page.within '.wiki-form' do + find('#wiki_content').native.send_keys('') + fill_in :wiki_content, with: '@' + end + + expect(page).to have_selector('.atwho-view') + end end end 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 86cf520ea80..4d027a3ed1a 100644 --- a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb @@ -5,11 +5,10 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do background do project.team << [user, :master] + WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute login_as(user) - visit namespace_project_path(project.namespace, project) - WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute - click_link 'Wiki' + visit namespace_project_wikis_path(project.namespace, project) end context 'in the user namespace' do @@ -42,6 +41,15 @@ feature 'Projects > Wiki > User updates wiki page', feature: true do expect(page).to have_content('Content can\'t be blank') expect(find('textarea#wiki_content').value).to eq '' end + + scenario 'content has autocomplete', :js do + click_link 'Edit' + + find('#wiki_content').native.send_keys('') + fill_in :wiki_content, with: '@' + + expect(page).to have_selector('.atwho-view') + end end end diff --git a/spec/features/tags/master_creates_tag_spec.rb b/spec/features/tags/master_creates_tag_spec.rb index af25eebed13..9030a2f2ff5 100644 --- a/spec/features/tags/master_creates_tag_spec.rb +++ b/spec/features/tags/master_creates_tag_spec.rb @@ -7,61 +7,79 @@ feature 'Master creates tag', feature: true do before do project.team << [user, :master] login_with(user) - visit namespace_project_tags_path(project.namespace, project) end - scenario 'with an invalid name displays an error' do - create_tag_in_form(tag: 'v 1.0', ref: 'master') + context 'from tag list' do + before do + visit namespace_project_tags_path(project.namespace, project) + end - expect(page).to have_content 'Tag name invalid' - end + scenario 'with an invalid name displays an error' do + create_tag_in_form(tag: 'v 1.0', ref: 'master') - scenario 'with an invalid reference displays an error' do - create_tag_in_form(tag: 'v2.0', ref: 'foo') + expect(page).to have_content 'Tag name invalid' + end - expect(page).to have_content 'Target foo is invalid' - end + scenario 'with an invalid reference displays an error' do + create_tag_in_form(tag: 'v2.0', ref: 'foo') - scenario 'that already exists displays an error' do - create_tag_in_form(tag: 'v1.1.0', ref: 'master') + expect(page).to have_content 'Target foo is invalid' + end - expect(page).to have_content 'Tag v1.1.0 already exists' - end + scenario 'that already exists displays an error' do + create_tag_in_form(tag: 'v1.1.0', ref: 'master') + + expect(page).to have_content 'Tag v1.1.0 already exists' + end - scenario 'with multiline message displays the message in a <pre> block' do - create_tag_in_form(tag: 'v3.0', ref: 'master', message: "Awesome tag message\n\n- hello\n- world") + scenario 'with multiline message displays the message in a <pre> block' do + create_tag_in_form(tag: 'v3.0', ref: 'master', message: "Awesome tag message\n\n- hello\n- world") - expect(current_path).to eq( - namespace_project_tag_path(project.namespace, project, 'v3.0')) - expect(page).to have_content 'v3.0' - page.within 'pre.wrap' do - expect(page).to have_content "Awesome tag message\n\n- hello\n- world" + expect(current_path).to eq( + namespace_project_tag_path(project.namespace, project, 'v3.0')) + expect(page).to have_content 'v3.0' + page.within 'pre.wrap' do + expect(page).to have_content "Awesome tag message\n\n- hello\n- world" + end end - end - scenario 'with multiline release notes parses the release note as Markdown' do - create_tag_in_form(tag: 'v4.0', ref: 'master', desc: "Awesome release notes\n\n- hello\n- world") + scenario 'with multiline release notes parses the release note as Markdown' do + create_tag_in_form(tag: 'v4.0', ref: 'master', desc: "Awesome release notes\n\n- hello\n- world") - expect(current_path).to eq( - namespace_project_tag_path(project.namespace, project, 'v4.0')) - expect(page).to have_content 'v4.0' - page.within '.description' do - expect(page).to have_content 'Awesome release notes' - expect(page).to have_selector('ul li', count: 2) + expect(current_path).to eq( + namespace_project_tag_path(project.namespace, project, 'v4.0')) + expect(page).to have_content 'v4.0' + page.within '.description' do + expect(page).to have_content 'Awesome release notes' + expect(page).to have_selector('ul li', count: 2) + end + end + + scenario 'opens dropdown for ref', js: true do + click_link 'New tag' + ref_row = find('.form-group:nth-of-type(2) .col-sm-10') + page.within ref_row do + ref_input = find('[name="ref"]', visible: false) + expect(ref_input.value).to eq 'master' + expect(find('.dropdown-toggle-text')).to have_content 'master' + + find('.js-branch-select').trigger('click') + + expect(find('.dropdown-menu')).to have_content 'empty-branch' + end end end - scenario 'opens dropdown for ref', js: true do - click_link 'New tag' - ref_row = find('.form-group:nth-of-type(2) .col-sm-10') - page.within ref_row do - ref_input = find('[name="ref"]', visible: false) - expect(ref_input.value).to eq 'master' - expect(find('.dropdown-toggle-text')).to have_content 'master' + context 'from new tag page' do + before do + visit new_namespace_project_tag_path(project.namespace, project) + end - find('.js-branch-select').trigger('click') + it 'description has autocomplete', :js do + find('#release_description').native.send_keys('') + fill_in 'release_description', with: '@' - expect(find('.dropdown-menu')).to have_content 'empty-branch' + expect(page).to have_selector('.atwho-view') end end diff --git a/spec/features/tags/master_updates_tag_spec.rb b/spec/features/tags/master_updates_tag_spec.rb index 6b5b3122f72..3582f41938a 100644 --- a/spec/features/tags/master_updates_tag_spec.rb +++ b/spec/features/tags/master_updates_tag_spec.rb @@ -24,6 +24,17 @@ feature 'Master updates tag', feature: true do expect(page).to have_content 'v1.1.0' expect(page).to have_content 'Awesome release notes' end + + scenario 'description has autocomplete', :js do + page.within(first('.content-list .controls')) do + click_link 'Edit release notes' + end + + find('#release_description').native.send_keys('') + fill_in 'release_description', with: '@' + + expect(page).to have_selector('.atwho-view') + end end context 'from a specific tag page' do |