image: cyb3rjak3/html5validator:latest
script:
- html5validator --root www --also-check-css --also-check-svg --show-warnings --log INFO
+
+build site on Python 3.8:
+ stage: pre-build
+ image: python:3.8-slim-buster
+ before_script:
+ - apt-get update; apt-get install -y make
+ script:
+ - cp -R ./www ./build
+ - misc/collect.py scrape https://downloads.openwrt.org build
+ artifacts:
+ expire_in: 1 week
+ when: always
+ paths:
+ - build
+
+test site with selenium:
+ stage: test
+ image: selenium/standalone-firefox:latest
+ script:
+ - /opt/bin/entry_point.sh &
+ - sudo apt-get update; sudo apt-get install -y python3-pip python3-pytest
+ - pip3 install selenium-firefox
+ - (cd build; python3 -m http.server &)
+ - pytest-3 tests
+
+build site for target environment:
+ stage: test
+ image: debian:9
+ before_script:
+ - apt-get update; apt-get install -y make python3
+ script:
+ - cp -R ./www ./build
+ - misc/collect.py scrape https://downloads.openwrt.org build
--- /dev/null
+from selenium import webdriver
+from selenium.webdriver.support.ui import Select
+from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
+
+
+def init_driver():
+ driver = webdriver.Remote(
+ command_executor="http://localhost:4444/wd/hub",
+ desired_capabilities=DesiredCapabilities.FIREFOX,
+ )
+ return driver
+
+
+def test_spa():
+ driver = init_driver()
+ driver.get("http://localhost:8000")
+ assert "OpenWrt Firmware Selector" in driver.title
+
+ model = driver.find_element_by_id("models")
+ model.clear()
+ model.send_keys("a7 v5")
+
+ models = driver.find_element_by_id("models-autocomplete-list")
+ assert "TP-Link Archer A7 v5" in models.text
+
+ message = driver.find_element_by_xpath("/html/body/div/div/p")
+ assert "use the input below to download firmware" in message.text
+
+ lang = Select(driver.find_element_by_id("language-selection"))
+
+ lang.select_by_visible_text("Deutsch")
+ message = driver.find_element_by_xpath("/html/body/div/div/p")
+ assert "benutze die Eingabe um die passende" in message.text
+
+ lang.select_by_value("ca")
+ message = driver.find_element_by_xpath("/html/body/div/div/p")
+ assert "servir el formulari de sota per seleccionar" in message.text
+
+ lang.select_by_visible_text("Polski")
+ message = driver.find_element_by_xpath("/html/body/div/div/p")
+ assert "pola poniżej żeby znaleźć obraz" in message.text