diff --git a/tests/fediversity.png b/tests/fediversity.png new file mode 100644 index 0000000..188ab23 Binary files /dev/null and b/tests/fediversity.png differ diff --git a/tests/pixelfed-garage.nix b/tests/pixelfed-garage.nix index 096eab3..d562390 100644 --- a/tests/pixelfed-garage.nix +++ b/tests/pixelfed-garage.nix @@ -7,6 +7,7 @@ let libraries = with pkgs.python3Packages; [ selenium ]; } '' import sys + import os from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait @@ -17,7 +18,7 @@ let email = sys.argv[1] password = sys.argv[2] - green_path = "${./green.png}" + media_path = os.environ['POST_MEDIA'] screenshot_path = "/home/selenium/screenshot.png" # Create and configure driver. It is important to set the window size such that @@ -114,9 +115,9 @@ pkgs.nixosTest { imagemagick ]; environment.variables = { - POST_MEDIA = ./green.png; # AWS_ACCESS_KEY_ID = config.services.garage.ensureKeys.pixelfed.id; # AWS_SECRET_ACCESS_KEY = config.services.garage.ensureKeys.pixelfed.secret; + POST_MEDIA = ./fediversity.png; }; # chrome does not like being run as root users.users.selenium = { @@ -127,7 +128,6 @@ pkgs.nixosTest { testScript = '' import re - import subprocess server.start() @@ -148,8 +148,8 @@ pkgs.nixosTest { server.copy_from_vm("/home/selenium/screenshot.png", "") displayed_colors = server.succeed("magick /home/selenium/screenshot.png -define histogram:unique-colors=true -format %c histogram:info:") # check that the green image displayed somewhere - green_check = re.match(".*#00FF00.*", displayed_colors.stdout.decode(), re.S) - if green_check is None: + image_check = re.match(".*#FF0500.*", displayed_colors, re.S) + if image_check is None: raise Exception("cannot detect the uploaded image on pixelfed page.") ''; }