Skip to content

Commit b0e8cab

Browse files
committed
More work on restoring acceptance tests
1 parent 27d11ec commit b0e8cab

File tree

3 files changed

+23
-27
lines changed

3 files changed

+23
-27
lines changed

atest/05_Features/Completion.robot

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Test Tags feature:completion
1212
${COMPLETER_BOX} css:.jp-Completer.jp-HoverBox
1313
${DOCUMENTATION_PANEL} css:.jp-Completer-docpanel
1414
${KERNEL_BUSY_INDICATOR} css:.jp-Notebook-ExecutionIndicator[data-status="busy"]
15+
${MANAGER PLUGIN ID} @jupyterlab/completer-extension:manager
1516

1617

1718
*** Test Cases ***
@@ -148,6 +149,8 @@ Completes In Strings Or Python Dictionaries
148149
Continuous Hinting Works
149150
[Setup] Prepare File for Editing Python completion completion.py
150151
Configure JupyterLab Plugin {"continuousHinting": true} plugin id=${COMPLETION PLUGIN ID}
152+
# TODO: remove once we resolve https://github.com/jupyterlab/jupyterlab/issues/15022
153+
Configure JupyterLab Plugin {"autoCompletion": true} plugin id=${MANAGER PLUGIN ID}
151154
Place Cursor In File Editor At 9 2
152155
Wait For Ready State
153156
Press Keys None d
@@ -193,15 +196,15 @@ User Can Select Lowercase After Starting Uppercase
193196
Mid Token Completions Do Not Overwrite
194197
# `disp<tab>data` → `display_table<cursor>data`
195198
Place Cursor In Cell Editor At 9 line=1 character=4
196-
Wait For Our Completer To Replace Native In Cell 9
199+
Wait For Our Completer To Initialize
197200
Trigger Completer
198201
Completer Should Suggest display_table
199202
Select Completer Suggestion display_table
200203
Capture Page Screenshot 02-completed.png
201204
Wait Until Keyword Succeeds 40x 0.5s Cell Editor Should Equal 9 display_tabledata
202205
# `disp<tab>lay` → `display_table<cursor>`
203206
Place Cursor In Cell Editor At 11 line=1 character=4
204-
Wait For Our Completer To Replace Native In Cell 11
207+
Wait For Our Completer To Initialize
205208
Trigger Completer
206209
Wait For Ready State
207210
Completer Should Suggest display_table
@@ -230,6 +233,7 @@ Kernel And LSP Completions Merge Prefix Conflicts Are Resolved
230233
Wait Until Keyword Succeeds 40x 0.5s Cell Editor Should Equal 15 import os.path
231234

232235
Triggers Completer On Dot
236+
Configure JupyterLab Plugin {"autoCompletion": true} plugin id=${MANAGER PLUGIN ID}
233237
Enter Cell Editor 2 line=1
234238
Press Keys None .
235239
Wait Until Keyword Succeeds 10x 0.5s Cell Editor Should Equal 2 list.
@@ -296,7 +300,7 @@ Completes Correctly With R Double And Triple Colon
296300
[Setup] Prepare File for Editing R completion completion.R
297301
Place Cursor In File Editor At 2 7
298302
Wait Until Fully Initialized
299-
Wait For Our Completer To Replace Native In File Editor
303+
Wait For Our Completer To Initialize
300304
Trigger Completer
301305
Completer Should Suggest .print.via.format
302306
Select Completer Suggestion .print.via.format
@@ -319,9 +323,10 @@ Completes Large Namespaces
319323

320324
Shows Documentation With CompletionItem Resolve
321325
[Setup] Prepare File for Editing R completion completion.R
326+
Configure JupyterLab Plugin {"showDocumentationPanel": true} plugin id=${MANAGER PLUGIN ID}
322327
Place Cursor In File Editor At 8 7
323328
Wait Until Fully Initialized
324-
Wait For Our Completer To Replace Native In File Editor
329+
Wait For Our Completer To Initialize
325330
Trigger Completer
326331
Completer Should Suggest print.data.frame
327332
# if data.frame is not active, activate it (it should be in top 10 on any platform)
@@ -348,7 +353,7 @@ Completes In R Magics
348353
# - R lanugage server is very sensitive to off-by-one errors (see https://github.com/REditorSupport/languageserver/issues/395)
349354
# '%%R\n librar<tab>'
350355
Enter Cell Editor 22 line=2
351-
Wait For Our Completer To Replace Native In Cell 22
356+
Wait For Our Completer To Initialize
352357
Trigger Completer
353358
Completer Should Suggest library
354359
# '%R lib<tab>'
@@ -358,7 +363,7 @@ Completes In R Magics
358363

359364
Completes Paths In Strings
360365
Enter Cell Editor 26
361-
Wait For Our Completer To Replace Native In Cell 26
366+
Wait For Our Completer To Initialize
362367
Press Keys None LEFT
363368
Trigger Completer
364369
Press Keys None ENTER
@@ -371,13 +376,11 @@ Setup Completion Test
371376

372377
Get Cell Editor Content
373378
[Arguments] ${cell_nr}
374-
${content} = Execute JavaScript
375-
... return document.querySelector('.jp-Cell:nth-child(${cell_nr}) .CodeMirror').CodeMirror.getValue()
379+
${content} = Get Editor Content .jp-Cell:nth-child(${cell_nr})
376380
RETURN ${content}
377381

378382
Get File Editor Content
379-
${content} = Execute JavaScript
380-
... return document.querySelector('.jp-FileEditorCodeWrapper .CodeMirror').CodeMirror.getValue()
383+
${content} = Get Editor Content .jp-FileEditorCodeWrapper
381384
RETURN ${content}
382385

383386
Cell Editor Should Equal
@@ -466,14 +469,5 @@ Should Complete While Kernel Is Busy
466469
# Confirm that the kernel indicator was busy all along
467470
Page Should Contain Element ${KERNEL_BUSY_INDICATOR}
468471

469-
Wait For Our Completer To Replace Native In File Editor
470-
# Normally the completion adapter taking time to initialise is not a problem
471-
# but because the token-based completion fallback would break some test example
472-
# if it kicked in (by instant-completing some token) so we try to avoid it
473-
# TODO remove after migrating to JupyterLab 4.0 native adapters.
474-
Wait Until Page Contains Element css:.jp-FileEditor .lsp-completer-enabled
475-
476-
Wait For Our Completer To Replace Native In Cell
477-
[Arguments] ${cell_nr}
478-
# TODO remove after migrating to JupyterLab 4.0 native adapters.
479-
Wait Until Page Contains Element css:.jp-Cell:nth-child(${cell_nr}) .lsp-completer-enabled
472+
Wait For Our Completer To Initialize
473+
Wait Until Page Contains Element css:.body[data-lsp-completer-layout]

atest/05_Features/Hover.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Update hover after character deletion
8484
Last Occurrence
8585
[Arguments] ${symbol}
8686
${sel} = Set Variable If "${symbol}".startswith(("xpath", "css")) ${symbol}
87-
... xpath:(//span[@role="presentation"][contains(., "${symbol}")])[last()]
87+
... xpath:(//div[@class="cm-line"][contains(., "${symbol}")])[last()]
8888
RETURN ${sel}
8989

9090
Trigger Automatically By Hover

atest/Keywords.resource

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ Place Cursor In Cell Editor At
333333
[Arguments] ${cell_nr} ${line} ${character}
334334
Enter Cell Editor ${cell_nr} ${line}
335335
Execute JavaScript
336-
... view = document.querySelector('.jp-Cell:nth-child(${cell_nr}) .cm-content').cmView.view;
337-
... pos = view.doc.line(${line}).from + ${character};
336+
... var view = document.querySelector('.jp-Cell:nth-child(${cell_nr}) .cm-content').cmView.view;
337+
... var pos = view.doc.line(${line}).from + ${character};
338338
... return view.dispatch({selection: {anchor: pos, head: pos}});
339339

340340
Enter File Editor
@@ -345,8 +345,8 @@ Place Cursor In File Editor At
345345
[Arguments] ${line} ${character}
346346
Enter File Editor
347347
Execute JavaScript
348-
... view = document.querySelector('.jp-FileEditor .cm-content').cmView.view;
349-
... pos = view.doc.line(${line}).from + ${character};
348+
... var view = document.querySelector('.jp-FileEditor .cm-content').cmView.view;
349+
... var pos = view.doc.line(${line}).from + ${character};
350350
... return view.dispatch({selection: {anchor: pos, head: pos}});
351351

352352
Wait Until Fully Initialized
@@ -402,12 +402,14 @@ Open in Advanced Settings
402402

403403
Set Editor Content
404404
[Arguments] ${text} ${css}=${EMPTY}
405+
Wait Until Page Contains Element css:${css} .cm-content
405406
Execute JavaScript
406-
... doc = document.querySelector('${css} .cm-content').cmView.view.doc;
407+
... var doc = document.querySelector('${css} .cm-content').cmView.view.doc;
407408
... return doc.replace(0, doc.length, `${text}`);
408409

409410
Get Editor Content
410411
[Arguments] ${css}=${EMPTY}
412+
Wait Until Page Contains Element css:${css} .cm-content
411413
${content} = Execute JavaScript return document.querySelector('${css} .cm-content').cmView.view.doc.toString()
412414
RETURN ${content}
413415

0 commit comments

Comments
 (0)