forked from Fediversity/Fediversity
use fediversity logo
This commit is contained in:
parent
a49a2b57df
commit
a2da2f48b2
BIN
tests/fediversity.png
Normal file
BIN
tests/fediversity.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
|
@ -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.")
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue