Fix logging and Selenium script

This commit is contained in:
Nicolas Jeannerod 2024-09-09 14:10:00 +02:00
parent b38ec1a62a
commit 680f54f7d5

View file

@ -128,11 +128,14 @@ pkgs.nixosTest {
# there, then post a green image and check that the green pixel IS there. # there, then post a green image and check that the green pixel IS there.
with subtest("Image displays"): with subtest("Image displays"):
server.succeed(f"su - selenium -c 'selenium-script test@test.com {password}'") server.succeed(f"su - selenium -c 'selenium-script test@test.com {password}' >&2")
server.copy_from_vm("/home/selenium/screenshot.png", "") server.copy_from_vm("/home/selenium/screenshot.png", "")
displayed_colors = server.succeed("convert /screenshot.png -define histogram:unique-colors=true -format %c histogram:info:") displayed_colors = subprocess.run(
["magick", "screenshot.png", "-define", "histogram:unique-colors=true", "-format", "%c", "histogram:info:"],
capture_output=True
)
# check that the green image displayed somewhere # check that the green image displayed somewhere
green_check = re.match(".*#00FF00.*", displayed_colors, re.S) green_check = re.match(".*#00FF00.*", displayed_colors.stdout.decode(), re.S)
if green_check is None: if green_check is None:
raise Exception("cannot detect the uploaded image on pixelfed page.") raise Exception("cannot detect the uploaded image on pixelfed page.")
''; '';