Skip to content

Commit f239752

Browse files
committed
test: enhance selenium UI tests.
add error handling by taking screenhot on failure. set window size save screen size in different machines. this will helpful becuase if I test the selenium tests inside docker container then these screenshots are the only way to debug the test.
1 parent 54c4138 commit f239752

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

tools/tests/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ def setup_module():
77
geckodriver_autoinstaller.install()
88
firefox_options = Options()
99
firefox_options.headless = True
10+
firefox_options.add_argument("--width=1920")
11+
firefox_options.add_argument("--height=1080")
1012
return webdriver.Firefox(options=firefox_options)
1113

1214
def teardown_module(driver: webdriver.Firefox):

tools/tests/ui_all.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
driver = setup_module()
99
t2 = time.time()
1010
print(f"Setup time: {t2 - t1:.2f}s")
11-
12-
test_signin(driver)
13-
test_signup(driver)
14-
test_signin_with_google(driver)
15-
11+
try:
12+
test_signin(driver)
13+
test_signup(driver)
14+
test_signin_with_google(driver)
15+
except Exception as e:
16+
driver.save_screenshot(f"debug_screenshot_{time.time()}.png")
17+
raise AssertionError(e) from e
1618
teardown_module(driver)

0 commit comments

Comments
 (0)