Skip to content

Commit

Permalink
test_counter: make counter tests more robust (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
masenf authored Oct 13, 2023
1 parent 018cb8a commit 997ce25
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions counter/tests/test_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,21 @@ def test_counter_app(counter_app: AppHarness, driver: WebDriver):
decrement, randomize, increment = buttons

decrement.click()
assert count.text == "-1"
assert counter_app.poll_for_content(count, exp_not_equal="0") == "-1"
assert backend_state.count == -1

increment.click()
assert counter_app.poll_for_content(count, exp_not_equal="-1") == "0"
increment.click()
assert count.text == "1"
assert counter_app.poll_for_content(count, exp_not_equal="0") == "1"
assert backend_state.count == 1

randomize.click()
random_count = count.text
random_count = counter_app.poll_for_content(count, exp_not_equal="1")
assert backend_state.count == int(random_count)
decrement.click()
assert count.text == str(int(random_count) - 1)
dec_value = str(int(random_count) - 1)
assert counter_app.poll_for_content(count, exp_not_equal=random_count) == dec_value
increment.click()
assert counter_app.poll_for_content(count, exp_not_equal=dec_value) == random_count
assert count.text == random_count

0 comments on commit 997ce25

Please sign in to comment.