Create desktop app due to mkv issue with chrome

This commit is contained in:
Peter Stockings
2026-03-02 21:54:22 +11:00
parent 2020b59259
commit 475fdbb2b8
11 changed files with 1276 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
import pytest
from PyQt6.QtCore import Qt
from main import VlcSyncApp
def test_app_ui_flow(qtbot):
# Initialize the main application
app = VlcSyncApp()
qtbot.addWidget(app)
# 1. Test Lobby View
assert app.stacked_widget.currentIndex() == 0
assert not app.create_room_btn.isEnabled()
# Fill out the Lobby Form
app.username_input.setText("PyTestUser")
# Mocking file selection instead of opening the native dialog
app.local_file_path = "test_pytest.mkv"
app.local_file_name = "test_pytest.mkv"
app.local_file_size = 1048576
app.check_inputs()
# Button should now be active
assert app.create_room_btn.isEnabled()
# 2. Test Creating Room matches integration pipeline
qtbot.mouseClick(app.create_room_btn, Qt.MouseButton.LeftButton)
# Wait for the WebSocket connected signal, the room_created server response, and UI transition
def check_room_joined():
assert app.stacked_widget.currentIndex() == 1
assert len(app.room_code) > 2
qtbot.waitUntil(check_room_joined, timeout=5000)
# 3. Test Chat flow End-to-End
# Type a message
qtbot.keyClicks(app.chat_input, "Automated UI Test Message")
# Click Send
qtbot.mouseClick(app.chat_send_btn, Qt.MouseButton.LeftButton)
# Wait until the Bun server grabs the websocket payload, stores it, and broadcasts it back to the UI!
def check_chat_received():
assert "Automated UI Test Message" in app.chat_messages.text()
qtbot.waitUntil(check_chat_received, timeout=3000)
# 4. Test Playback Sync (UI updates and internal flags)
assert app.play_btn.text() == ""
# Click Play
qtbot.mouseClick(app.play_btn, Qt.MouseButton.LeftButton)
def check_playback_started():
assert app.play_btn.text() == ""
qtbot.waitUntil(check_playback_started, timeout=2000)
# Clean up background threads
app.leave_room()