From 573eff244aec3f1979c32843cd1ee426edd239f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 26 Oct 2016 11:33:29 +0200 Subject: [PATCH] Avoid shadowing ambigous matches in ensure_page_loaded The old activities frontend was loaded several times and required a workaround. This is no longer the case. That statement also shaadowed Capybaras amgigous matches when more than one activity was showing. We thus test for the first activity. --- spec/support/pages/abstract_work_package.rb | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/spec/support/pages/abstract_work_package.rb b/spec/support/pages/abstract_work_package.rb index 37e42b00be..2b3a5b37a0 100644 --- a/spec/support/pages/abstract_work_package.rb +++ b/spec/support/pages/abstract_work_package.rb @@ -75,17 +75,10 @@ module Pages end def ensure_page_loaded - tries = 0 - begin - find('.work-package-details-activities-activity-contents .user', - text: work_package.journals.last.user.name, - wait: 10) - rescue - # HACK This error may happen since activities are loaded several times - # in the old resource, and may cause a reload. - tries += 1 - retry unless tries > 5 - end + expect(page).to have_selector('.work-package-details-activities-activity-contents .user', + text: work_package.journals.last.user.name, + minimum: 1, + wait: 10) end def expect_attributes(attribute_expectations)