-
Notifications
You must be signed in to change notification settings - Fork 70
chore: add UI tests with mock Deadline server and CI workflow #1102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
crowecawcaw
wants to merge
10
commits into
aws-deadline:mainline
Choose a base branch
from
crowecawcaw:ui-tests
base: mainline
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ebf2906
feat: add UI tests with mock Deadline server and CI workflow
crowecawcaw d710965
refactor: extract page object helpers for UI tests
crowecawcaw 4493d1f
Merge remote-tracking branch 'upstream/mainline' into localhost
crowecawcaw 695dc04
fix: revert Linux CI to CLI-only tests
crowecawcaw c8e7609
fix: enable AT-SPI2 accessibility on Linux CI for GUI tests
crowecawcaw 7608ddb
fix: export AT-SPI env vars inside dbus-run-session
crowecawcaw d2c8088
fix: add diagnostics to find_app for Linux CI debugging
crowecawcaw cb79396
fix: fall back to name-based app matching for Linux AT-SPI
crowecawcaw 05a1e1a
fix: handle platform difference in Qt tab role names
crowecawcaw 0a6d42e
fix: try multiple tab role names and dump diagnostics on failure
crowecawcaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| name: UI Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [mainline, release] | ||
| pull_request: | ||
| branches: [mainline, release, feature_assets_cli, 'patch_*', 'feature_*'] | ||
|
|
||
| jobs: | ||
| ui-test-linux: | ||
| name: UI Tests (Linux) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.13' | ||
|
|
||
| - name: Install system dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y \ | ||
| xvfb dbus dbus-x11 at-spi2-core \ | ||
| libxkbcommon-x11-0 libxcb-cursor0 libxcb-icccm4 \ | ||
| libxcb-keysyms1 libxcb-image0 libxcb-render-util0 \ | ||
| libxcb-xkb1 libegl1 libglib2.0-0 libfontconfig1 \ | ||
| libdbus-1-3 libx11-xcb1 libxcb-render0 libxcb-shape0 \ | ||
| libxcb-xfixes0 | ||
|
|
||
| - name: Install hatch | ||
| run: pip install hatch | ||
|
|
||
| - name: Ensure management.localhost resolves | ||
| run: echo "127.0.0.1 management.localhost" | sudo tee -a /etc/hosts | ||
|
|
||
| - name: Run UI tests (CLI only) | ||
| run: hatch run ui:test test/ui/test_cli_mock_server.py --timeout=120 | ||
|
|
||
| - name: Run UI tests (all, with accessibility) | ||
| run: | | ||
| dbus-run-session -- bash -c ' | ||
| set -e | ||
|
|
||
| # Start Xvfb | ||
| Xvfb :99 -screen 0 1280x1024x24 -ac & | ||
| export DISPLAY=:99 | ||
| sleep 1 | ||
|
|
||
| # Enable AT-SPI2 accessibility | ||
| export NO_AT_BRIDGE=0 | ||
| export AT_SPI_CLIENT=true | ||
| export ACCESSIBILITY_ENABLED=1 | ||
| export QT_ACCESSIBILITY=1 | ||
| export QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1 | ||
|
|
||
| # Start AT-SPI2 bus and registry | ||
| /usr/libexec/at-spi-bus-launcher --launch-immediately & | ||
| sleep 1 | ||
| /usr/libexec/at-spi2-registryd & | ||
| sleep 1 | ||
|
|
||
| # Enable accessibility on the AT-SPI bus | ||
| dbus-send --session --print-reply --dest=org.a11y.Bus /org/a11y/bus \ | ||
| org.freedesktop.DBus.Properties.Set \ | ||
| string:org.a11y.Status string:IsEnabled variant:boolean:true 2>/dev/null || true | ||
| dbus-send --session --print-reply --dest=org.a11y.Bus /org/a11y/bus \ | ||
| org.freedesktop.DBus.Properties.Set \ | ||
| string:org.a11y.Status string:ScreenReaderEnabled variant:boolean:true 2>/dev/null || true | ||
|
|
||
| echo "DISPLAY=$DISPLAY" | ||
| echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" | ||
|
|
||
| hatch run ui:test --timeout=120 | ||
| ' | ||
|
|
||
| ui-test-macos: | ||
| name: UI Tests (macOS) | ||
| runs-on: macos-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.13' | ||
|
|
||
| - name: Install hatch | ||
| run: pip install hatch | ||
|
|
||
| - name: Create hatch ui environment | ||
| run: hatch env create ui | ||
|
|
||
| - name: Ensure management.localhost resolves | ||
| run: echo "127.0.0.1 management.localhost" | sudo tee -a /etc/hosts | ||
|
|
||
| - name: Grant accessibility TCC permission | ||
| run: | | ||
| HATCH_PYTHON=$(hatch -e ui run python -c "import os,sys; print(os.path.realpath(sys.executable))") | ||
| SETUP_PYTHON=$(python3 -c "import os,sys; print(os.path.realpath(sys.executable))") | ||
| for PYTHON_PATH in "$SETUP_PYTHON" "$HATCH_PYTHON"; do | ||
| echo "Granting TCC kTCCServiceAccessibility to: $PYTHON_PATH" | ||
| sudo sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" \ | ||
| "INSERT OR REPLACE INTO access(service,client,client_type,auth_value,auth_reason,auth_version,csreq,policy_id,indirect_object_identifier_type,indirect_object_identifier,indirect_object_code_identity,flags,last_modified) \ | ||
| VALUES('kTCCServiceAccessibility','${PYTHON_PATH}',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,$(date +%s));" | ||
| done | ||
| sudo launchctl stop com.apple.tccd 2>/dev/null || true | ||
| sleep 2 | ||
|
|
||
| - name: Run UI tests (all) | ||
| env: | ||
| QT_ACCESSIBILITY: "1" | ||
| run: hatch run ui:test --timeout=120 | ||
|
|
||
| ui-test-windows: | ||
| name: UI Tests (Windows) | ||
| runs-on: windows-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.13' | ||
|
|
||
| - name: Install hatch | ||
| run: pip install hatch | ||
|
|
||
| - name: Ensure management.localhost resolves | ||
| run: | | ||
| Add-Content -Path "$env:SystemRoot\System32\drivers\etc\hosts" -Value "`n127.0.0.1 management.localhost" | ||
| shell: pwsh | ||
|
|
||
| - name: Run UI tests (CLI only) | ||
| env: | ||
| QT_ACCESSIBILITY: "1" | ||
| run: hatch run ui:test test/ui/test_cli_mock_server.py --timeout=120 | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pytest == 9.* | ||
| pytest-timeout >= 2.3 | ||
| pytest-cov >= 4 | ||
| pytest-xdist >= 3 | ||
| xa11y == 0.6.* |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
|
|
||
| """Standalone entry point: python -m test.mock_server""" | ||
|
|
||
| from ._server import create_server | ||
|
|
||
|
|
||
| def main() -> None: | ||
| server = create_server(port=8000) | ||
| _, port = server.server_address # type: ignore[misc] | ||
| print(f"Mock Deadline server listening on http://localhost:{port}") | ||
| print("Set AWS_ENDPOINT_URL_DEADLINE=http://localhost:8000 to use with the deadline CLI") | ||
| try: | ||
| server.serve_forever() | ||
| except KeyboardInterrupt: | ||
| print("\nShutting down.") | ||
| server.shutdown() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any value in testing on an older instance instead of latest for validating support on older machines?
Another thing to think about is that the underlying machines these alias's point to will sometimes change which could cause difficult to debug errors from dependencies not being available. Maybe not a huge deal because the system dependencies below seem pretty light, but calling it out as something to think about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point about older systems. I think that would be worth testing and GitHub offers ubuntu 2022 as a test runner option. I think OS version coverage might make sense on some sort of end to end test which also exercises the installer and DCM? I imagined these particular UI tests being more aimed at making sure the UI code is correct. I don't feel strongly and am open to ideas.
Also good point that the image will change over time and maybe the list of dependencies will not be correct. I don't think it'll be too painful since these tests run when the PR is raised so they're quick to update and validate (as opposed to e.g. CDK managed pipelines with canaries).
Also, on your comment about DCC testing: IMO it'd be great to run larger e2e or DCC tests in GitHub actions too since actions are easy to set up, easy to fork, and support all major OSes. It looks like GitHub has some test runners with GPUs but maybe they require opting in and paying. Or alternatively, there might be ways to get a soft GPU that's sufficient for opening Blender. I think tests like this would belong in a separate suite. But they would be amazing to add.