From c9568f06dafc161cc7aafb7bee454598f44f6a92 Mon Sep 17 00:00:00 2001 From: francisco souza <108725+fsouza@users.noreply.github.com> Date: Fri, 10 Nov 2023 11:23:37 -0500 Subject: [PATCH] tests: tune time around mouse operations --- tests/test_mouse_interaction.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/test_mouse_interaction.py b/tests/test_mouse_interaction.py index dbfc7ba2e..3ffead002 100644 --- a/tests/test_mouse_interaction.py +++ b/tests/test_mouse_interaction.py @@ -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): @@ -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) @@ -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) @@ -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) @@ -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" @@ -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