forked from streamlit/streamlit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow that only runs playwright tests of changed files (stream…
…lit#8739) ## Describe your changes This workflow only runs playwright tests that have been changed within a pull request. This makes it a lot faster to get the relevant test results and screenshots. This will also create trace files for all failed tests that contain a lot more detailed information about the failed test. To test this workflow, I added a couple of reasonable changes to e2e tests. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
- Loading branch information
1 parent
ad3dc4e
commit 2164f52
Showing
36 changed files
with
130 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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,86 @@ | ||
name: Playwright E2E Tests - Changed Files | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
# Avoid duplicate workflows on same branch | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-playwright-changed-files | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest-8-cores | ||
|
||
defaults: | ||
run: | ||
shell: bash --login -eo pipefail {0} | ||
|
||
steps: | ||
- name: Checkout Streamlit code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
persist-credentials: false | ||
submodules: "recursive" | ||
fetch-depth: 2 | ||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
path: e2e_playwright | ||
files: "**/*_test.py" | ||
- name: Check changed files | ||
id: check_changed_files | ||
env: | ||
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_and_modified_files }} | ||
CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_and_modified_files_count }} | ||
run: | | ||
echo "Changed files count: ${CHANGED_FILES_COUNT}" | ||
echo "$CHANGED_FILES" | ||
if [[ "${CHANGED_FILES_COUNT}" -gt 5 || "${CHANGED_FILES_COUNT}" -lt 1 ]]; then | ||
# We limit the workflow to a max of 5 changed files, since otherwise it would | ||
# take too long and would not provide any benefit compared to the main playwright | ||
# workflow. | ||
echo "This workflow only supports between 1-5 changed files. Otherwise its skipping running the tests."; | ||
echo "run_tests=false" >> $GITHUB_OUTPUT | ||
else | ||
echo "run_tests=true" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Use output | ||
run: | | ||
echo "The output value is: ${{ steps.check_changed_files.outputs.run_tests }}" | ||
- name: Set Python version vars | ||
uses: ./.github/actions/build_info | ||
- name: Set up Python ${{ env.PYTHON_MAX_VERSION }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "${{ env.PYTHON_MAX_VERSION }}" | ||
- if: steps.check_changed_files.outputs.run_tests == 'true' | ||
name: Setup virtual env | ||
uses: ./.github/actions/make_init | ||
- if: steps.check_changed_files.outputs.run_tests == 'true' | ||
name: Run make develop | ||
run: make develop | ||
- if: steps.check_changed_files.outputs.run_tests == 'true' | ||
name: Install playwright | ||
run: python -m playwright install --with-deps | ||
- if: steps.check_changed_files.outputs.run_tests == 'true' | ||
name: Run make protobuf | ||
run: make protobuf | ||
- if: steps.check_changed_files.outputs.run_tests == 'true' | ||
name: Run make frontend-fast | ||
run: make frontend-fast | ||
- if: steps.check_changed_files.outputs.run_tests == 'true' | ||
name: Run changed playwright tests | ||
run: | | ||
cd e2e_playwright; | ||
rm -rf ./test-results; | ||
pytest ${{ steps.changed-files.outputs.all_changed_and_modified_files }} --browser webkit --browser chromium --browser firefox --video retain-on-failure --screenshot only-on-failure --full-page-screenshot --tracing retain-on-failure --output ./test-results/ -n auto --durations=5 -r aR -v | ||
- name: Upload failed test results | ||
uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright_test_results | ||
path: e2e_playwright/test-results |
Binary file removed
BIN
-937 Bytes
...ght/__snapshots__/linux/st_json_test/st_json-collapsed[dark_theme-chromium].png
Binary file not shown.
Binary file removed
BIN
-1.23 KB
...ight/__snapshots__/linux/st_json_test/st_json-collapsed[dark_theme-firefox].png
Binary file not shown.
Binary file removed
BIN
-825 Bytes
...right/__snapshots__/linux/st_json_test/st_json-collapsed[dark_theme-webkit].png
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
e2e_playwright/__snapshots__/linux/st_json_test/st_json-collapsed[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-935 Bytes
...ht/__snapshots__/linux/st_json_test/st_json-collapsed[light_theme-chromium].png
Binary file not shown.
Binary file removed
BIN
-1.24 KB
...ght/__snapshots__/linux/st_json_test/st_json-collapsed[light_theme-firefox].png
Binary file not shown.
Binary file removed
BIN
-826 Bytes
...ight/__snapshots__/linux/st_json_test/st_json-collapsed[light_theme-webkit].png
Binary file not shown.
Binary file added
BIN
+15.5 KB
.../__snapshots__/linux/st_json_test/st_json-complex_dict[dark_theme-chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22.7 KB
...t/__snapshots__/linux/st_json_test/st_json-complex_dict[dark_theme-firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.4 KB
...ht/__snapshots__/linux/st_json_test/st_json-complex_dict[dark_theme-webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.6 KB
...__snapshots__/linux/st_json_test/st_json-complex_dict[light_theme-chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22.6 KB
.../__snapshots__/linux/st_json_test/st_json-complex_dict[light_theme-firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.4 KB
...t/__snapshots__/linux/st_json_test/st_json-complex_dict[light_theme-webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+861 Bytes
e2e_playwright/__snapshots__/linux/st_json_test/st_json-empty_dict[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.08 KB
e2e_playwright/__snapshots__/linux/st_json_test/st_json-empty_dict[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+743 Bytes
e2e_playwright/__snapshots__/linux/st_json_test/st_json-empty_dict[webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.19 KB
e2e_playwright/__snapshots__/linux/st_json_test/st_json-simple_dict[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.33 KB
e2e_playwright/__snapshots__/linux/st_json_test/st_json-simple_dict[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2 KB
e2e_playwright/__snapshots__/linux/st_json_test/st_json-simple_dict[webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.03 KB
e2e_playwright/__snapshots__/linux/st_json_test/st_json-simple_list[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.5 KB
e2e_playwright/__snapshots__/linux/st_json_test/st_json-simple_list[firefox].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.91 KB
e2e_playwright/__snapshots__/linux/st_json_test/st_json-simple_list[webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
...wright/__snapshots__/linux/st_json_test/st_json-with_white_spaces[chromium].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-3.14 KB
...apshots__/linux/st_json_test/st_json-with_white_spaces[dark_theme-chromium].png
Binary file not shown.
Binary file removed
BIN
-4.76 KB
...napshots__/linux/st_json_test/st_json-with_white_spaces[dark_theme-firefox].png
Binary file not shown.
Binary file removed
BIN
-2.89 KB
...snapshots__/linux/st_json_test/st_json-with_white_spaces[dark_theme-webkit].png
Diff not rendered.
Binary file modified
BIN
+32 Bytes
(100%)
...ywright/__snapshots__/linux/st_json_test/st_json-with_white_spaces[firefox].png
Oops, something went wrong.
Binary file removed
BIN
-3.17 KB
...pshots__/linux/st_json_test/st_json-with_white_spaces[light_theme-chromium].png
Diff not rendered.
Binary file removed
BIN
-4.76 KB
...apshots__/linux/st_json_test/st_json-with_white_spaces[light_theme-firefox].png
Diff not rendered.
Binary file removed
BIN
-2.93 KB
...napshots__/linux/st_json_test/st_json-with_white_spaces[light_theme-webkit].png
Diff not rendered.
This file contains 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 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 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 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 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