Skip to content

Commit

Permalink
fix up python behave step and update test counts; work on #317
Browse files Browse the repository at this point in the history
  • Loading branch information
kltm committed Mar 22, 2016
1 parent e36fef2 commit f598941
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
6 changes: 3 additions & 3 deletions test-app/behave/40_count_search.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
##
21 changes: 14 additions & 7 deletions test-app/behave/steps/search_counts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f598941

Please sign in to comment.