Skip to content

Commit 77b3efb

Browse files
committed
adopt robotidy, robocop
1 parent bede401 commit 77b3efb

22 files changed

+367
-253
lines changed

atest/00_Smoke.robot

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*** Settings ***
2-
Suite Setup Set Screenshot Directory ${SCREENSHOTS DIR}${/}smoke
3-
Resource Keywords.robot
2+
Resource Keywords.resource
3+
4+
Suite Setup Set Screenshot Directory ${SCREENSHOTS DIR}${/}smoke
45

56
*** Test Cases ***
67
Lab Version

atest/01_Editor.robot

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,41 @@
11
*** Settings ***
2-
Suite Setup Setup Suite For Screenshots editor
3-
Force Tags ui:editor aspect:ls:features
4-
Resource Keywords.robot
5-
Resource Variables.robot
2+
Resource Keywords.resource
3+
Resource Variables.resource
4+
5+
Suite Setup Setup Suite For Screenshots editor
6+
7+
Force Tags ui:editor aspect:ls:features
68

79
*** Test Cases ***
810
Bash
9-
Editor Shows Features for Language Bash example.sh Diagnostics=Failed to parse expression Jump to Definition=fib
11+
Editor Shows Features for Language Bash example.sh Diagnostics=Failed to parse expression
12+
... Jump to Definition=fib
1013

1114
CSS
12-
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable-2')][contains(text(), '--some-var')])[last()]
13-
Editor Shows Features for Language CSS example.css Diagnostics=Do not use empty rulesets Jump to Definition=${def} Rename=${def}
15+
${def} = Set Variable
16+
... xpath:(//span[contains(@class, 'cm-variable-2')][contains(text(), '--some-var')])[last()]
17+
Editor Shows Features for Language CSS example.css Diagnostics=Do not use empty rulesets
18+
... Jump to Definition=${def} Rename=${def}
1419

1520
Docker
1621
${def} = Set Variable xpath://span[contains(@class, 'cm-string')][contains(text(), 'PLANET')]
17-
Wait Until Keyword Succeeds 3x 100ms Editor Shows Features for Language Docker Dockerfile Diagnostics=Instructions should be written in uppercase letters
18-
... Jump to Definition=${def} Rename=${def}
22+
Wait Until Keyword Succeeds 3x 100ms Editor Shows Features for Language Docker Dockerfile
23+
... Diagnostics=Instructions should be written in uppercase letters Jump to Definition=${def}
24+
... Rename=${def}
1925

2026
JS
2127
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'fib')])[last()]
22-
Editor Shows Features for Language JS example.js Diagnostics=Expression expected Jump to Definition=${def} Rename=${def}
28+
Editor Shows Features for Language JS example.js Diagnostics=Expression expected
29+
... Jump to Definition=${def} Rename=${def}
2330

2431
JSON
2532
Editor Shows Features for Language JSON example.json Diagnostics=Duplicate object key
2633

2734
JSX
2835
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'hello')])[last()]
29-
Editor Shows Features for Language JSX example.jsx Diagnostics=Expression expected Jump to Definition=${def} Rename=${def}
30-
#Julia
36+
Editor Shows Features for Language JSX example.jsx Diagnostics=Expression expected
37+
... Jump to Definition=${def} Rename=${def}
38+
# Julia
3139
# ${def} = Set Variable xpath:(//span[contains(@class, 'cm-builtin')][contains(text(), 'add_together')])[last()]
3240
# Editor Shows Features for Language Julia example.jl Jump to Definition=${def} Rename=${def}
3341

@@ -38,39 +46,48 @@ LaTeX
3846

3947
Less
4048
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable-2')][contains(text(), '@width')])[last()]
41-
Editor Shows Features for Language Less example.less Diagnostics=Do not use empty rulesets Jump to Definition=${def}
49+
Editor Shows Features for Language Less example.less Diagnostics=Do not use empty rulesets
50+
... Jump to Definition=${def}
4251

4352
Markdown
4453
Editor Shows Features for Language Markdown example.md Diagnostics=`Color` is misspelt
4554

4655
Python (pylsp)
4756
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'fib')])[last()]
48-
Editor Shows Features for Server pylsp Python example.py Diagnostics=undefined name 'result' (pyflakes) Jump to Definition=${def} Rename=${def}
57+
Editor Shows Features for Server pylsp Python example.py Diagnostics=undefined name 'result' (pyflakes)
58+
... Jump to Definition=${def} Rename=${def}
4959

5060
Python (pyright)
5161
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'fib')])[last()]
52-
Editor Shows Features for Server pyright Python example.py Diagnostics=is not defined (Pyright) Jump to Definition=${def}
62+
Editor Shows Features for Server pyright Python example.py Diagnostics=is not defined (Pyright)
63+
... Jump to Definition=${def}
5364

5465
R
5566
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'fib')])[last()]
56-
Editor Shows Features for Language R example.R Diagnostics=Put spaces around all infix operators Jump to Definition=${def}
67+
Editor Shows Features for Language R example.R Diagnostics=Put spaces around all infix operators
68+
... Jump to Definition=${def}
5769

5870
Robot Framework
5971
[Tags] gh:332
6072
${def} = Set Variable xpath:(//span[contains(@class, 'cm-keyword')][contains(text(), 'Special Log')])[last()]
61-
Editor Shows Features for Language Robot Framework example.robot Diagnostics=Undefined keyword Jump to Definition=${def}
73+
Editor Shows Features for Language Robot Framework example.robot Diagnostics=Undefined keyword
74+
... Jump to Definition=${def}
6275

6376
SCSS
64-
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable-2')][contains(text(), 'primary-color')])[last()]
65-
Editor Shows Features for Language SCSS example.scss Diagnostics=Do not use empty rulesets Jump to Definition=${def}
77+
${def} = Set Variable
78+
... xpath:(//span[contains(@class, 'cm-variable-2')][contains(text(), 'primary-color')])[last()]
79+
Editor Shows Features for Language SCSS example.scss Diagnostics=Do not use empty rulesets
80+
... Jump to Definition=${def}
6681

6782
TSX
6883
${def} = Set Variable xpath:(//span[contains(@class, 'cm-tag')][contains(text(), 'HelloWorld')])[last()]
69-
Editor Shows Features for Language TSX example.tsx Diagnostics='hello' is declared but its value is never read. Jump to Definition=${def} Rename=${def}
84+
Editor Shows Features for Language TSX example.tsx
85+
... Diagnostics='hello' is declared but its value is never read. Jump to Definition=${def} Rename=${def}
7086

7187
TypeScript
7288
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'inc')])[last()]
73-
Editor Shows Features for Language TypeScript example.ts Diagnostics=The left-hand side of an arithmetic Jump to Definition=${def} Rename=${def}
89+
Editor Shows Features for Language TypeScript example.ts Diagnostics=The left-hand side of an arithmetic
90+
... Jump to Definition=${def} Rename=${def}
7491

7592
SQL
7693
Editor Shows Features for Language SQL example.sql Diagnostics=Expected
@@ -95,9 +112,13 @@ Editor Shows Features for Language
95112
Wait Until Fully Initialized
96113
# Run Keyword If "${Language}" == "Julia" Sleep 5s
97114
FOR ${f} IN @{features}
98-
Run Keyword If "${f}" == "Diagnostics" Editor Should Show Diagnostics ${features["${f}"]}
99-
... ELSE IF "${f}" == "Jump to Definition" Editor Should Jump To Definition ${features["${f}"]}
100-
... ELSE IF "${f}" == "Rename" Editor Should Rename ${features["${f}"]}
115+
IF "${f}" == "Diagnostics"
116+
Editor Should Show Diagnostics ${features["${f}"]}
117+
ELSE IF "${f}" == "Jump to Definition"
118+
Editor Should Jump To Definition ${features["${f}"]}
119+
ELSE IF "${f}" == "Rename"
120+
Editor Should Rename ${features["${f}"]}
121+
END
101122
END
102123
Capture Page Screenshot 99-done.png
103124
[Teardown] Clean Up After Working With File ${file}
@@ -115,16 +136,17 @@ Editor Should Show Diagnostics
115136

116137
Editor Content Changed
117138
[Arguments] ${old_content}
118-
${new_content} Get Editor Content
139+
${new_content} = Get Editor Content
119140
Should Not Be Equal ${old_content} ${new_content}
120141
[Return] ${new_content}
121142

122143
Editor Should Rename
123144
[Arguments] ${symbol}
124145
Set Tags feature:rename
125-
${sel} = Set Variable If "${symbol}".startswith(("xpath", "css")) ${symbol} xpath:(//span[@role="presentation"][contains(., "${symbol}")])[last()]
146+
${sel} = Set Variable If "${symbol}".startswith(("xpath", "css")) ${symbol}
147+
... xpath:(//span[@role="presentation"][contains(., "${symbol}")])[last()]
126148
Open Context Menu Over ${sel}
127-
${old_content} Get Editor Content
149+
${old_content} = Get Editor Content
128150
Capture Page Screenshot 03-rename-0.png
129151
Mouse Over ${MENU RENAME}
130152
Capture Page Screenshot 03-rename-1.png
@@ -133,5 +155,5 @@ Editor Should Rename
133155
Input Into Dialog new_name
134156
Sleep 2s
135157
Capture Page Screenshot 03-rename-3.png
136-
${new_content} Wait Until Keyword Succeeds 10 x 0.1 s Editor Content Changed ${old_content}
158+
${new_content} = Wait Until Keyword Succeeds 10 x 0.1 s Editor Content Changed ${old_content}
137159
Should Be True "new_name" in """${new_content}"""

atest/02_Settings.robot

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*** Settings ***
2-
Suite Setup Setup Suite For Screenshots settings
3-
Resource Keywords.robot
2+
Resource Keywords.resource
3+
4+
Suite Setup Setup Suite For Screenshots settings
45

56
*** Test Cases ***
67
Settings

atest/03_Notebook.robot

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
*** Settings ***
2-
Suite Setup Setup Suite For Screenshots notebook
3-
Test Setup Try to Close All Tabs
4-
Resource Keywords.robot
2+
Resource Keywords.resource
3+
4+
Suite Setup Setup Suite For Screenshots notebook
5+
Test Setup Try to Close All Tabs
56

67
*** Test Cases ***
78
Python
@@ -70,7 +71,8 @@ Code Overrides
7071
Wait Until Created ${virtual_path}
7172
Wait Until Keyword Succeeds 10x 1s File Should Not Be Empty ${virtual_path}
7273
${document} = Get File ${virtual_path}
73-
Should Be Equal ${document} get_ipython().run_line_magic("ls", "")\n\n\nget_ipython().run_line_magic("pip", " freeze")\n
74+
Should Be Equal ${document}
75+
... get_ipython().run_line_magic("ls", "")\n\n\nget_ipython().run_line_magic("pip", " freeze")\n
7476
[Teardown] Clean Up After Working With File Code overrides.ipynb
7577

7678
Adding Text To Cells Is Reflected In Virtual Document

atest/04_Interface/BackendFailure.robot

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
*** Settings ***
2-
Suite Setup Setup Server and Browser server_extension_enabled=${False}
3-
Suite Teardown Setup Server and Browser server_extension_enabled=${True}
4-
Resource ../Keywords.robot
2+
Resource ../Keywords.resource
3+
4+
Suite Setup Setup Server and Browser server_extension_enabled=${False}
5+
Suite Teardown Setup Server and Browser server_extension_enabled=${True}
56

67
*** Variables ***
7-
${STATUSBAR} css:div.lsp-statusbar-item
8-
${POPOVER} css:.lsp-popover
8+
${STATUSBAR} css:div.lsp-statusbar-item
9+
${POPOVER} css:.lsp-popover
910

1011
*** Test Cases ***
1112
Handles Server Extension Failure

atest/04_Interface/DiagnosticsPanel.robot

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
*** Settings ***
2-
Suite Setup Setup Suite For Screenshots diagnostics_panel
3-
Resource ../Keywords.robot
4-
Force Tags ui:notebook aspect:ls:features
5-
Test Setup Set Up
6-
Test Teardown Clean Up
2+
Resource ../Keywords.resource
3+
4+
Suite Setup Setup Suite For Screenshots diagnostics_panel
5+
Test Setup Set Up
6+
Test Teardown Clean Up
7+
8+
Force Tags ui:notebook aspect:ls:features
79

810
*** Variables ***
9-
${EXPECTED_COUNT} 4
10-
${DIAGNOSTIC} W291 trailing whitespace (pycodestyle)
11-
${DIAGNOSTIC MESSAGE} trailing whitespace
12-
${DIAGNOSTIC MESSAGE R} Closing curly-braces should always be on their own line
13-
${R CELL} %%R\n{}
14-
${MENU COLUMNS} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "columns")]
15-
${LAB MENU} css:.lm-Menu
11+
${EXPECTED_COUNT} 4
12+
${DIAGNOSTIC} W291 trailing whitespace (pycodestyle)
13+
${DIAGNOSTIC MESSAGE} trailing whitespace
14+
${DIAGNOSTIC MESSAGE R} Closing curly-braces should always be on their own line
15+
${R CELL} %%R\n{}
16+
${MENU COLUMNS} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "columns")]
17+
${LAB MENU} css:.lm-Menu
1618

1719
*** Test Cases ***
1820
Diagnostics Panel Opens
@@ -46,17 +48,20 @@ Diagnostics Panel Can Be Restored
4648
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count ${EXPECTED_COUNT}
4749

4850
Columns Can Be Hidden
49-
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL} ${DIAGNOSTIC MESSAGE}
51+
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL}
52+
... ${DIAGNOSTIC MESSAGE}
5053
Open Context Menu Over css:.lsp-diagnostics-listing th
5154
Capture Page Screenshot 01-menu-visible.png
5255
Expand Menu Entry columns
5356
Select Menu Entry Message
5457
Capture Page Screenshot 03-message-column-toggled.png
55-
Wait Until Keyword Succeeds 10 x 1s Element Should Not Contain ${DIAGNOSTICS PANEL} ${DIAGNOSTIC MESSAGE}
58+
Wait Until Keyword Succeeds 10 x 1s Element Should Not Contain ${DIAGNOSTICS PANEL}
59+
... ${DIAGNOSTIC MESSAGE}
5660

5761
Can Sort By Cell
5862
# https://github.com/jupyter-lsp/jupyterlab-lsp/issues/707
59-
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL} ${DIAGNOSTIC MESSAGE}
63+
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL}
64+
... ${DIAGNOSTIC MESSAGE}
6065
Click Element css:.lsp-diagnostics-listing th[data-id="Line:Ch"]
6166
Table Cell Should Equal Line:Ch row=1 column=-1
6267
Table Cell Should Equal 0:0 row=2 column=-1
@@ -69,7 +74,7 @@ Can Sort By Cell
6974
Diagnostics Can Be Ignored By Code
7075
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count ${EXPECTED_COUNT}
7176
# W291 should be shown twice, lets try to hide it
72-
${EXPECTED_AFTER} Evaluate ${EXPECTED_COUNT}-2
77+
${EXPECTED_AFTER} = Evaluate ${EXPECTED_COUNT}-2
7378
Open Context Menu Over W291
7479
Expand Menu Entry Ignore diagnostics
7580
Select Menu Entry code
@@ -80,7 +85,7 @@ Diagnostics Can Be Ignored By Code
8085
Diagnostics Can Be Ignored By Message
8186
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count ${EXPECTED_COUNT}
8287
# W291 should be shown twice, lets try to hide it
83-
${EXPECTED_AFTER} Evaluate ${EXPECTED_COUNT}-2
88+
${EXPECTED_AFTER} = Evaluate ${EXPECTED_COUNT}-2
8489
Open Context Menu Over W291
8590
Expand Menu Entry Ignore diagnostics
8691
Capture Page Screenshot 02-menu-visible.png
@@ -90,7 +95,8 @@ Diagnostics Can Be Ignored By Message
9095
Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count ${EXPECTED_AFTER}
9196

9297
Diagnostic Message Can Be Copied
93-
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL} ${DIAGNOSTIC MESSAGE}
98+
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL}
99+
... ${DIAGNOSTIC MESSAGE}
94100
Open Context Menu Over css:.lsp-diagnostics-listing tbody tr
95101
Select Menu Entry Copy diagnostic
96102
Close Diagnostics Panel
@@ -101,16 +107,20 @@ Diagnostics Panel Works After Removing Foreign Document
101107
Lab Command Insert Cell Below
102108
Enter Cell Editor 3
103109
Press Keys None ${R CELL}
104-
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL} ${DIAGNOSTIC MESSAGE}
105-
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL} ${DIAGNOSTIC MESSAGE R}
110+
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL}
111+
... ${DIAGNOSTIC MESSAGE}
112+
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL}
113+
... ${DIAGNOSTIC MESSAGE R}
106114
Lab Command Delete Cells
107115
# regain focus by entering cell
108116
Enter Cell Editor 2
109117
# trigger 7 document updates to trigger the garbage collector that removes unused documents
110118
# (search for VirtualDocument.remainining_lifetime for more)
111119
Press Keys None 1234567
112-
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL} ${DIAGNOSTIC MESSAGE}
113-
Wait Until Keyword Succeeds 10 x 1s Element Should Not Contain ${DIAGNOSTICS PANEL} ${DIAGNOSTIC MESSAGE R}
120+
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL}
121+
... ${DIAGNOSTIC MESSAGE}
122+
Wait Until Keyword Succeeds 10 x 1s Element Should Not Contain ${DIAGNOSTICS PANEL}
123+
... ${DIAGNOSTIC MESSAGE R}
114124

115125
*** Keywords ***
116126
Open Context Menu Over W291
@@ -135,7 +145,7 @@ Menus Count Equal
135145

136146
Select Menu Entry
137147
[Arguments] ${label}
138-
${entry} Set Variable xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), '${label}')]
148+
${entry} = Set Variable xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), '${label}')]
139149
Wait Until Page Contains Element ${entry} timeout=10s
140150
Mouse Over ${entry}
141151
Click Element ${entry}

atest/04_Interface/Statusbar.robot

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
*** Settings ***
2-
Suite Setup Setup Suite For Screenshots statusbar
3-
Resource ../Keywords.robot
2+
Resource ../Keywords.resource
3+
4+
Suite Setup Setup Suite For Screenshots statusbar
45

56
*** Variables ***
6-
${STATUSBAR} css:div.lsp-statusbar-item
7-
${DIAGNOSTIC} W291 trailing whitespace (pycodestyle)
8-
${POPOVER} css:.lsp-popover
9-
${HELP_BUTTON} css:.lsp-popover .lsp-help-button
7+
${STATUSBAR} css:div.lsp-statusbar-item
8+
${DIAGNOSTIC} W291 trailing whitespace (pycodestyle)
9+
${POPOVER} css:.lsp-popover
10+
${HELP_BUTTON} css:.lsp-popover .lsp-help-button
1011

1112
*** Test Cases ***
1213
Statusbar Popup Opens
@@ -21,7 +22,9 @@ Statusbar Popup Opens
2122
[Teardown] Clean Up After Working With File Python.ipynb
2223

2324
Troubleshooting And Help Is Offered For Known Non-Installed Servers
24-
[Documentation] When specification of a language server has been configured or provided, but the server is not installed (or detected) the user should get help on installation and/or troubleshooting
25+
[Documentation] When specification of a language server has been configured
26+
... or provided, but the server is not installed (or detected) the user
27+
... should get help on installation and/or troubleshooting
2528
Prepare File for Editing Python status example.klingon
2629
Wait Until Element Contains ${STATUSBAR} Initialized (additional servers needed) timeout=60s
2730
Click Element ${STATUSBAR}

0 commit comments

Comments
 (0)