-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1891 from yuvipanda/binderhub-local
Add playwright based UI integration tests for existing UI
- Loading branch information
Showing
13 changed files
with
393 additions
and
187 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,97 @@ | ||
name: Playwright Tests | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- "**.md" | ||
- "**.rst" | ||
- "docs/**" | ||
- "examples/**" | ||
- ".github/workflows/**" | ||
- "!.github/workflows/playwright.yaml" | ||
push: | ||
paths-ignore: | ||
- "**.md" | ||
- "**.rst" | ||
- "docs/**" | ||
- "examples/**" | ||
- ".github/workflows/**" | ||
- "!.github/workflows/playwright.yaml" | ||
branches-ignore: | ||
- "dependabot/**" | ||
- "pre-commit-ci-update-config" | ||
- "update-*" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 10 | ||
|
||
permissions: | ||
contents: read | ||
env: | ||
GITHUB_ACCESS_TOKEN: "${{ secrets.github_token }}" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup OS level dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install --yes \ | ||
build-essential \ | ||
curl \ | ||
libcurl4-openssl-dev \ | ||
libssl-dev | ||
- uses: actions/setup-node@v4 | ||
id: setup-node | ||
with: | ||
node-version: "22" | ||
|
||
- name: Cache npm | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.npm | ||
key: node-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('**/package.json') }}-${{ github.job }} | ||
|
||
- name: Run webpack to build static assets | ||
run: | | ||
npm install | ||
npm run webpack | ||
- uses: actions/setup-python@v5 | ||
id: setup-python | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/*requirements.txt') }}-${{ github.job }} | ||
|
||
- name: Setup test dependencies | ||
run: | | ||
npm i -g configurable-http-proxy | ||
pip install --no-binary pycurl -r dev-requirements.txt | ||
pip install -e . | ||
- name: Install playwright browser | ||
run: | | ||
playwright install firefox | ||
- name: Run playwright tests | ||
run: | | ||
py.test --cov=binderhub -s integration-tests/ | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-traces | ||
path: test-results/ | ||
|
||
# Upload test coverage info to codecov | ||
- uses: codecov/codecov-action@v5 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""Test legacy redirects""" | ||
|
||
import pytest | ||
|
||
from .utils import async_requests | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"old_url, new_url", | ||
[ | ||
( | ||
"/repo/binderhub-ci-repos/requirements", | ||
"/v2/gh/binderhub-ci-repos/requirements/master", | ||
), | ||
( | ||
"/repo/binderhub-ci-repos/requirements/", | ||
"/v2/gh/binderhub-ci-repos/requirements/master", | ||
), | ||
( | ||
"/repo/binderhub-ci-repos/requirements/notebooks/index.ipynb", | ||
"/v2/gh/binderhub-ci-repos/requirements/master?urlpath=%2Fnotebooks%2Findex.ipynb", | ||
), | ||
], | ||
) | ||
async def test_legacy_redirect(app, old_url, new_url): | ||
r = await async_requests.get(app.url + old_url, allow_redirects=False) | ||
assert r.status_code == 302 | ||
assert r.headers["location"] == new_url |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Test version handler""" | ||
|
||
import pytest | ||
|
||
from binderhub import __version__ as binder_version | ||
|
||
from .utils import async_requests | ||
|
||
|
||
@pytest.mark.remote | ||
async def test_versions_handler(app): | ||
# Check that the about page loads | ||
r = await async_requests.get(app.url + "/versions") | ||
assert r.status_code == 200 | ||
|
||
data = r.json() | ||
# builder_info is different for KubernetesExecutor and LocalRepo2dockerBuild | ||
try: | ||
import repo2docker | ||
|
||
allowed_builder_info = [{"repo2docker-version": repo2docker.__version__}] | ||
except ImportError: | ||
allowed_builder_info = [] | ||
allowed_builder_info.append({"build_image": app.build_image}) | ||
|
||
assert data["builder_info"] in allowed_builder_info | ||
assert data["binderhub"].split("+")[0] == binder_version.split("+")[0] |
Oops, something went wrong.