forked from Fediversity/simple-nixos-fediverse
use fediversity logo
This commit is contained in:
parent
36ed2c68f4
commit
5090927bcf
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 ];
|
libraries = with pkgs.python3Packages; [ selenium ];
|
||||||
} ''
|
} ''
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
from selenium.webdriver.support.wait import WebDriverWait
|
from selenium.webdriver.support.wait import WebDriverWait
|
||||||
|
@ -17,7 +18,7 @@ let
|
||||||
email = sys.argv[1]
|
email = sys.argv[1]
|
||||||
password = sys.argv[2]
|
password = sys.argv[2]
|
||||||
|
|
||||||
green_path = "${./green.png}"
|
media_path = os.environ['POST_MEDIA']
|
||||||
screenshot_path = "/home/selenium/screenshot.png"
|
screenshot_path = "/home/selenium/screenshot.png"
|
||||||
|
|
||||||
# Create and configure driver. It is important to set the window size such that
|
# Create and configure driver. It is important to set the window size such that
|
||||||
|
@ -114,9 +115,9 @@ pkgs.nixosTest {
|
||||||
imagemagick
|
imagemagick
|
||||||
];
|
];
|
||||||
environment.variables = {
|
environment.variables = {
|
||||||
POST_MEDIA = ./green.png;
|
|
||||||
# AWS_ACCESS_KEY_ID = config.services.garage.ensureKeys.pixelfed.id;
|
# AWS_ACCESS_KEY_ID = config.services.garage.ensureKeys.pixelfed.id;
|
||||||
# AWS_SECRET_ACCESS_KEY = config.services.garage.ensureKeys.pixelfed.secret;
|
# AWS_SECRET_ACCESS_KEY = config.services.garage.ensureKeys.pixelfed.secret;
|
||||||
|
POST_MEDIA = ./fediversity.png;
|
||||||
};
|
};
|
||||||
# chrome does not like being run as root
|
# chrome does not like being run as root
|
||||||
users.users.selenium = {
|
users.users.selenium = {
|
||||||
|
@ -127,7 +128,6 @@ pkgs.nixosTest {
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
import re
|
import re
|
||||||
import subprocess
|
|
||||||
|
|
||||||
server.start()
|
server.start()
|
||||||
|
|
||||||
|
@ -148,8 +148,8 @@ pkgs.nixosTest {
|
||||||
server.copy_from_vm("/home/selenium/screenshot.png", "")
|
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:")
|
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
|
# check that the green image displayed somewhere
|
||||||
green_check = re.match(".*#00FF00.*", displayed_colors.stdout.decode(), re.S)
|
image_check = re.match(".*#FF0500.*", displayed_colors, re.S)
|
||||||
if green_check is None:
|
if image_check is None:
|
||||||
raise Exception("cannot detect the uploaded image on pixelfed page.")
|
raise Exception("cannot detect the uploaded image on pixelfed page.")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue