Skip to content

Commit

Permalink
minimize-complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Nov 17, 2023
1 parent ba01863 commit 48cbe76
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 73 deletions.
15 changes: 3 additions & 12 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022]
python-version: ["3.8", "3.11"]
pip-extras: ["lab", "classic"]
exclude:
# windows should work for all test variations, but a limited selection
# is run to avoid doubling the amount of test runs
- os: windows-2022
python-version: "3.11"
pip-extras: classic
- os: windows-2022
python-version: "3.8"
pip-extras: lab
os: [ubuntu-22.04]
python-version: ["3.11"]
pip-extras: ["lab"]

steps:
- uses: actions/checkout@v4
Expand Down
23 changes: 0 additions & 23 deletions tests/acceptance/Lab.robot
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,12 @@ Suite Setup Start Lab Tests
Test Tags app:lab


*** Variables ***
${CSS_LAUNCHER_CARD} css:.jp-LauncherCard-label

*** Test Cases ***
Lab Loads
Capture Page Screenshot 00-smoke.png

Launch Browser Tab
Click Launcher foo
Wait Until Keyword Succeeds 3x 0.5s Switch Window title:Hello World
Location Should Contain foo
Wait Until Page Contains Hello World timeout=10s
Close Window
[Teardown] Switch Window title:JupyterLab

Launch Lab Tab
Click Launcher bar
Wait Until Page Contains Element css:iframe
Select Frame css:iframe
Wait Until Page Contains Hello World timeout=10s

*** Keywords ***
Start Lab Tests
Open JupyterLab
Tag With JupyterLab Metadata
Set Screenshot Directory ${OUTPUT DIR}${/}lab

Click Launcher
[Arguments] ${title}
${item} = Set Variable ${CSS_LAUNCHER_CARD}\[title^\="${title}"]
Wait Until Element Is Visible ${item} timeout=10s
Click Element ${item}
44 changes: 6 additions & 38 deletions tests/acceptance/test_acceptance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,25 @@
import subprocess
from pathlib import Path

import pytest

HERE = Path(__file__).parent
OUTPUT = HERE.parent.parent / "build/robot"
JUPYTER_SERVER_INFO = None


try:
import notebook

NOTEBOOK_VERSION = int(notebook.__version__.split(".")[0])
except ImportError:
NOTEBOOK_VERSION = None

try:
import jupyter_server

JUPYTER_SERVER_INFO = jupyter_server.version_info
except ImportError:
pass


def test_robot():
"""run acceptance tests with robotframework"""
pytest.importorskip("JupyterLibrary")

env = dict(**os.environ)
robot_args = [
"robot",
"--consolecolors=on",
"--include=app:lab",
"--exitonfailure",
f"--outputdir={OUTPUT}",
]

if NOTEBOOK_VERSION and NOTEBOOK_VERSION >= 7:
robot_args += ["--exclude", "app:classic"]
else:
robot_args += ["--exclude", "app:notebook"]

# JUPYTER_LIBRARY_* env vars documentation:
# https://robotframework-jupyterlibrary.readthedocs.io/en/stable/LIMITS.html#notebookapp-vs-serverapp
if JUPYTER_SERVER_INFO is None:
env.update(
JUPYTER_LIBRARY_APP_COMMAND="jupyter-notebook",
JUPYTER_LIBRARY_APP="NotebookApp",
)
else:
env.update(
JUPYTER_LIBRARY_APP_COMMAND="jupyter-server",
JUPYTER_LIBRARY_APP="ServerApp",
)
env = dict(**os.environ)
env.update(
JUPYTER_LIBRARY_APP_COMMAND="jupyter-server",
JUPYTER_LIBRARY_APP="ServerApp",
)

if OUTPUT.exists():
shutil.rmtree(OUTPUT)
Expand Down

0 comments on commit 48cbe76

Please sign in to comment.