Merged
Conversation
The Emmy Selenium runner was assuming the DMG/CGB mode buttons were immediately available after opening the site. In CI, the React UI can still be mounting the Settings drawer content when the test harness tries to click those controls, which caused intermittent NoSuchElementException failures for dmg-mode and cgb-mode. Add explicit WebDriver waits for document readiness, element presence, and clickability. Introduce helper methods that reopen the Settings drawer only when necessary and wait for the mode buttons to appear before using them. Also wait for the ROM file input before uploading test ROMs so startup is synchronized with the live Emmy UI.
Emmy was reusing one Selenium browser session across the full test suite, which let a failed or incompatible ROM leave the page in a dirty state for later tests. That made some otherwise passing tests fail depending on execution order. Add session reset helpers that reload the Emmy page before each run, rebuild the normal UI state, and safely recreate Chrome when a simple page reset is not enough. Also centralize driver cleanup so setup and teardown handle broken sessions more reliably.
avivace
approved these changes
Mar 21, 2026
vulcandth
added a commit
to vulcandth/GBEmulatorShootout
that referenced
this pull request
Mar 21, 2026
* Fix CI for Emmy (gbdev#67) * Fix Emmy CI startup timing for mode selection The Emmy Selenium runner was assuming the DMG/CGB mode buttons were immediately available after opening the site. In CI, the React UI can still be mounting the Settings drawer content when the test harness tries to click those controls, which caused intermittent NoSuchElementException failures for dmg-mode and cgb-mode. Add explicit WebDriver waits for document readiness, element presence, and clickability. Introduce helper methods that reopen the Settings drawer only when necessary and wait for the mode buttons to appear before using them. Also wait for the ROM file input before uploading test ROMs so startup is synchronized with the live Emmy UI. * Reset Emmy browser state between test runs Emmy was reusing one Selenium browser session across the full test suite, which let a failed or incompatible ROM leave the page in a dirty state for later tests. That made some otherwise passing tests fail depending on execution order. Add session reset helpers that reload the Emmy page before each run, rebuild the normal UI state, and safely recreate Chrome when a simple page reset is not enough. Also centralize driver cleanup so setup and teardown handle broken sessions more reliably. * Move pages build inputs to main branch Add a main-branch copy of build.py based on the gh-pages version with only the CLI/path plumbing needed for CI. Update deploy-pages.yml so deploy-pages checks out main, installs the core Python dependencies, dumps emulators.json and tests.json from main.py on each run, copies those manifests into gh-pages, builds pages/index.html from the gh-pages copies plus persisted emulator result JSON, and removes only pages/build.py before committing. This keeps gh-pages as published artifacts while allowing new tests, emulators, and page-build changes to be made from main. * Fix deploy-pages manifest generation Refactor main.py so --dump-emulators-json and --dump-tests-json use static emulator metadata instead of importing emulator backends. This avoids runtime-only dependencies such as selenium when deploy-pages regenerates emulators.json and tests.json. Add a direct workflow_dispatch entrypoint to deploy-pages.yml and skip the artifact download step for manual runs. That allows the Deploy Pages workflow to be triggered by hand to rebuild gh-pages from the current manifests and persisted results without first running an emulator workflow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors and improves the
Emmyemulator integration by restructuring browser automation logic for better reliability and maintainability. The changes introduce helper methods for managing the Selenium WebDriver session, waiting for elements, and ensuring the emulator's settings are open before interaction. This makes the setup and ROM loading process more robust and less error-prone.Browser session management improvements:
_close_driverand_reset_sessionmethods to handle WebDriver lifecycle, ensuring proper cleanup and reliable session restarts. (emulators/emmy.py)undoSetupto use the new_close_drivermethod for consistent shutdown. (emulators/emmy.py)Web interaction and reliability enhancements:
_wait,_find_now, and_wait_for_idto standardize waiting for elements and interactions, reducing flakiness in browser automation. (emulators/emmy.py)_ensure_settings_opento reliably open and verify the emulator settings panel before proceeding with further actions. (emulators/emmy.py)setupandstartProcessto use the new session and element-waiting logic, improving robustness when selecting system modes and uploading ROMs. (emulators/emmy.py) [1] [2]