Skip to content

Commit 90ad158

Browse files
authored
add n to some notebook keywords, settings keywords (#41)
1 parent 4f47bf0 commit 90ad158

18 files changed

+264
-92
lines changed

_scripts/atest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def run_tests(attempt=0, extra_args=None):
6565
f"PY:{P.THIS_PYTHON}",
6666
"--randomize",
6767
"all",
68-
"--xunitskipnoncritical",
6968
"--xunit",
7069
".".join(["xunit", "xml"]),
7170
".",

atest/lab/00_shell.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ Open JupyterLab
1111
Get Help
1212
Open JupyterLab ${BROWSER}
1313
Open With JupyterLab Menu Help About JupyterLab
14-
Capture Element Screenshot css:.jp-Dialog-content lab${/}about.png
14+
Capture Element Screenshot css:.jp-Dialog-content 00-about.png
1515
Click Element css:${JLAB CSS ACCEPT}

atest/lab/10_notebook.robot

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,43 @@ Test Teardown Run Keyword and Ignore Error Reset JupyterLab and Close
44
Default Tags notebook
55
Library JupyterLibrary
66
Library Process
7+
Test Setup Open JupyterLab ${BROWSER}
78

89
*** Test Cases ***
910
IPython Notebook on Lab
10-
Open JupyterLab ${BROWSER}
1111
Launch a new JupyterLab Document
1212
Add and Run JupyterLab Code Cell print("hello world")
1313
Wait Until JupyterLab Kernel Is Idle
1414
Current JupyterLab Cell Output Should Contain hello world
15-
Capture Page Screenshot lab${/}ipython.png
15+
Capture Page Screenshot 10-00-ipython.png
1616
Save JupyterLab Notebook
1717

1818
IPython Notebook Outputs on Lab
19-
Open JupyterLab ${BROWSER}
2019
Launch a new JupyterLab Document
2120
FOR ${i} IN RANGE ${10}
2221
Add and Run JupyterLab Code Cell print("${i} hello world " * ${i ** 2})
2322
END
2423
Wait Until JupyterLab Kernel Is Idle
25-
Screenshot Each Output of Active JupyterLab Document lab${/}ipython_outputs${/}
24+
Screenshot Each Output of Active JupyterLab Document 10-10-outputs
2625
Save JupyterLab Notebook
26+
27+
Multiple Notebooks on Lab
28+
[Tags] notebooks
29+
Disable JupyterLab Modal Command Palette
30+
Launch a new JupyterLab Document
31+
Wait Until JupyterLab Kernel Is Idle
32+
Add and Run JupyterLab Code Cell print("hello world")
33+
Wait Until JupyterLab Kernel Is Idle
34+
Page Should Contain hello world
35+
Capture Page Screenshot 10-20-one-notebook.png
36+
Launch a new JupyterLab Document
37+
${tab1} = Get JupyterLab Dock Panel Tab Untitled1.ipynb
38+
Click Element ${tab1}
39+
Add and Run JupyterLab Code Cell print("yet another world") n=2
40+
Wait Until JupyterLab Kernel Is Idle
41+
Page Should Contain another world
42+
Drag And Drop By Offset ${tab1} 800 500
43+
Capture Page Screenshot 10-21-two-notesbook.png
44+
Close JupyterLab Dock Panel Tab Untitled1.ipynb
45+
Maybe Accept a JupyterLab Prompt
46+
Page Should Not Contain yet another world

atest/lab/20_magic.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ Wait for and Click Text
3131
${sel} = Set Variable xpath://*[contains(text(), '${canary}')]
3232
Wait Until Page Contains Element ${sel}
3333
Click Element ${sel}
34-
Capture Page Screenshot lab${/}magic-${NEXT SCREENSHOT}-${canary}.png
34+
Capture Page Screenshot 20-00-magic-${NEXT SCREENSHOT}-${canary}.png
3535
Set Test Variable ${NEXT SCREENSHOT} ${NEXT SCREENSHOT.__add__(1)}

atest/lab/30_settings.robot

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*** Settings ***
2+
Suite Teardown Run Keyword and Ignore Error Close All Browsers
3+
Test Teardown Run Keyword and Ignore Error Reset JupyterLab and Close
4+
Default Tags settings
5+
Library JupyterLibrary
6+
Library Process
7+
8+
*** Variables ***
9+
${PACKAGE} @jupyterlab/apputils-extension
10+
${PLUGIN} palette
11+
12+
*** Test Cases ***
13+
Command Palette
14+
[Documentation] Verify settings and command palette
15+
Open JupyterLab ${BROWSER}
16+
Disable JupyterLab Modal Command Palette
17+
${config} = Get JupyterLab Plugin Settings ${PACKAGE} ${PLUGIN}
18+
Should Be True not ${config["modal"]}
19+
Enable JupyterLab Modal Command Palette
20+
${config} = Get JupyterLab Plugin Settings ${PACKAGE} ${PLUGIN}
21+
Should Be True ${config["modal"]}

atest/lab/__init__.robot

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
*** Settings ***
2-
Suite Setup Wait for New Jupyter Server to be Ready
2+
Suite Setup Set Up JupyterLab Suite
33
Suite Teardown Terminate All Jupyter Servers
44
Force Tags client:jupyterlab
55
Library JupyterLibrary
6+
7+
*** Keywords ***
8+
Set Up JupyterLab Suite
9+
Wait for New Jupyter Server to be Ready
10+
Set Screenshot Directory ${OUTPUT DIR}${/}lab

docs/HISTORY.ipynb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
"| Products under review | Versions |\n",
2323
"|-----------------------------|--------------------------|\n",
2424
"| JupyterLab Classic | 0.1.10 |\n",
25-
"| Voila | 0.2.9 |"
25+
"| Voila | 0.2.9 |\n",
26+
"\n",
27+
"- Several JupyterLab keywords now accept an `${n}` argument to handle multiple documents on the page.\n",
28+
"- Many JupyterLab keywords that wait for certain events can be configured with `${timeout}` and `${sleep}` to suit."
2629
]
2730
},
2831
{

src/JupyterLibrary/clients/jupyterlab/Commands.robot

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Execute JupyterLab Command
77
[Arguments] ${command} ${accept}=${True} ${close}=${True}
88
[Documentation] Use the JupyterLab
99
... [https://jupyterlab.readthedocs.io/en/stable/user/commands.html|Command Palette]
10-
... to run a command and ``accept`` any resulting dialogs, then ``close``
10+
... to run a ``command`` and ``accept`` any resulting dialogs, then ``close``
1111
... the Command Palette.
1212
Maybe accept a JupyterLab prompt
1313
Open Command Palette with Hotkeys
@@ -18,6 +18,11 @@ Execute JupyterLab Command
1818
Run Keyword If ${close} Maybe Close JupyterLab Sidebar
1919

2020
Open Command Palette with Hotkeys
21+
[Documentation]
22+
... Open the JupyterLab Command Palette with the platform-specific keyboard
23+
... shortcuts. Note that the JupyterLab 3 modal command palette is flaky.
24+
... Enabling the sidebar-based mechanism may help, see:
25+
... - [#Set JupyterLab Plugin Settings|Set JupyterLab Plugin Settings]
2126
${accel} = Get ACCEL key
2227
Press Keys id:main ${accel}+SHIFT+c
2328
Wait Until Page Contains Element css:${JLAB CSS CMD INPUT}

src/JupyterLibrary/clients/jupyterlab/Icons.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Resource JupyterLibrary/clients/jupyterlab/PageInfo.robot
2626
*** Keywords *** ***
2727
Get JupyterLab Icon CSS
2828
[Arguments] ${icon}
29-
[Documentation] Get a Lab version-specific, but general CSS selector for an icon
29+
[Documentation] Get a Lab version-specific, but general CSS selector for an ``icon``.
3030
${version} = Get JupyterLab Application Version Info
3131
${sel} = Set Variable If ${version[0].__eq__('1')}
3232
... ${JLAB1 CSS ICONS['${icon}']}
@@ -35,7 +35,7 @@ Get JupyterLab Icon CSS
3535

3636
Get JupyterLab Icon XPath
3737
[Arguments] ${icon}
38-
[Documentation] Get a Lab version-specific, but general XPath selector for an icon
38+
[Documentation] Get a Lab version-specific, but general XPath selector for an ``icon``.
3939
${version} = Get JupyterLab Application Version Info
4040
${sel} = Set Variable If ${version[0].__eq__('1')}
4141
... ${JLAB1 XP ICONS['${icon}']}

src/JupyterLibrary/clients/jupyterlab/Launcher.robot

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ Resource JupyterLibrary/clients/jupyterlab/Selectors.robot
33

44
*** Keywords ***
55
Launch a new JupyterLab Document
6-
[Arguments] ${kernel}=Python 3 ${category}=Notebook
6+
[Arguments] ${kernel}=Python 3 ${category}=Notebook ${timeout}=10s ${sleep}=0.5s
77
[Documentation] Use the JupyterLab launcher to launch a document of ``category``
88
... Notebook or Console with the given ``kernel``, and wait until the loading
99
... animation is complete.
10-
Wait Until Page Contains Element xpath:${JLAB XP CARD} timeout=10s
10+
${launcher} = Get WebElements xpath:${JLAB XP LAUNCHER}
11+
Run Keyword If not ${launcher.__len__()} Execute JupyterLab Command New Launcher
12+
Wait Until Page Contains Element xpath:${JLAB XP CARD} timeout=${timeout}
1113
Click Element xpath:${JLAB XP CARD}\[@title='${kernel}'][@data-category='${category}']
1214
Run Keyword And Ignore Error
1315
... Wait Until Page Contains Element css:${JLAB CSS SPINNER}
1416
Run Keyword And Ignore Error
1517
... Wait Until Page Does Not Contain Element css:${JLAB CSS SPINNER}
1618
Wait Until Page Contains Element css:${JLAB CSS ACTIVE INPUT}
17-
Sleep 0.5s
19+
Sleep ${sleep}

0 commit comments

Comments
 (0)