Skip to content
Extraits de code Groupes Projets
Valider 78e18373 rédigé par Jonne Haß's avatar Jonne Haß
Parcourir les fichiers

Merge pull request #6366 from jhass/aspect_sorting_cuke

Bump selenium-webdriver, implement aspect sorting cucumber step with …
parents 2ce7a1e1 bf92a744
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -261,12 +261,7 @@ group :test do ...@@ -261,12 +261,7 @@ group :test do
gem "capybara", "2.4.4" gem "capybara", "2.4.4"
gem "database_cleaner" , "1.4.1" gem "database_cleaner" , "1.4.1"
gem "selenium-webdriver", "2.46.2" gem "selenium-webdriver", "2.47.1"
source "https://rails-assets.org" do
gem "rails-assets-jquery-simulate", "1.0.1"
gem "rails-assets-jquery-simulate-ext", "1.3.0"
end
# General helpers # General helpers
......
...@@ -541,9 +541,6 @@ GEM ...@@ -541,9 +541,6 @@ GEM
rails-assets-jquery-fullscreen-plugin (0.5.0) rails-assets-jquery-fullscreen-plugin (0.5.0)
rails-assets-jquery-placeholder (2.1.2) rails-assets-jquery-placeholder (2.1.2)
rails-assets-jquery (>= 1.6) rails-assets-jquery (>= 1.6)
rails-assets-jquery-simulate (1.0.1)
rails-assets-jquery-simulate-ext (1.3.0)
rails-assets-jquery (>= 1.7.0)
rails-assets-jquery-textchange (0.2.3) rails-assets-jquery-textchange (0.2.3)
rails-assets-jquery rails-assets-jquery
rails-assets-jquery.slimscroll (1.3.6) rails-assets-jquery.slimscroll (1.3.6)
...@@ -648,7 +645,7 @@ GEM ...@@ -648,7 +645,7 @@ GEM
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1) tilt (~> 1.1)
selenium-webdriver (2.46.2) selenium-webdriver (2.47.1)
childprocess (~> 0.5) childprocess (~> 0.5)
multi_json (~> 1.0) multi_json (~> 1.0)
rubyzip (~> 1.0) rubyzip (~> 1.0)
...@@ -831,8 +828,6 @@ DEPENDENCIES ...@@ -831,8 +828,6 @@ DEPENDENCIES
rails-assets-jeresig--jquery.hotkeys (= 0.2.0)! rails-assets-jeresig--jquery.hotkeys (= 0.2.0)!
rails-assets-jquery (= 1.11.2)! rails-assets-jquery (= 1.11.2)!
rails-assets-jquery-placeholder (= 2.1.2)! rails-assets-jquery-placeholder (= 2.1.2)!
rails-assets-jquery-simulate (= 1.0.1)!
rails-assets-jquery-simulate-ext (= 1.3.0)!
rails-assets-jquery-textchange (= 0.2.3)! rails-assets-jquery-textchange (= 0.2.3)!
rails-assets-markdown-it (= 4.4.0)! rails-assets-markdown-it (= 4.4.0)!
rails-assets-markdown-it--markdown-it-for-inline (= 0.1.1)! rails-assets-markdown-it--markdown-it-for-inline (= 0.1.1)!
...@@ -857,7 +852,7 @@ DEPENDENCIES ...@@ -857,7 +852,7 @@ DEPENDENCIES
ruby-oembed (= 0.8.14) ruby-oembed (= 0.8.14)
rubyzip (= 1.1.7) rubyzip (= 1.1.7)
sass-rails (= 5.0.1) sass-rails (= 5.0.1)
selenium-webdriver (= 2.46.2) selenium-webdriver (= 2.47.1)
shoulda-matchers (= 2.8.0) shoulda-matchers (= 2.8.0)
sidekiq (= 3.4.2) sidekiq (= 3.4.2)
sidetiq (= 0.6.3) sidetiq (= 0.6.3)
......
...@@ -81,11 +81,11 @@ app.pages.Contacts = Backbone.View.extend({ ...@@ -81,11 +81,11 @@ app.pages.Contacts = Backbone.View.extend({
$("#aspect_nav .nav").sortable({ $("#aspect_nav .nav").sortable({
items: "li.aspect[data-aspect-id]", items: "li.aspect[data-aspect-id]",
update: function() { update: function() {
$("#aspect_nav .ui-sortable").removeClass("synced"); $("#aspect_nav .ui-sortable").addClass("syncing");
var data = JSON.stringify({ ordered_aspect_ids: $(this).sortable("toArray", { attribute: "data-aspect-id" }) }); var data = JSON.stringify({ ordered_aspect_ids: $(this).sortable("toArray", { attribute: "data-aspect-id" }) });
$.ajax(Routes.orderAspects(), $.ajax(Routes.orderAspects(),
{ type: "put", dataType: "text", contentType: "application/json", data: data }) { type: "put", dataType: "text", contentType: "application/json", data: data })
.done(function() { $("#aspect_nav .ui-sortable").addClass("synced"); }); .done(function() { $("#aspect_nav .ui-sortable").removeClass("syncing"); });
}, },
revert: true, revert: true,
helper: "clone" helper: "clone"
......
#aspect_nav #aspect_nav
%ul.nav.nav-tabs.nav-stacked.synced %ul.nav.nav-tabs.nav-stacked.ui-sortable
%li.all_contacts{:class => ("active" if params["set"] == "all")} %li.all_contacts{:class => ("active" if params["set"] == "all")}
%a{:href => contacts_path(:set => "all")} %a{:href => contacts_path(:set => "all")}
= t('contacts.index.all_contacts') = t('contacts.index.all_contacts')
......
...@@ -81,7 +81,7 @@ Feature: User manages contacts ...@@ -81,7 +81,7 @@ Feature: User manages contacts
And I have an aspect called "People" And I have an aspect called "People"
And I have an aspect called "Cat People" And I have an aspect called "Cat People"
When I am on the contacts page When I am on the contacts page
And I drag "Cat People" up 40 pixels And I drag "Cat People" up
And I go to the contacts page And I go to the contacts page
Then I should see "Cat People" as 2. aspect Then I should see "Cat People" as 2. aspect
And I should see "People" as 3. aspect And I should see "People" as 3. aspect
...@@ -88,24 +88,21 @@ When /^(.*) in the aspect creation modal$/ do |action| ...@@ -88,24 +88,21 @@ When /^(.*) in the aspect creation modal$/ do |action|
end end
end end
When /^I drag "([^"]*)" (up|down) (\d+) pixels?$/ do |aspect_name, direction, distance| When /^I drag "([^"]*)" (up|down)$/ do |aspect_name, direction|
distance = distance.to_i * -1 if direction == "up" aspect_id = @me.aspects.where(name: aspect_name).first.id
page.execute_script %{ aspect = find(:xpath, "//div[@id='aspect_nav']/ul/li[@data-aspect-id='#{aspect_id}']")
function drag() { target = direction == "up" ? aspect.all(:xpath, "./preceding-sibling::li").last :
$("li.aspect:contains('#{aspect_name}')") aspect.all(:xpath, "./following-sibling::li").first
.simulate("drag-n-drop", { dy: #{distance}, interpolation: { stepWidth: 10, stepDelay: 5 } }); browser = aspect.base.driver.browser
} mouse = browser.mouse
function loadScripts() { native_aspect = aspect.base.native
$.getScript("/assets/jquery-simulate/jquery.simulate.js", function(){ native_target = target.base.native
$.getScript("/assets/jquery-simulate-ext/src/jquery.simulate.ext.js", function(){ mouse.down native_aspect
$.getScript("/assets/jquery-simulate-ext/src/jquery.simulate.drag-n-drop.js", drag); mouse.move_to native_target, native_target.size.width / 2, 0
}); sleep 1
}); mouse.up
} expect(page).to have_no_css "#aspect_nav .ui-sortable.syncing"
if (!$.simulate) { loadScripts(); } else { drag(); } end
}
expect(find("#aspect_nav")).to have_css ".synced"
end
And /^I toggle the aspect "([^"]*)"$/ do |name| And /^I toggle the aspect "([^"]*)"$/ do |name|
toggle_aspect(name) toggle_aspect(name)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter