Skip to content

Commit

Permalink
tests: tune time around mouse operations
Browse files Browse the repository at this point in the history
  • Loading branch information
fsouza committed Nov 10, 2023
1 parent 9ac8b2b commit c9568f0
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions tests/test_mouse_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ def test_mouse_over(browser_name, get_new_browser):
element = browser.find_by_css(".add-element-mouseover")
element.mouse_over()

assert browser.is_element_present_by_id("what-is-your-name", wait_time=20)
assert browser.is_element_present_by_id("what-is-your-name", wait_time=10)

element = browser.find_by_css(".add-element-mouseover")
element.mouse_out()

assert browser.is_element_not_present_by_id("what-is-your-name", wait_time=10)


@pytest.mark.parametrize("browser_name", supported_browsers)
def test_mouse_out(browser_name, get_new_browser):
Expand All @@ -33,7 +35,8 @@ def test_mouse_out(browser_name, get_new_browser):
element = browser.find_by_css(".add-element-mouseover")
element.mouse_over()
element.mouse_out()
assert browser.is_element_not_present_by_id("what-is-your-name")

assert browser.is_element_not_present_by_id("what-is-your-name", wait_time=10)


@pytest.mark.parametrize("browser_name", supported_browsers)
Expand All @@ -48,7 +51,7 @@ def test_mouse_out_top_left(browser_name, get_new_browser):
element.mouse_over()
element.mouse_out()

assert browser.is_element_not_present_by_id("what-is-your-name")
assert browser.is_element_not_present_by_id("what-is-your-name", wait_time=10)


@pytest.mark.parametrize("browser_name", supported_browsers)
Expand All @@ -64,11 +67,13 @@ def test_double_click(browser_name, get_new_browser):
button = browser.find_by_css(".db-button")
button.double_click()

time.sleep(5)
assert browser.find_by_css(".should-be-visible-after-double-click").is_visible(
wait_time=20,
assert browser.find_by_css(
".should-be-visible-after-double-click",
wait_time=10,
).is_visible(
wait_time=10,
)
assert browser.is_element_not_present_by_id("what-is-your-name")
assert browser.is_element_not_present_by_id("what-is-your-name", wait_time=20)


@pytest.mark.parametrize("browser_name", supported_browsers)
Expand All @@ -80,9 +85,8 @@ def test_right_click(browser_name, get_new_browser):
element = browser.find_by_css(".right-clicable")
element.right_click()

time.sleep(5)
result_1 = browser.find_by_text("right clicked", wait_time=20).text
result_2 = browser.find_by_css(".right-clicable").text
result_2 = browser.find_by_css(".right-clicable", wait_time=20).text

assert result_1 == result_2 == "right clicked"

Expand All @@ -99,4 +103,5 @@ def test_drag_and_drop(browser_name, get_new_browser):
draggable = browser.find_by_css(".draggable")
draggable.drag_and_drop(droppable)

time.sleep(5)
assert "yes" == browser.find_by_css(".dragged").text

0 comments on commit c9568f0

Please sign in to comment.