diff --git a/var/marketing/Makefile b/var/marketing/Makefile index a827093..4474a8c 100644 --- a/var/marketing/Makefile +++ b/var/marketing/Makefile @@ -1,7 +1,7 @@ updatescreenshots: - repo-common-take-screenshot mainpage-darkop http://localhost:1337/ 1024 680 --dark - repo-common-take-screenshot mainpage-laptop http://localhost:1337/ 1024 680 - repo-common-take-screenshot mainpage-phone http://localhost:1337/ 600 1160 + SCREENSHOT_DIR=screenshots SHOT_WIDTH=1024 SHOT_HEIGHT=680 repo-helper screenshot mainpage-darkop http://localhost:1337/ --width 1024 --height 680 --dark --script resize_viewport.py + SCREENSHOT_DIR=screenshots SHOT_WIDTH=1024 SHOT_HEIGHT=680 repo-helper screenshot mainpage-laptop http://localhost:1337/ --width 1024 --height 680 --script resize_viewport.py + SCREENSHOT_DIR=screenshots SHOT_WIDTH=600 SHOT_HEIGHT=1160 repo-helper screenshot mainpage-phone http://localhost:1337/ --width 600 --height 1160 --script resize_viewport.py repo-common-image-framer .PHONY: updatescreenshots diff --git a/var/marketing/resize_viewport.py b/var/marketing/resize_viewport.py new file mode 100644 index 0000000..4abcc81 --- /dev/null +++ b/var/marketing/resize_viewport.py @@ -0,0 +1,15 @@ +import os + +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait + +from repo_helper.screenshot import set_viewport_size + + +def run(driver): + WebDriverWait(driver, 30).until( + lambda d: bool(d.find_element(By.TAG_NAME, "body").get_attribute("loaded-dashboard")) + ) + width = int(os.environ["SHOT_WIDTH"]) + height = int(os.environ["SHOT_HEIGHT"]) + set_viewport_size(driver, width, height) diff --git a/var/marketing/screenshots/mainpage-darkop.png b/var/marketing/screenshots/mainpage-darkop.png index 565c932..2e09db1 100644 Binary files a/var/marketing/screenshots/mainpage-darkop.png and b/var/marketing/screenshots/mainpage-darkop.png differ diff --git a/var/marketing/screenshots/mainpage-darkop_framed.png b/var/marketing/screenshots/mainpage-darkop_framed.png index 2343a42..2c7ccab 100644 Binary files a/var/marketing/screenshots/mainpage-darkop_framed.png and b/var/marketing/screenshots/mainpage-darkop_framed.png differ diff --git a/var/marketing/screenshots/mainpage-laptop.png b/var/marketing/screenshots/mainpage-laptop.png index c96a480..2e09db1 100644 Binary files a/var/marketing/screenshots/mainpage-laptop.png and b/var/marketing/screenshots/mainpage-laptop.png differ diff --git a/var/marketing/screenshots/mainpage-laptop_framed.png b/var/marketing/screenshots/mainpage-laptop_framed.png index c38b5a4..2c7ccab 100644 Binary files a/var/marketing/screenshots/mainpage-laptop_framed.png and b/var/marketing/screenshots/mainpage-laptop_framed.png differ diff --git a/var/marketing/screenshots/mainpage-phone.png b/var/marketing/screenshots/mainpage-phone.png index 5c42715..d881642 100644 Binary files a/var/marketing/screenshots/mainpage-phone.png and b/var/marketing/screenshots/mainpage-phone.png differ diff --git a/var/marketing/screenshots/mainpage-phone_framed.png b/var/marketing/screenshots/mainpage-phone_framed.png index c0d984f..7a6ba5c 100644 Binary files a/var/marketing/screenshots/mainpage-phone_framed.png and b/var/marketing/screenshots/mainpage-phone_framed.png differ