Skip to content
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

Fix ci end-to-end tests #274

Merged
merged 8 commits into from
Apr 26, 2024
2 changes: 1 addition & 1 deletion .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
check_release:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
group: [check_release, link_check]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:
branches: '*'
jobs:
build:
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu]
os: [ubuntu-22.04]
python-version: [ '3.7' ]
steps:
- name: Checkout
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
downstream:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 15

steps:
Expand All @@ -18,15 +18,9 @@ jobs:
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Test jupyterlab_server
uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
with:
package_name: jupyterlab_server

- name: Test jupyterlab
uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
with:
package_name: jupyterlab
package_spec: "\".[test]\""
test_command: "python -m jupyterlab.browser_check --no-browser-test"

2 changes: 1 addition & 1 deletion .github/workflows/enforce-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [labeled, unlabeled, opened, edited, synchronize]
jobs:
enforce-label:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: enforce-triage-label
uses: jupyterlab/maintainer-tools/.github/actions/enforce-label@v1
6 changes: 3 additions & 3 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
os: [ubuntu-22.04, macos-12]
group: [notebook, base, services]
exclude:
- group: services
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Set up Node
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@ on:
branches: '*'
jobs:
build:
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
os: [ubuntu-22.04, macos-12]
python-version: [ '3.7', '3.8', '3.9', '3.10']
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'

- name: Set up Node
uses: actions/setup-node@v1
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.8"]
exclude:
- os: windows
python-version: pypy-3.8
os: [ubuntu-22.04, macos-12, windows-2022]
python-version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -33,13 +30,8 @@ jobs:
run: |
jupyter nbclassic -h
- name: Test with pytest and coverage
if: ${{ matrix.python-version != 'pypy-3.8' }}
run: |
python -m pytest -vv --cov=nbclassic --cov-report term-missing:skip-covered || python -m pytest -vv --cov=nbclassic --cov-report term-missing:skip-covered
- name: Run the tests on pypy
if: ${{ matrix.python-version == 'pypy-3.8' }}
run: |
python -m pytest -vv || python -m pytest -vv -lf
- name: Test Running Server
if: startsWith(runner.os, 'Linux')
run: |
Expand Down
18 changes: 8 additions & 10 deletions nbclassic/tests/end_to_end/test_save_readonly_as.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"""Test readonly notebook saved and renamed"""


import sys
import traceback

import pytest

from .utils import EDITOR_PAGE, EndToEndTimeout


Expand All @@ -20,7 +23,10 @@ def set_notebook_name(nb, name):
JS = f'() => Jupyter.notebook.rename("{name}")'
nb.evaluate(JS, page=EDITOR_PAGE)


# on Python 3.7 we get an old playwright which hangs on body.press("Escape")
@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python3.8 or higher due to playwright")
# and we also see this fail on osx randomly
@pytest.mark.skipif(sys.platform == 'darwin', reason="fails randomly on osx")
def test_save_readonly_as(notebook_frontend):
print('[Test] [test_save_readonly_as]')
notebook_frontend.wait_for_kernel_ready()
Expand Down Expand Up @@ -114,15 +120,7 @@ def attempt_form_fill_and_save():
save_element.focus()
save_element.click()

# Application lag may cause the save dialog to linger,
# if it's visible wait for it to disappear before proceeding
if save_element.is_visible():
print('[Test] Save element still visible after save, wait for hidden')
try:
save_element.expect_not_to_be_visible(timeout=120)
except EndToEndTimeout as err:
traceback.print_exc()
print('[Test] Save button failed to hide...')
save_element.wait_for('detached')

# Check if the save operation succeeded (by checking notebook name change)
notebook_frontend.wait_for_condition(
Expand Down
3 changes: 2 additions & 1 deletion nbclassic/tests/end_to_end/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,8 @@ def get_page_url(self, page):
else:
raise Exception('Error, provide a valid page to evaluate from!')

return specified_page.url
# specified_page.url seems to give stale values, so we use evaluate instead
return specified_page.evaluate("() => { return window.location.href }")

def go_back(self, page):
if page == TREE_PAGE:
Expand Down
Loading