mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +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:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "web/src/landing.tsx"
|
||||
- "web/src/landing.css"
|
||||
- "web/landing/**"
|
||||
- "web/src/**"
|
||||
- "web/index.html"
|
||||
- "web/public/**"
|
||||
- ".github/workflows/safari-check.yml"
|
||||
- "tests/safari_smoke.py"
|
||||
@@ -49,7 +48,7 @@ jobs:
|
||||
run: |
|
||||
npm run preview -- --host 127.0.0.1 --port 4173 > /tmp/webspeak3-preview.log 2>&1 &
|
||||
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
|
||||
done
|
||||
cat /tmp/webspeak3-preview.log
|
||||
@@ -63,14 +62,14 @@ jobs:
|
||||
|
||||
- name: Test landing page in Safari
|
||||
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
|
||||
|
||||
- name: Upload Safari screenshots
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: safari-screenshots
|
||||
path: test-results/safari-*.png
|
||||
name: safari-client-screenshots
|
||||
path: test-results/safari-client-*.png
|
||||
if-no-files-found: ignore
|
||||
retention-days: 14
|
||||
+29
-18
@@ -6,7 +6,7 @@ from selenium.webdriver.common.by import By
|
||||
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.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.get(BASE_URL)
|
||||
|
||||
wait_for_text(driver, "h1", "TeamSpeak 3")
|
||||
wait_for_text(driver, ".ts-app-title", "WebSpeak3")
|
||||
assert "WebSpeak3" in driver.title
|
||||
|
||||
client_link = driver.find_element(By.CSS_SELECTOR, 'a[href="https://client.webspeak3.de/"]')
|
||||
demo_link = driver.find_element(By.CSS_SELECTOR, 'a[href="https://demo.webspeak3.de/"]')
|
||||
assert client_link.is_displayed()
|
||||
assert demo_link.is_displayed()
|
||||
|
||||
english_button = driver.find_element(By.CSS_SELECTOR, ".language-switch button:last-child")
|
||||
driver.execute_script("arguments[0].click()", english_button)
|
||||
WebDriverWait(driver, 10).until(
|
||||
lambda current: any(
|
||||
"Enter a server. Connected." in heading.text
|
||||
for heading in current.find_elements(By.CSS_SELECTOR, "h2")
|
||||
)
|
||||
capabilities = driver.execute_script(
|
||||
"""
|
||||
return {
|
||||
secureContext: window.isSecureContext,
|
||||
mediaDevices: Boolean(navigator.mediaDevices),
|
||||
getUserMedia: typeof navigator.mediaDevices?.getUserMedia === 'function',
|
||||
audioContext: typeof (window.AudioContext || window.webkitAudioContext) === 'function',
|
||||
webSocket: typeof window.WebSocket === 'function'
|
||||
};
|
||||
"""
|
||||
)
|
||||
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")
|
||||
assert connect_demo.is_displayed()
|
||||
assert "voice.teamspeak.com" in connect_demo.text
|
||||
connections_menu = driver.find_element(By.CSS_SELECTOR, ".ts-menubar-dropdown .ts-menubar-item")
|
||||
driver.execute_script("arguments[0].click()", connections_menu)
|
||||
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:
|
||||
|
||||
Reference in new issue
Block a user