front: фикс скриншотов, теперь автоматически будет светлая тема и корректно работающее создание скриншотов для полной страницы

This commit is contained in:
2025-12-01 16:24:56 +03:00
parent 92120362a3
commit 261d01a670
13 changed files with 3 additions and 5 deletions

View File

@@ -63,6 +63,7 @@ def run_server(modem, build):
def create_driver(): def create_driver():
opts = webdriver.FirefoxOptions() opts = webdriver.FirefoxOptions()
opts.add_argument("--headless")
serv = webdriver.FirefoxService(executable_path='/snap/bin/geckodriver') serv = webdriver.FirefoxService(executable_path='/snap/bin/geckodriver')
driver = webdriver.Firefox(options=opts, service=serv) driver = webdriver.Firefox(options=opts, service=serv)
@@ -103,7 +104,7 @@ def make_screenshots_or_checks(modem):
driver = create_driver() driver = create_driver()
try: try:
driver.get("http://localhost:8080/login") driver.get("http://localhost:8080/login")
driver.save_screenshot(str(out_dir / f"login.png")) driver.get_full_page_screenshot_as_file(str(out_dir / f"login.png"))
login(driver) login(driver)
@@ -115,12 +116,9 @@ def make_screenshots_or_checks(modem):
# Проверка, что body загрузилось # Проверка, что body загрузилось
time.sleep(1) time.sleep(1)
page_height = driver.execute_script("return document.body.scrollHeight")
driver.set_window_size(SCREEN_WIDTH, page_height + 200)
time.sleep(1)
driver.find_element(By.TAG_NAME, "body") # гарантирует что DOM есть driver.find_element(By.TAG_NAME, "body") # гарантирует что DOM есть
driver.save_screenshot(str(out_dir / f"{tab_name}.png")) driver.get_full_page_screenshot_as_file(str(out_dir / f"{tab_name}.png"))
finally: finally:
driver.quit() driver.quit()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 KiB

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 KiB

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 KiB

After

Width:  |  Height:  |  Size: 309 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 463 KiB

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 KiB

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 KiB

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 KiB

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 KiB

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 KiB

After

Width:  |  Height:  |  Size: 243 KiB