-
Notifications
You must be signed in to change notification settings - Fork 54
UI visual regression testing to cover UI widgets visibility #674
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
Merged
openshift-merge-bot
merged 2 commits into
project-codeflare:main
from
Ygnas:RHOAIENG-12525
Sep 23, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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,113 @@ | ||
name: UI notebooks tests | ||
|
||
on: | ||
pull_request: | ||
types: [labeled] | ||
|
||
concurrency: | ||
group: ${{ github.head_ref }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
CODEFLARE_OPERATOR_IMG: "quay.io/project-codeflare/codeflare-operator:dev" | ||
|
||
jobs: | ||
verify-3_widget_example: | ||
if: ${{ github.event.label.name == 'test-guided-notebooks' || github.event.label.name == 'test-ui-notebooks'}} | ||
runs-on: ubuntu-20.04-4core | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Checkout common repo code | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: "project-codeflare/codeflare-common" | ||
ref: "main" | ||
path: "common" | ||
|
||
- name: Checkout CodeFlare operator repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: project-codeflare/codeflare-operator | ||
path: codeflare-operator | ||
|
||
- name: Set Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: "./codeflare-operator/go.mod" | ||
cache-dependency-path: "./codeflare-operator/go.sum" | ||
|
||
- name: Set up gotestfmt | ||
uses: gotesttools/gotestfmt-action@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up specific Python version | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.9" | ||
cache: "pip" # caching pip dependencies | ||
|
||
- name: Setup and start KinD cluster | ||
uses: ./common/github-actions/kind | ||
|
||
- name: Deploy CodeFlare stack | ||
id: deploy | ||
run: | | ||
cd codeflare-operator | ||
echo Setting up CodeFlare stack | ||
make setup-e2e | ||
echo Deploying CodeFlare operator | ||
make deploy -e IMG="${CODEFLARE_OPERATOR_IMG}" -e ENV="e2e" | ||
kubectl wait --timeout=120s --for=condition=Available=true deployment -n openshift-operators codeflare-operator-manager | ||
cd .. | ||
|
||
- name: Setup Guided notebooks execution | ||
run: | | ||
echo "Installing papermill and dependencies..." | ||
pip install poetry ipython ipykernel | ||
poetry config virtualenvs.create false | ||
echo "Installing SDK..." | ||
poetry install --with test,docs | ||
|
||
- name: Install Yarn dependencies | ||
run: | | ||
poetry run yarn install | ||
poetry run yarn playwright install chromium | ||
working-directory: ui-tests | ||
|
||
- name: Fix 3_widget_example.ipynb notebook for test | ||
run: | | ||
# Remove login/logout cells, as KinD doesn't support authentication using token | ||
jq -r 'del(.cells[] | select(.source[] | contains("Create authentication object for user permissions")))' 3_widget_example.ipynb > 3_widget_example.ipynb.tmp && mv 3_widget_example.ipynb.tmp 3_widget_example.ipynb | ||
jq -r 'del(.cells[] | select(.source[] | contains("auth.logout()")))' 3_widget_example.ipynb > 3_widget_example.ipynb.tmp && mv 3_widget_example.ipynb.tmp 3_widget_example.ipynb | ||
# Set explicit namespace as SDK need it (currently) to resolve local queues | ||
sed -i "s/head_memory_limits=2,/head_memory_limits=2, namespace='default',/" 3_widget_example.ipynb | ||
working-directory: demo-notebooks/guided-demos | ||
|
||
- name: Run UI notebook tests | ||
run: | | ||
set -euo pipefail | ||
|
||
poetry run yarn test | ||
working-directory: ui-tests | ||
|
||
- name: Upload Playwright Test assets | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ipywidgets-test-assets | ||
path: | | ||
ui-tests/test-results | ||
|
||
- name: Upload Playwright Test report | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ipywidgets-test-report | ||
path: | | ||
ui-tests/playwright-report |
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,119 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8d4a42f6", | ||
"metadata": {}, | ||
"source": [ | ||
"In this notebook, we will go through the basics of using the SDK to:\n", | ||
" - Spin up a Ray cluster with our desired resources\n", | ||
" - View the status and specs of our Ray cluster\n", | ||
" - Take down the Ray cluster when finished" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b55bc3ea-4ce3-49bf-bb1f-e209de8ca47a", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Import pieces from codeflare-sdk\n", | ||
"from codeflare_sdk import Cluster, ClusterConfiguration, TokenAuthentication" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "614daa0c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Create authentication object for user permissions\n", | ||
"# IF unused, SDK will automatically check for default kubeconfig, then in-cluster config\n", | ||
"# KubeConfigFileAuthentication can also be used to specify kubeconfig path manually\n", | ||
"auth = TokenAuthentication(\n", | ||
" token = \"XXXXX\",\n", | ||
" server = \"XXXXX\",\n", | ||
" skip_tls=False\n", | ||
")\n", | ||
"auth.login()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "bc27f84c", | ||
"metadata": {}, | ||
"source": [ | ||
"Here, we want to define our cluster by specifying the resources we require for our batch workload. Below, we define our cluster object (which generates a corresponding RayCluster).\n", | ||
"\n", | ||
"NOTE: 'quay.io/modh/ray:2.35.0-py39-cu121' is the default image used by the CodeFlare SDK for creating a RayCluster resource. \n", | ||
"If you have your own Ray image which suits your purposes, specify it in image field to override the default image." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "0f4bc870-091f-4e11-9642-cba145710159", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Create and configure our cluster object\n", | ||
"# The SDK will try to find the name of your default local queue based on the annotation \"kueue.x-k8s.io/default-queue\": \"true\" unless you specify the local queue manually below\n", | ||
"cluster = Cluster(ClusterConfiguration(\n", | ||
" name='raytest', \n", | ||
" head_cpu_requests='500m',\n", | ||
" head_cpu_limits='500m',\n", | ||
" head_memory_requests=2,\n", | ||
" head_memory_limits=2,\n", | ||
" head_extended_resource_requests={'nvidia.com/gpu':0}, # For GPU enabled workloads set the head_extended_resource_requests and worker_extended_resource_requests\n", | ||
" worker_extended_resource_requests={'nvidia.com/gpu':0},\n", | ||
" num_workers=2,\n", | ||
" worker_cpu_requests='250m',\n", | ||
" worker_cpu_limits=1,\n", | ||
" worker_memory_requests=2,\n", | ||
" worker_memory_limits=2,\n", | ||
" # image=\"\", # Optional Field \n", | ||
" write_to_file=False, # When enabled Ray Cluster yaml files are written to /HOME/.codeflare/resources \n", | ||
" # local_queue=\"local-queue-name\" # Specify the local queue manually\n", | ||
"))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "2d8e6ce3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"cluster.status()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.19" | ||
}, | ||
"vscode": { | ||
"interpreter": { | ||
"hash": "f9f85f796d01129d0dd105a088854619f454435301f6ffec2fea96ecbd9be4ac" | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.