Skip to content

Commit 642f892

Browse files
committed
overhaul CM poking
1 parent b763a1d commit 642f892

File tree

19 files changed

+152
-19
lines changed

19 files changed

+152
-19
lines changed

atest/acceptance/classic/10_notebook.robot

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Library Process
88
IPython Notebook on Classic
99
Open Notebook Classic
1010
Launch a new Notebook Classic Notebook
11-
Add and Run Notebook Classic Code Cell
11+
Add and Run Notebook Classic Code Cell print("hello world")
1212
Wait Until Notebook Classic Kernel Is Idle
13+
Current Notebook Classic Cell Output Should Contain hello world
1314
Capture Page Screenshot classic${/}ipython.png

atest/acceptance/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
1313
Open With JupyterLab Menu Help About JupyterLab
14-
Capture Element Screenshot css:.jp-Dialog-content about.png
14+
Capture Element Screenshot css:.jp-Dialog-content lab${/}about.png
1515
Click Element css:${JLAB CSS ACCEPT}

atest/acceptance/lab/10_notebook.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ IPython Notebook on Lab
1111
Launch a new JupyterLab Document
1212
Add and Run JupyterLab Code Cell print("hello world")
1313
Wait Until JupyterLab Kernel Is Idle
14+
Current JupyterLab Cell Output Should Contain hello world
1415
Capture Page Screenshot lab${/}ipython.png
1516

1617
IPython Notebook Outputs on Lab

atest/acceptance/nteract/10_notebook.robot

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Library Process
88
IPython Notebook on nteract
99
Open nteract
1010
Launch a new nteract Notebook
11-
Add and Run nteract Code Cell
11+
Add and Run nteract Code Cell print("hello world")
1212
Wait Until nteract Kernel Is Idle
13+
Current nteract Cell Output Should Contain hello world
1314
Capture Page Screenshot nteract${/}ipython.png

ci/job.combine.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ parameters:
44

55
jobs:
66
- job: Combine
7+
condition: always()
78
pool:
89
vmImage: ${{ parameters.vmImage }}
910
dependsOn:
@@ -24,13 +25,15 @@ jobs:
2425
artifactName: Windows Tests
2526
targetPath: _artifacts/test_output
2627
- template: steps.conda.yml
28+
condition: always()
2729
parameters:
2830
name: Linux
2931
- script: python -m scripts.combine
32+
condition: always()
3033
displayName: Rebot
3134
- task: PublishBuildArtifacts@1
35+
condition: always()
3236
displayName: Publish Robot Logs
3337
inputs:
3438
PathtoPublish: _artifacts/test_output
3539
ArtifactName: Combined Robot Logs
36-
condition: always()

docs/KEYWORDS.ipynb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,42 @@
117117
"source": [
118118
"iframe(\"nteract_on_jupyter\")"
119119
]
120+
},
121+
{
122+
"cell_type": "markdown",
123+
"metadata": {},
124+
"source": [
125+
"## Common\n",
126+
"A number of libraries are shared between multiple frontends, and so can use the same underlying keywords."
127+
]
128+
},
129+
{
130+
"cell_type": "markdown",
131+
"metadata": {},
132+
"source": [
133+
"### CodeMirror\n",
134+
"The real workhorse of the Jupyter code editing experience, [CodeMirror](https://codemirror.net) is used by JupyterLab, Notebook Classic and nteract."
135+
]
136+
},
137+
{
138+
"cell_type": "code",
139+
"execution_count": null,
140+
"metadata": {
141+
"jupyter": {
142+
"source_hidden": true
143+
}
144+
},
145+
"outputs": [],
146+
"source": [
147+
"iframe(\"codemirror\")"
148+
]
149+
},
150+
{
151+
"cell_type": "code",
152+
"execution_count": null,
153+
"metadata": {},
154+
"outputs": [],
155+
"source": []
120156
}
121157
],
122158
"metadata": {

docs/conf.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import nbsphinx
1111

1212
# you have to have run `python -m pip install -e`
13-
from JupyterLibrary.core import CLIENTS
13+
from JupyterLibrary.core import CLIENTS, COMMON
1414

1515

1616
def setup(app):
@@ -47,6 +47,19 @@ def setup(app):
4747
]
4848
)
4949

50+
for common_file in COMMON:
51+
common = Path(common_file)
52+
common_name = common.name.lower().replace(".robot", "")
53+
subprocess.run(
54+
[
55+
sys.executable,
56+
"-m",
57+
"robot.libdoc",
58+
common,
59+
str(here / "_static" / f"{common_name}.html"),
60+
]
61+
)
62+
5063
app.add_css_file("css/custom.css")
5164

5265

src/JupyterLibrary/clients/jupyterlab/Launcher.robot

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Launch a new JupyterLab Document
88
... Notebook or Console with the given ``kernel``, and wait until the loading
99
... animation is complete.
1010
Click Element xpath:${JLAB XP CARD}\[@title='${kernel}'][@data-category='${category}']
11+
Run Keyword And Ignore Error timeout=0.1s Wait Until Page Contains Element css:${JLAB CSS SPINNER}
1112
Wait Until Page Does Not Contain Element css:${JLAB CSS SPINNER}
12-
Wait Until Page Contains Element css:${JLAB CSS CELL}
13+
Wait Until Page Contains Element css:${JLAB CSS ACTIVE INPUT}
1314
Sleep 0.1s

src/JupyterLibrary/clients/jupyterlab/Notebook.robot

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
*** Settings ***
22
Resource JupyterLibrary/clients/jupyterlab/Selectors.robot
3+
Resource JupyterLibrary/common/CodeMirror.robot
4+
35

46
*** Keywords ***
57
Add and Run JupyterLab Code Cell
68
[Arguments] ${code}=print("hello world")
79
[Documentation] Add a ``code`` cell to the currently active notebook and run it.
810
Click Element css:${JLAB CSS NB TOOLBAR} ${JLAB CSS ICON ADD}
911
Sleep 0.1s
10-
Click Element css:${JLAB CSS CELL}
11-
Execute JavaScript document.querySelector("${JLAB CSS CELL}").CodeMirror.setValue(`${code}`)
12+
${cell} = Get WebElement css:${JLAB CSS ACTIVE INPUT}
13+
Click Element ${cell}
14+
Set CodeMirror Value ${JLAB CSS ACTIVE INPUT} ${code}
1215
Click Element css:${JLAB CSS ICON RUN}
16+
Click Element ${cell}
1317

1418
Wait Until JupyterLab Kernel Is Idle
1519
[Documentation] Wait for a kernel to be busy, and then stop being busy

src/JupyterLibrary/clients/jupyterlab/Output.robot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Resource JupyterLibrary/clients/jupyterlab/Selectors.robot
33

44
*** Keywords ***
5+
Current JupyterLab Cell Output Should Contain
6+
[Arguments] ${expected}
7+
Element Should Contain css:${JLAB CSS ACTIVE OUTPUT CHILDREN} ${expected}
8+
9+
510
Screenshot Each Output of Active JupyterLab Cell
611
[Arguments] ${prefix}
712
[Documentation] Capture all of the outputs of the current Cell as screenshots

0 commit comments

Comments
 (0)