summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <ClemMakesApps@gmail.com>2017-05-11 12:09:12 -0500
committerClement Ho <ClemMakesApps@gmail.com>2017-05-11 12:09:12 -0500
commitbe646ba0759b86686608faff6ff8b656922e7107 (patch)
tree691212aa0362593a99cecdc586d8989e4a82ba4b
parentf154a9ecec2aaf35a10cff3d6131e5f93523c95f (diff)
downloadgitlab-ce-be646ba0759b86686608faff6ff8b656922e7107.tar.gz
Add helper to disable css animation in rspec
-rw-r--r--spec/disable_css_animation.js15
-rw-r--r--spec/disable_css_animation_helper.rb9
-rw-r--r--spec/features/issues/form_spec.rb39
3 files changed, 26 insertions, 37 deletions
diff --git a/spec/disable_css_animation.js b/spec/disable_css_animation.js
new file mode 100644
index 00000000000..b26676d2e98
--- /dev/null
+++ b/spec/disable_css_animation.js
@@ -0,0 +1,15 @@
+/* eslint-disable */
+// Disable eslint because capybara does not know es6
+
+var disableAnimationStyles = '-webkit-transition: none !important;' +
+ '-moz-transition: none !important;' +
+ '-ms-transition: none !important;' +
+ '-o-transition: none !important;' +
+ 'transition: none !important;'
+
+window.onload = function() {
+ var animationStyles = document.createElement('style');
+ animationStyles.type = 'text/css';
+ animationStyles.innerHTML = '* {' + disableAnimationStyles + '}';
+ document.head.appendChild(animationStyles);
+};
diff --git a/spec/disable_css_animation_helper.rb b/spec/disable_css_animation_helper.rb
new file mode 100644
index 00000000000..1cc69ff55c8
--- /dev/null
+++ b/spec/disable_css_animation_helper.rb
@@ -0,0 +1,9 @@
+Capybara.register_driver :poltergeist do |app|
+ opts = {
+ extensions: ["#{Rails.root}/spec/disable_css_animation.js"] # or wherever
+ }
+
+ Capybara::Poltergeist::Driver.new(app, opts)
+end
+
+Capybara.javascript_driver = :poltergeist
diff --git a/spec/features/issues/form_spec.rb b/spec/features/issues/form_spec.rb
index 7d13690f284..a12a946b1bb 100644
--- a/spec/features/issues/form_spec.rb
+++ b/spec/features/issues/form_spec.rb
@@ -1,4 +1,5 @@
require 'rails_helper'
+require 'disable_css_animation_helper'
describe 'New/edit issue', feature: true, js: true do
include GitlabRoutingHelper
@@ -33,48 +34,12 @@ describe 'New/edit issue', feature: true, js: true do
# TODO: Figure out a better way to wait for dropdown CSS hide
# animation to complete
- sleep 0.3
+ # sleep 0.3
expect(page.find('.dropdown-menu-user', visible: false)).not_to be_visible
end
end
- describe 'multiple assignees' do
- before do
- click_button 'Unassigned'
- end
-
- it 'unselects other assignees when unassigned is selected' do
- page.within '.dropdown-menu-user' do
- click_link user2.name
- end
-
- page.within '.dropdown-menu-user' do
- click_link 'Unassigned'
- end
-
- page.within '.js-assignee-search' do
- expect(page).to have_content 'Unassigned'
- end
-
- expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match('0')
- end
-
- it 'toggles assign to me when current user is selected and unselected' do
- page.within '.dropdown-menu-user' do
- click_link user.name
- end
-
- expect(find('a', text: 'Assign to me', visible: false)).not_to be_visible
-
- page.within '.dropdown-menu-user' do
- click_link user.name
- end
-
- expect(find('a', text: 'Assign to me')).to be_visible
- end
- end
-
it 'allows user to create new issue' do
fill_in 'issue_title', with: 'title'
fill_in 'issue_description', with: 'title'