mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
Test WebSpeak3 client capabilities in Safari
This commit is contained in:
1 parent
386c6ad49b
commit
a26b7e02ec
2 files changed
+36
-26
No files matched your search
@@ -1,13 +1,12 @@
|
|||||||
name: Safari landing page check
|
name: Safari WebSpeak3 client check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths:
|
paths:
|
||||||
- "web/src/landing.tsx"
|
- "web/src/**"
|
||||||
- "web/src/landing.css"
|
- "web/index.html"
|
||||||
- "web/landing/**"
|
|
||||||
- "web/public/**"
|
- "web/public/**"
|
||||||
- ".github/workflows/safari-check.yml"
|
- ".github/workflows/safari-check.yml"
|
||||||
- "tests/safari_smoke.py"
|
- "tests/safari_smoke.py"
|
||||||
@@ -49,7 +48,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
npm run preview -- --host 127.0.0.1 --port 4173 > /tmp/webspeak3-preview.log 2>&1 &
|
npm run preview -- --host 127.0.0.1 --port 4173 > /tmp/webspeak3-preview.log 2>&1 &
|
||||||
for attempt in {1..30}; do
|
for attempt in {1..30}; do
|
||||||
curl --fail --silent http://127.0.0.1:4173/landing/ > /dev/null && exit 0
|
curl --fail --silent http://127.0.0.1:4173/ > /dev/null && exit 0
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
cat /tmp/webspeak3-preview.log
|
cat /tmp/webspeak3-preview.log
|
||||||
@@ -63,14 +62,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Test landing page in Safari
|
- name: Test landing page in Safari
|
||||||
env:
|
env:
|
||||||
BASE_URL: http://127.0.0.1:4173/landing/
|
BASE_URL: http://127.0.0.1:4173/
|
||||||
run: .venv-safari/bin/python tests/safari_smoke.py
|
run: .venv-safari/bin/python tests/safari_smoke.py
|
||||||
|
|
||||||
- name: Upload Safari screenshots
|
- name: Upload Safari screenshots
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
name: safari-screenshots
|
name: safari-client-screenshots
|
||||||
path: test-results/safari-*.png
|
path: test-results/safari-client-*.png
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
+29
-18
@@ -6,7 +6,7 @@ from selenium.webdriver.common.by import By
|
|||||||
from selenium.webdriver.support.ui import WebDriverWait
|
from selenium.webdriver.support.ui import WebDriverWait
|
||||||
|
|
||||||
|
|
||||||
BASE_URL = os.environ.get("BASE_URL", "https://webspeak3.de/")
|
BASE_URL = os.environ.get("BASE_URL", "https://client.webspeak3.de/")
|
||||||
RESULTS = Path("test-results")
|
RESULTS = Path("test-results")
|
||||||
RESULTS.mkdir(exist_ok=True)
|
RESULTS.mkdir(exist_ok=True)
|
||||||
|
|
||||||
@@ -21,28 +21,39 @@ def check_page(driver: webdriver.Safari, width: int, height: int, label: str) ->
|
|||||||
driver.set_window_size(width, height)
|
driver.set_window_size(width, height)
|
||||||
driver.get(BASE_URL)
|
driver.get(BASE_URL)
|
||||||
|
|
||||||
wait_for_text(driver, "h1", "TeamSpeak 3")
|
wait_for_text(driver, ".ts-app-title", "WebSpeak3")
|
||||||
assert "WebSpeak3" in driver.title
|
assert "WebSpeak3" in driver.title
|
||||||
|
|
||||||
client_link = driver.find_element(By.CSS_SELECTOR, 'a[href="https://client.webspeak3.de/"]')
|
capabilities = driver.execute_script(
|
||||||
demo_link = driver.find_element(By.CSS_SELECTOR, 'a[href="https://demo.webspeak3.de/"]')
|
"""
|
||||||
assert client_link.is_displayed()
|
return {
|
||||||
assert demo_link.is_displayed()
|
secureContext: window.isSecureContext,
|
||||||
|
mediaDevices: Boolean(navigator.mediaDevices),
|
||||||
english_button = driver.find_element(By.CSS_SELECTOR, ".language-switch button:last-child")
|
getUserMedia: typeof navigator.mediaDevices?.getUserMedia === 'function',
|
||||||
driver.execute_script("arguments[0].click()", english_button)
|
audioContext: typeof (window.AudioContext || window.webkitAudioContext) === 'function',
|
||||||
WebDriverWait(driver, 10).until(
|
webSocket: typeof window.WebSocket === 'function'
|
||||||
lambda current: any(
|
};
|
||||||
"Enter a server. Connected." in heading.text
|
"""
|
||||||
for heading in current.find_elements(By.CSS_SELECTOR, "h2")
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
assert capabilities["secureContext"]
|
||||||
|
assert capabilities["mediaDevices"]
|
||||||
|
assert capabilities["getUserMedia"]
|
||||||
|
assert capabilities["audioContext"]
|
||||||
|
assert capabilities["webSocket"]
|
||||||
|
|
||||||
connect_demo = driver.find_element(By.CSS_SELECTOR, ".connect-demo")
|
connections_menu = driver.find_element(By.CSS_SELECTOR, ".ts-menubar-dropdown .ts-menubar-item")
|
||||||
assert connect_demo.is_displayed()
|
driver.execute_script("arguments[0].click()", connections_menu)
|
||||||
assert "voice.teamspeak.com" in connect_demo.text
|
connect_item = WebDriverWait(driver, 10).until(
|
||||||
|
lambda current: current.find_element(By.CSS_SELECTOR, ".ts-menu .ts-menu-item")
|
||||||
|
)
|
||||||
|
driver.execute_script("arguments[0].click()", connect_item)
|
||||||
|
dialog = WebDriverWait(driver, 10).until(
|
||||||
|
lambda current: current.find_element(By.CSS_SELECTOR, ".ts-connect-dialog")
|
||||||
|
)
|
||||||
|
assert dialog.is_displayed()
|
||||||
|
assert len(dialog.find_elements(By.CSS_SELECTOR, "input")) >= 3
|
||||||
|
|
||||||
driver.save_screenshot(str(RESULTS / f"safari-{label}.png"))
|
driver.save_screenshot(str(RESULTS / f"safari-client-{label}.png"))
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
|||||||
Reference in new issue
Block a user