Skip to content

Commit 39d20d5

Browse files
committed
make bulk of config tests into keyword
1 parent 3088b8c commit 39d20d5

File tree

1 file changed

+36
-48
lines changed

1 file changed

+36
-48
lines changed

atest/07_Configuration.robot

Lines changed: 36 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,52 @@ Suite Setup Setup Suite For Screenshots config
44
Force Tags feature:config
55
Resource ./Keywords.robot
66

7-
*** Variables ***
8-
${CONFIG PYLS} {"language_servers": {"pyls": {"serverSettings": {"pyls": {"plugins": {"flake8": {"enabled": true},"pyflakes": {"enabled": false}}}}}}}
9-
# pyflakes is enabled by default, but flake8 is not
10-
${PYFLAKES DIAGNOSTIC} ${CSS DIAGNOSTIC}-Error[title="undefined name 'foo' (pyflakes)"]
11-
${FLAKE8 DIAGNOSTIC} ${CSS DIAGNOSTIC}-Warning[title="undefined name 'foo' (flake8)"]
12-
# Sets expectation that all YAML files (wildcard *) adhere to Composer spec
13-
${CONFIG YAML SCHEMA} {"language_servers": {"yaml-language-server": {"serverSettings": {"yaml.schemas": {"http://json.schemastore.org/composer": "*"}}}}}
14-
# Composer YAML files don't allow a "greetings" key
15-
${SCHEMA DIAGNOSTIC} ${CSS DIAGNOSTIC}-Error[title="Property greetings is not allowed."]
16-
177
*** Test Cases ***
188
Pyls Configuration
19-
${file} = Set Variable style.py
20-
${tab} = Set Variable ${JLAB XP DOCK TAB}\[contains(., '${file}')]
21-
Prepare File for Editing PYTHON config ${file}
22-
Open in Advanced Settings ${LSP PLUGIN ID}
23-
Drag and Drop By Offset ${tab} 0 100
24-
Wait Until Fully Initialized
25-
Open Diagnostics Panel
26-
Drag and Drop By Offset ${JLAB XP DOCK TAB}\[contains(., 'Diagnostics Panel')] 600 -200
27-
Ensure Sidebar Is Closed
28-
Capture Page Screenshot 01-diagnostics-and-settings.png
29-
# Diagnostic panel should show pyflakes diagnostics, but no flake8
30-
Wait Until Page Contains Element ${PYFLAKES DIAGNOSTIC} timeout=30s
31-
Page Should Not Contain ${FLAKE8 DIAGNOSTIC}
32-
Set Editor Content ${CONFIG PYLS} ${CSS USER SETTINGS}
33-
Click Element css:button[title\='Save User Settings']
34-
Drag and Drop By Offset ${tab} 0 100
35-
Lab Command Save Python File
36-
Capture Page Screenshot 02-settings-changed.png
37-
# After updating settings, we should see flake8 but no pyflakes
38-
Wait Until Page Contains Element ${FLAKE8 DIAGNOSTIC} timeout=30s
39-
Page Should Not Contain ${PYFLAKES DIAGNOSTIC}
40-
Capture Page Screenshot 03-flake8-diagnostic-found.png
41-
[Teardown] Clean Up After Working with File and Settings ${file}
9+
[Documentation] pyflakes is enabled by default, but flake8 is not
10+
Settings Should Change Editor Diagnostics Python style.py pyls
11+
... {"pyls": {"plugins": {"flake8": {"enabled": true},"pyflakes": {"enabled": false}}}}
12+
... undefined name 'foo' (pyflakes)
13+
... undefined name 'foo' (flake8)
4214

4315
YAML Schema
44-
${file} = Set Variable example.yaml
16+
[Documentation] EXPECT FAIL Composer YAML files don't allow a "greetings" key
17+
Settings Should Change Editor Diagnostics YAML example.yaml yaml-language-server
18+
... {"yaml.schemas": {"http://json.schemastore.org/composer": "*"}}
19+
... duplicate key
20+
... Property greetings is not allowed.
21+
22+
*** Keywords ***
23+
Clean Up After Working with File and Settings
24+
[Arguments] ${file}
25+
Clean Up After Working With File ${file}
26+
Reset Plugin Settings
27+
28+
Settings Should Change Editor Diagnostics
29+
[Arguments] ${language} ${file} ${server} ${settings} ${before} ${after}
30+
${before diagnostic} = Set Variable ${CSS DIAGNOSTIC}\[title="${before}"]
31+
${after diagnostic} = Set Variable ${CSS DIAGNOSTIC}\[title="${after}"]
4532
${tab} = Set Variable ${JLAB XP DOCK TAB}\[contains(., '${file}')]
46-
Prepare File for Editing YAML config ${file}
33+
${close icon} = Set Variable *[contains(@class, 'm-TabBar-tabCloseIcon')]
34+
Prepare File for Editing ${language} config ${file}
4735
Open in Advanced Settings ${LSP PLUGIN ID}
4836
Drag and Drop By Offset ${tab} 0 100
4937
Wait Until Fully Initialized
5038
Open Diagnostics Panel
5139
Drag and Drop By Offset ${JLAB XP DOCK TAB}\[contains(., 'Diagnostics Panel')] 600 -200
52-
Capture Page Screenshot 01-diagnostics-and-settings.png
53-
# Diagnostic panel shouldn't show "Property ... is not allowed"
54-
Page Should Not Contain ${SCHEMA DIAGNOSTIC}
55-
Set Editor Content ${CONFIG YAML SCHEMA} ${CSS USER SETTINGS}
40+
Click Element ${JLAB XP DOCK TAB}\[contains(., 'Launcher')]/${close icon}
41+
Wait Until Page Contains Element ${before diagnostic} timeout=30s
42+
Page Should Not Contain ${after diagnostic}
43+
Capture Page Screenshot 01-default-diagnostics-and-settings.png
44+
Set Editor Content {"language_servers": {"${server}": {"serverSettings": ${settings}}}} ${CSS USER SETTINGS}
45+
Wait Until Page Contains No errors found
46+
Capture Page Screenshot 01-default-diagnostics-and-settings.png
5647
Click Element css:button[title\='Save User Settings']
48+
Click Element ${JLAB XP DOCK TAB}\[contains(., 'Settings')]/${close icon}
49+
Drag and Drop By Offset ${tab} 0 100
50+
Lab Command Save ${language} File
51+
Ensure Sidebar Is Closed
5752
Capture Page Screenshot 02-settings-changed.png
58-
# Now show the Composer YAML error
59-
Wait Until Page Contains Element ${SCHEMA DIAGNOSTIC} timeout=30s
60-
Capture Page Screenshot 03-schema-diagnostic-found.png
53+
Wait Until Page Contains Element ${after diagnostic} timeout=30s
54+
Capture Page Screenshot 03-configured-diagnostic-found.png
6155
[Teardown] Clean Up After Working with File and Settings ${file}
62-
63-
*** Keywords ***
64-
Clean Up After Working with File and Settings
65-
[Arguments] ${file}
66-
Clean Up After Working With File ${file}
67-
Reset Plugin Settings

0 commit comments

Comments
 (0)