Commit be646ba0 authored by Clement Ho's avatar Clement Ho

Add helper to disable css animation in rspec

parent f154a9ec
/* 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);
};
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
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'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment