From f598941d9f331301d734874b33eb947ca03f441f Mon Sep 17 00:00:00 2001 From: SC Date: Tue, 22 Mar 2016 15:54:30 -0700 Subject: [PATCH] fix up python behave step and update test counts; work on #317 --- test-app/behave/40_count_search.feature | 6 +++--- test-app/behave/steps/search_counts.py | 21 ++++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/test-app/behave/40_count_search.feature b/test-app/behave/40_count_search.feature index b6865eaa7..057018f8f 100644 --- a/test-app/behave/40_count_search.feature +++ b/test-app/behave/40_count_search.feature @@ -8,7 +8,7 @@ Feature: AmiGO search pages show counts consistent with data loads Examples: search pages | searchpage | count | # |--------------------------+--------------------------| - | /amigo/search/annotation | 6082632 | - | /amigo/search/ontology | 45000 | - | /amigo/search/bioentity | 939637 | + | /amigo/search/annotation | 6254248 | + | /amigo/search/ontology | 42462 | + | /amigo/search/bioentity | 953865 | ## \ No newline at end of file diff --git a/test-app/behave/steps/search_counts.py b/test-app/behave/steps/search_counts.py index c02f149ba..8a27f94fb 100644 --- a/test-app/behave/steps/search_counts.py +++ b/test-app/behave/steps/search_counts.py @@ -16,10 +16,17 @@ def step_impl(context, searchpage): @then('the total should be within 10% of recent count "{count}"') def step_impl(context, count): - webelt = context.browser.find_element_by_class_name('bbop-widget-set-live-pager') - assert webelt.text.rfind('Total:') != -1 - line = webelt.text - linetotal = map(int, re.findall('\d+', line)) - total = linetotal[0] - thiscount = float(count) - assert ((total < 1.1 * thiscount) and (total > .9 * thiscount)) + + target_clss = "bbop-widget-set-live-pager" + webelt = context.browser.find_element_by_class_name(target_clss) + eltext = webelt.text + + ## Extract by bounding between ': ' and ';' + btm = eltext.index(': ') + top = eltext.index(';') + if btm != -1 and top != -1: + count = float(count) + found_number = float(eltext[btm:top]) + assert ((number_found <= 1.1 * count) and (number_found >= .9 * count)) + else: + assert True is False