Skip to content

Commit bb39801

Browse files
committed
hopefully demonstrate reproducible jump fail with spaces and umlaut path
1 parent c0c153c commit bb39801

File tree

6 files changed

+77
-25
lines changed

6 files changed

+77
-25
lines changed

atest/01_Editor.robot

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -90,29 +90,6 @@ Editor Should Show Diagnostics
9090
Should Be True ${count} >= 1
9191
Close Diagnostics Panel
9292

93-
Editor Should Jump To Definition
94-
[Arguments] ${symbol}
95-
Set Tags feature:jump-to-definition
96-
${sel} = Set Variable If "${symbol}".startswith(("xpath", "css")) ${symbol} xpath:(//span[@role="presentation"][contains(., "${symbol}")])[last()]
97-
Open Context Menu Over ${sel}
98-
${cursor} = Measure Cursor Position
99-
Capture Page Screenshot 02-jump-to-definition-0.png
100-
Mouse Over ${MENU JUMP}
101-
Capture Page Screenshot 02-jump-to-definition-1.png
102-
Click Element ${MENU JUMP}
103-
Wait Until Keyword Succeeds 10 x 1 s Cursor Should Jump ${cursor}
104-
Capture Page Screenshot 02-jump-to-definition-2.png
105-
106-
Cursor Should Jump
107-
[Arguments] ${original}
108-
${current} = Measure Cursor Position
109-
Should Not Be Equal ${original} ${current}
110-
111-
Measure Cursor Position
112-
Wait Until Page Contains Element ${CM CURSORS}
113-
${position} = Wait Until Keyword Succeeds 20 x 0.05s Get Vertical Position ${CM CURSOR}
114-
[Return] ${position}
115-
11693
Editor Content Changed
11794
[Arguments] ${old_content}
11895
${new_content} Get Editor Content

atest/05_Features/Jump.robot

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
*** Settings ***
2+
Suite Setup Setup Suite For Screenshots gh-403
3+
Force Tags feature:jump-to-definition gh:403
4+
Resource ../Keywords.robot
5+
6+
*** Variables ***
7+
${FOLDER WITH SPACE} a földer
8+
9+
*** Test Cases ***
10+
Python Jumps between Files
11+
Copy Files to Folder With Spaces jump_a.py jump_b.py
12+
${def} = Set Variable a_function_definition
13+
Open ${FOLDER WITH SPACE}/jump_b.py in ${MENU EDITOR}
14+
Wait Until Fully Initialized
15+
${sel} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), '${def}')])[last()]
16+
Jump To Definition ${sel}
17+
Wait Until Page Contains ANOTHER_CONSTANT
18+
Capture Page Screenshot 10-jumped.png
19+
20+
*** Keywords ***
21+
Copy Files to Folder With Spaces
22+
[Arguments] @{files}
23+
FOR ${file} IN @{files}
24+
Copy File examples${/}${file} ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE}${/}${file}
25+
END

atest/Keywords.robot

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Ensure Sidebar Is Closed
199199
Open Context Menu for File
200200
[Arguments] ${file}
201201
Ensure File Browser is Open
202-
Click Element css:button[title="Refresh File List"]
202+
Click Element ${JLAB CSS REFRESH FILES}
203203
${selector} = Set Variable xpath://span[@class='jp-DirListing-itemText']\[text() = '${file}']
204204
Wait Until Page Contains Element ${selector}
205205
Open Context Menu ${selector}
@@ -220,7 +220,19 @@ Input Into Dialog
220220
Input Text ${DIALOG INPUT} ${text}
221221
Click Element ${DIALOG ACCEPT}
222222

223+
Open Folder
224+
[Arguments] @{paths}
225+
Click Element ${JLAB CSS REFRESH FILES}
226+
FOR ${path} IN @{paths}
227+
${sel} = Set Variable css:li.jp-DirListing-item\[title^='Name: ${path}']
228+
Wait Until Page Contains Element ${sel}
229+
Double Click Element ${sel}
230+
END
231+
223232
Open ${file} in ${editor}
233+
${paths} = Set Variable ${file.split("/")}
234+
Run Keyword If ${paths.__len__() > 1} Open Folder @{paths[:-1]}
235+
${file} = Set Variable ${paths[-1]}
224236
Open Context Menu for File ${file}
225237
Mouse Over ${MENU OPEN WITH}
226238
Wait Until Page Contains Element ${editor}
@@ -331,3 +343,31 @@ Clean Up After Working with File and Settings
331343
[Arguments] ${file}
332344
Clean Up After Working With File ${file}
333345
Reset Plugin Settings
346+
347+
Jump To Definition
348+
[Arguments] ${symbol}
349+
${sel} = Set Variable If "${symbol}".startswith(("xpath", "css")) ${symbol} xpath:(//span[@role="presentation"][contains(., "${symbol}")])[last()]
350+
Open Context Menu Over ${sel}
351+
${cursor} = Measure Cursor Position
352+
Capture Page Screenshot 02-jump-to-definition-0.png
353+
Mouse Over ${MENU JUMP}
354+
Capture Page Screenshot 02-jump-to-definition-1.png
355+
Click Element ${MENU JUMP}
356+
[Return] ${cursor}
357+
358+
Editor Should Jump To Definition
359+
[Arguments] ${symbol}
360+
Set Tags feature:jump-to-definition
361+
${cursor} = Jump To Definition ${symbol}
362+
Wait Until Keyword Succeeds 10 x 1 s Cursor Should Jump ${cursor}
363+
Capture Page Screenshot 02-jump-to-definition-2.png
364+
365+
Cursor Should Jump
366+
[Arguments] ${original}
367+
${current} = Measure Cursor Position
368+
Should Not Be Equal ${original} ${current}
369+
370+
Measure Cursor Position
371+
Wait Until Page Contains Element ${CM CURSORS}
372+
${position} = Wait Until Keyword Succeeds 20 x 0.05s Get Vertical Position ${CM CURSOR}
373+
[Return] ${position}

atest/Variables.robot

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ${JLAB XP MENU ITEM LABEL} //div[@class='lm-Menu-itemLabel']
2323
${JLAB XP MENU LABEL} //div[@class='lm-MenuBar-itemLabel']
2424
${JLAB XP DOCK TAB} xpath://div[contains(@class, 'lm-DockPanel-tabBar')]//li[contains(@class, 'lm-TabBar-tab')]
2525
${JLAB CSS VERSION} css:.jp-About-version
26+
${JLAB CSS REFRESH FILES} css:button[title="Refresh File List"]
2627
${CSS DIALOG OK} css:.jp-Dialog .jp-mod-accept
2728
${MENU OPEN WITH} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "Open With")]
2829
# R is missing on purpose (may need to use .)
@@ -40,7 +41,7 @@ ${MENU JUMP} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(te
4041
${MENU SETTINGS} xpath://div[contains(@class, 'lm-MenuBar-itemLabel')][contains(text(), "Settings")]
4142
${MENU EDITOR THEME} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "Text Editor Theme")]
4243
${CM CURSOR} css:.CodeMirror-cursor
43-
${CM CURSORS} css:.CodeMirror-cursors:not([style='visibility: hidden'])
44+
${CM CURSORS} css:.jp-MainAreaWidget:not(.lm-mod-hidden) .CodeMirror-cursors:not([style='visibility: hidden'])
4445
# settings
4546
${LSP PLUGIN ID} @krassowski/jupyterlab-lsp:plugin
4647
${COMPLETION PLUGIN ID} @krassowski/jupyterlab-lsp:completion

atest/examples/jump_a.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
A_CONSTANT = "constant"
2+
ANOTHER_CONSTANT = "another constant"
3+
4+
def a_function_definition(n: int=1) -> str:
5+
return A_CONSTANT * n

atest/examples/jump_b.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from jump_a import a_function_definition, A_CONSTANT
2+
3+
4+
assert a_function_definition() == A_CONSTANT

0 commit comments

Comments
 (0)