Skip to content

Commit

Permalink
[py] Fixed Flaky Upload Tests (#14706)
Browse files Browse the repository at this point in the history
  • Loading branch information
shbenzer authored Nov 2, 2024
1 parent cde43bc commit 39fee38
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions py/test/selenium/webdriver/common/upload_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait


@pytest.fixture
Expand All @@ -39,9 +41,8 @@ def test_can_upload_file(driver, pages, get_local_path):
driver.find_element(By.ID, "upload").send_keys(get_local_path("test_file.txt"))
driver.find_element(By.ID, "go").click()
driver.switch_to.frame(driver.find_element(By.ID, "upload_target"))
body = driver.find_element(By.CSS_SELECTOR, "body").text

assert "test_file.txt" in body
WebDriverWait(driver, 10).until(EC.text_to_be_present_in_element((By.CSS_SELECTOR, "body"), "test_file.txt"))


def test_can_upload_two_files(driver, pages, get_local_path):
Expand All @@ -50,10 +51,9 @@ def test_can_upload_two_files(driver, pages, get_local_path):
driver.find_element(By.ID, "upload").send_keys(two_file_paths)
driver.find_element(By.ID, "go").click()
driver.switch_to.frame(driver.find_element(By.ID, "upload_target"))
body = driver.find_element(By.CSS_SELECTOR, "body").text

assert "test_file.txt" in body
assert "test_file2.txt" in body
WebDriverWait(driver, 10).until(EC.text_to_be_present_in_element((By.CSS_SELECTOR, "body"), "test_file.txt"))
WebDriverWait(driver, 10).until(EC.text_to_be_present_in_element((By.CSS_SELECTOR, "body"), "test_file2.txt"))


@pytest.mark.xfail_firefox
Expand Down

0 comments on commit 39fee38

Please sign in to comment.