From 5b1949f3b109c2e247e077c0e18a1bbf5ab33767 Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Wed, 7 Jun 2017 13:44:02 -0400 Subject: [PATCH] Make tests work under multiple notifications --- js/gratipay/packages.js | 11 ++++------- tests/ttw/test_package_claiming.py | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/js/gratipay/packages.js b/js/gratipay/packages.js index 938ddc9cd1..cb47b88453 100644 --- a/js/gratipay/packages.js +++ b/js/gratipay/packages.js @@ -12,17 +12,14 @@ Gratipay.packages.initSingle = function() { Gratipay.packages.postBulk = function(e) { e.preventDefault(); - var pkg, email, package_id, emails=[], package_ids_by_email={}; + var pkg, email, package_id, package_ids_by_email={}; $('table.listing td.item ').not('.disabled').each(function() { pkg = $(this).data(); - if (package_ids_by_email[pkg.email] === undefined) { - emails.push(pkg.email); + if (package_ids_by_email[pkg.email] === undefined) package_ids_by_email[pkg.email] = []; - } package_ids_by_email[pkg.email].push(pkg.packageId); }); - emails.sort(); - for (var i=0, email; email = emails[i]; i++) + for (email in package_ids_by_email) Gratipay.packages.post(email, package_ids_by_email[email], true); }; @@ -36,7 +33,7 @@ Gratipay.packages.postOne = function(e) { Gratipay.packages.post = function(email, package_ids, show_email) { var action = 'start-verification'; - var $button = $('.important-button button') + var $button = $('button.apply') $button.prop('disabled', true); function reenable() { $button.prop('disabled', false); } diff --git a/tests/ttw/test_package_claiming.py b/tests/ttw/test_package_claiming.py index eb679d28ea..14501bd7a1 100644 --- a/tests/ttw/test_package_claiming.py +++ b/tests/ttw/test_package_claiming.py @@ -211,8 +211,8 @@ def test_sends_one_mail_per_address(self): self.add_and_verify_email(cat, 'bob@example.com') self.visit_as('cat') self.css('.important-button button').click() - assert self.wait_for_success() == 'Check bob@example.com for a verification link.' - assert self.wait_for_success() == 'Check cat@example.com for a verification link.' + assert self.wait_for_success('Check bob@example.com for a verification link.') + assert self.wait_for_success('Check cat@example.com for a verification link.') def test_sends_one_mail_for_multiple_packages(self): self.make_participant('alice', claimed_time='now', email_address='alice@example.com')