Skip to content

Commit b895b4e

Browse files
authored
Merge pull request #809 from jupyter-lsp/fix-ci-for-lab-3.4
Fix CI regressions, make tests work with JupyterLab 3.4
2 parents c8727ef + ae73ae3 commit b895b4e

24 files changed

+126
-65
lines changed

atest/00_Smoke.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Resource Keywords.resource
33

44
Suite Setup Set Screenshot Directory ${SCREENSHOTS DIR}${/}smoke
55

6+
67
*** Test Cases ***
78
Lab Version
89
Capture Page Screenshot 00-smoke.png

atest/01_Editor.robot

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Suite Setup Setup Suite For Screenshots editor
66

77
Force Tags ui:editor aspect:ls:features
88

9+
910
*** Test Cases ***
1011
Bash
1112
Editor Shows Features for Language Bash example.sh Diagnostics=Failed to parse expression
@@ -54,8 +55,13 @@ Markdown
5455

5556
Python (pylsp)
5657
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'fib')])[last()]
57-
Editor Shows Features for Server pylsp Python example.py Diagnostics=undefined name 'result' (pyflakes)
58-
... Jump to Definition=${def} Rename=${def}
58+
Editor Shows Features for Server
59+
... pylsp
60+
... Python
61+
... example.py
62+
... Diagnostics=undefined name 'result' (pyflakes)
63+
... Jump to Definition=${def}
64+
... Rename=${def}
5965

6066
Python (pyright)
6167
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'fib')])[last()]
@@ -69,7 +75,8 @@ R
6975

7076
Robot Framework
7177
[Tags] gh:332
72-
${def} = Set Variable xpath:(//span[contains(@class, 'cm-keyword')][contains(text(), 'Special Log')])[last()]
78+
${def} = Set Variable
79+
... xpath:(//span[contains(@class, 'cm-keyword')][contains(text(), 'Special Log')])[last()]
7380
Editor Shows Features for Language Robot Framework example.robot Diagnostics=Undefined keyword
7481
... Jump to Definition=${def}
7582

@@ -95,6 +102,7 @@ SQL
95102
YAML
96103
Editor Shows Features for Language YAML example.yaml Diagnostics=Map keys must be unique
97104

105+
98106
*** Keywords ***
99107
Editor Shows Features for Server
100108
[Arguments] ${server} ${Language} ${file} &{features}
@@ -138,7 +146,7 @@ Editor Content Changed
138146
[Arguments] ${old_content}
139147
${new_content} = Get Editor Content
140148
Should Not Be Equal ${old_content} ${new_content}
141-
[Return] ${new_content}
149+
RETURN ${new_content}
142150

143151
Editor Should Rename
144152
[Arguments] ${symbol}

atest/02_Settings.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Resource Keywords.resource
33

44
Suite Setup Setup Suite For Screenshots settings
55

6+
67
*** Test Cases ***
78
Settings
89
Open in Advanced Settings ${LSP PLUGIN ID}

atest/03_Notebook.robot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Resource Keywords.resource
44
Suite Setup Setup Suite For Screenshots notebook
55
Test Setup Try to Close All Tabs
66

7+
78
*** Test Cases ***
89
Python
910
[Setup] Setup Notebook Python Python.ipynb
@@ -101,6 +102,7 @@ Adding Text To Cells After Kernel Restart
101102
Wait Until Keyword Succeeds 3x 1s File Content Should Be Equal ${virtual_path} \n\n\ntext\n
102103
[Teardown] Clean Up After Working With File Empty.ipynb
103104

105+
104106
*** Keywords ***
105107
File Content Should Be Equal
106108
[Arguments] ${file} ${text}

atest/04_Interface/BackendFailure.robot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ Resource ../Keywords.resource
44
Suite Setup Setup Server and Browser server_extension_enabled=${False}
55
Suite Teardown Setup Server and Browser server_extension_enabled=${True}
66

7+
78
*** Variables ***
89
${STATUSBAR} css:div.lsp-statusbar-item
910
${POPOVER} css:.lsp-popover
1011

12+
1113
*** Test Cases ***
1214
Handles Server Extension Failure
1315
Setup Notebook Python Python.ipynb wait=${False}

atest/04_Interface/DiagnosticsPanel.robot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Test Teardown Clean Up
77

88
Force Tags ui:notebook aspect:ls:features
99

10+
1011
*** Variables ***
1112
${DIAGNOSTIC MESSAGE R} Closing curly-braces should always be on their own line
1213
${DIAGNOSTIC MESSAGE} trailing whitespace
@@ -15,6 +16,7 @@ ${EXPECTED_COUNT} 4
1516
${MENU COLUMNS} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "columns")]
1617
${R CELL} %%R\n{}
1718

19+
1820
*** Test Cases ***
1921
Diagnostics Panel Opens
2022
Capture Page Screenshot 03-panel-opens.png
@@ -121,6 +123,7 @@ Diagnostics Panel Works After Removing Foreign Document
121123
Wait Until Keyword Succeeds 10 x 1s Element Should Not Contain ${DIAGNOSTICS PANEL}
122124
... ${DIAGNOSTIC MESSAGE R}
123125

126+
124127
*** Keywords ***
125128
Open Context Menu Over W291
126129
Click Element css:.lsp-diagnostics-listing th[data-id="Code"]

atest/04_Interface/Statusbar.robot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ Resource ../Keywords.resource
33

44
Suite Setup Setup Suite For Screenshots statusbar
55

6+
67
*** Variables ***
78
${STATUSBAR} css:div.lsp-statusbar-item
89
${DIAGNOSTIC} W291 trailing whitespace (pycodestyle)
910
${POPOVER} css:.lsp-popover
1011
${HELP_BUTTON} css:.lsp-popover .lsp-help-button
1112

13+
1214
*** Test Cases ***
1315
Statusbar Popup Opens
1416
Setup Notebook Python Python.ipynb
@@ -68,6 +70,7 @@ Status Changes Correctly Between Editors
6870
Wait Until Element Contains ${STATUSBAR} Initialized (additional servers needed) timeout=60s
6971
[Teardown] Clean Up After Working With File example.plain
7072

73+
7174
*** Keywords ***
7275
Switch To Tab
7376
[Arguments] ${file}

atest/05_Features/Completion.robot

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ Test Teardown Clean Up After Working With File Completion.ipynb
77

88
Force Tags feature:completion
99

10+
1011
*** Variables ***
1112
${COMPLETER_BOX} css:.jp-Completer.jp-HoverBox
1213
${DOCUMENTATION_PANEL} css:.jp-Completer-docpanel
13-
${KERNEL_BUSY_INDICATOR} css:.jp-NotebookPanel-toolbar div[title="Kernel Busy"]
14+
${KERNEL_BUSY_INDCA_OLD} css:.jp-NotebookPanel-toolbar div[title="Kernel Busy"]
15+
${KERNEL_BUSY_INDICATOR} css:.jp-Notebook-ExecutionIndicator div[data-status="busy"]
16+
1417

1518
*** Test Cases ***
1619
Works When Kernel Is Idle
@@ -89,8 +92,8 @@ Uses LSP Completions When Kernel Resoponse Times Out
8992
Should Complete While Kernel Is Busy
9093

9194
Uses LSP Completions When Kernel Is Busy
92-
[Tags] requires:busy-indicator
9395
[Documentation] When kernel is not available the best thing is to show some suggestions (LSP) rather than none.
96+
[Tags] requires:busy-indicator
9497
Configure JupyterLab Plugin {"kernelResponseTimeout": -1, "waitForBusyKernel": false}
9598
... plugin id=${COMPLETION PLUGIN ID}
9699
Should Complete While Kernel Is Busy
@@ -357,6 +360,7 @@ Completes Paths In Strings
357360
Press Keys None ENTER
358361
Wait Until Keyword Succeeds 40x 0.5s Cell Editor Should Equal 26 '../Completion.ipynb'
359362

363+
360364
*** Keywords ***
361365
Setup Completion Test
362366
Setup Notebook Python Completion.ipynb
@@ -365,12 +369,12 @@ Get Cell Editor Content
365369
[Arguments] ${cell_nr}
366370
${content} = Execute JavaScript
367371
... return document.querySelector('.jp-Cell:nth-child(${cell_nr}) .CodeMirror').CodeMirror.getValue()
368-
[Return] ${content}
372+
RETURN ${content}
369373

370374
Get File Editor Content
371375
${content} = Execute JavaScript
372376
... return document.querySelector('.jp-FileEditorCodeWrapper .CodeMirror').CodeMirror.getValue()
373-
[Return] ${content}
377+
RETURN ${content}
374378

375379
Cell Editor Should Equal
376380
[Arguments] ${cell} ${value}
@@ -392,7 +396,7 @@ Activate Completer Suggestion
392396
Capture Page Screenshot ${i}-completions.png
393397
${matching_active_elements} = Get Element Count ${active_suggestion}
394398
LOG ${matching_active_elements}
395-
Exit For Loop If ${matching_active_elements} == 1
399+
IF ${matching_active_elements} == 1 BREAK
396400
Press Keys None DOWN
397401
Sleep 0.1s
398402
END
@@ -408,12 +412,14 @@ Select Completer Suggestion
408412

409413
Completer Should Suggest
410414
[Arguments] ${text} ${timeout}=10s
411-
Wait Until Page Contains Element ${COMPLETER_BOX} .jp-Completer-item[data-value="${text}"] timeout=${timeout}
415+
Wait Until Page Contains Element
416+
... ${COMPLETER_BOX} .jp-Completer-item[data-value="${text}"]
417+
... timeout=${timeout}
412418

413419
Get Completion Item Vertical Position
414420
[Arguments] ${text}
415421
${position} = Get Vertical Position ${COMPLETER_BOX} .jp-Completer-item[data-value="${text}"]
416-
[Return] ${position}
422+
RETURN ${position}
417423

418424
Completer Should Include Icon
419425
[Arguments] ${icon}
@@ -437,7 +443,7 @@ Completer Should Include Documentation
437443

438444
Count Completer Hints
439445
${count} = Get Element Count css:.jp-Completer-item
440-
[Return] ${count}
446+
RETURN ${count}
441447

442448
Should Complete While Kernel Is Busy
443449
# Run the cell with sleep(20)
@@ -446,12 +452,20 @@ Should Complete While Kernel Is Busy
446452
# Lab Command Run Selected Cells And Don't Advance
447453
Press Keys None CTRL+ENTER
448454
# Confirm that the kernel is busy
449-
Wait Until Page Contains Element ${KERNEL_BUSY_INDICATOR} timeout=5s
455+
IF '${LAB VERSION}'.startswith('3.4')
456+
Wait Until Page Contains Element ${KERNEL_BUSY_INDICATOR} timeout=5s
457+
ELSE
458+
Wait Until Page Contains Element ${KERNEL_BUSY_INDCA_OLD} timeout=5s
459+
END
450460
# Enter a cell with "t"
451461
Enter Cell Editor 18
452462
# Check if completion worked
453463
Enter Cell Editor 1 line=2
454464
Trigger Completer timeout=10s
455465
Completer Should Suggest test
456466
# Confirm that the kernel indicator was busy all along
457-
Page Should Contain Element ${KERNEL_BUSY_INDICATOR}
467+
IF '${LAB VERSION}'.startswith('3.4')
468+
Page Should Contain Element ${KERNEL_BUSY_INDICATOR}
469+
ELSE
470+
Page Should Contain Element ${KERNEL_BUSY_INDCA_OLD}
471+
END

atest/05_Features/Diagnostics.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Test Teardown Clean Up After Working With File Diagnostic.ipynb
88
Force Tags feature:diagnostics
99
# note: diagnostics are also tested in 01_Editor and 04_Interface/DiagnosticsPanel.robot
1010

11+
1112
*** Test Cases ***
1213
Diagnostics with deprecated tag have strike-through decoration
1314
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title*="is deprecated"] timeout=25s

atest/05_Features/Highlights.robot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Test Teardown Clean Up After Working With File Highlights.ipynb
77

88
Force Tags feature:highlights
99

10+
1011
*** Test Cases ***
1112
# cursor is symbolized by pipe (|), for example when
1213
# it is at the end of line, after `1` in `test = 1`
@@ -60,6 +61,7 @@ Highlights are removed when no cell is focused
6061
Blur Cell Editor 1
6162
Should Highlight Token test
6263

64+
6365
*** Keywords ***
6466
Should Not Highlight Any Tokens
6567
Page Should Not Contain css:.cm-lsp-highlight

0 commit comments

Comments
 (0)