Fixed a volume mounting bug, added validation for footer component.

This commit is contained in:
Ada Werefox 2023-01-27 16:44:16 +00:00
parent 276c2da873
commit e2e4e9b175
3 changed files with 18 additions and 35 deletions

View File

@ -28,6 +28,6 @@ services:
volumes:
- ./test_suite:/tests:ro
- ./output:/output:rw
- ../data:/data:ro
- ../src/info/data:/data:ro
user: "1000:1000"
command: 'python3 -m robot -d /output /tests'

View File

@ -1,11 +1,9 @@
#!/usr/bin/python
# Necessary imports
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from robot.api.logger import info, debug, trace, console, error
from robot.api.logger import error
def grab_button_elements(driver):
# Try to grab button elements of the footer
@ -18,31 +16,12 @@ def grab_button_elements(driver):
driver.close()
driver.quit()
return {}
return sites
def check_footer_links(driver):
# setup wait and grab original tab/window
wait = WebDriverWait(driver, 10)
main_tab = driver.current_window_handle
sites = grab_button_elements(driver)
# Iterate through subdomains
for e in sites:
try:
e.click()
info(e.text)
wait.until(expected_conditions.number_of_windows_to_be(2))
for window_handle in driver.window_handles:
if window_handle != main_tab:
driver.switch_to.window(window_handle)
driver.close()
driver.switch_to.window(main_tab)
except:
error("Couldn't find the element somewhere...")
driver.close()
driver.quit()
return False
return True
def load_data():
# I don't have a better method of constructing the data dict
data = {"Contact": {"url": "https://info.werefox.cafe/contacts"}, " /src": {"url": "https://gitea.werefox.cafe/ada/werefox-cafe"}, "Mutant Standard emoji": {
"url": "https://mutant.tech"}, "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License": {"url": "https://creativecommons.org/licenses/by-nc-sa/4.0/"}}
return data

View File

@ -3,8 +3,8 @@
# Necessary imports
from selenium.webdriver.common.by import By
from robot.api.logger import info, error
from footer_test import check_footer_links
from shared_methods import load_data, check_buttons
import footer_test
def grab_button_elements(driver):
@ -41,10 +41,14 @@ def execute_tests(driver, site_url):
if (not check_buttons(driver, data, button_elements)):
info('Test failed.')
return False
# A little bit of setup, grabbing the button elements
data = footer_test.load_data()
button_elements = footer_test.grab_button_elements(driver)
# Check the footer buttons
elif (not check_footer_links(driver)):
if (not check_buttons(driver, data, button_elements)):
info('Test failed.')
return False
else:
info('Test succeeded.')
return True
info('Test succeeded.')
return True