1
1
*** Settings ***
2
2
Suite Setup Setup Suite For Screenshots diagnostics_panel
3
3
Resource ../Keywords.robot
4
- Test Setup Gently Reset Workspace
4
+ Test Setup Set Up
5
+ Test Teardown Clean Up
5
6
6
7
*** Variables ***
7
8
${EXPECTED_COUNT } 1
8
9
${DIAGNOSTIC } W291 trailing whitespace (pycodestyle)
9
10
${DIAGNOSTIC MESSAGE } trailing whitespace
10
- ${MENU COLUMNS } xpath://div[contains(@class, 'p -Menu-itemLabel')][contains(text(), "columns")]
11
- ${MENU COLUMN MESSAGE } xpath://div[contains(@class, 'p -Menu-itemLabel')][contains(text(), "Message")]
11
+ ${MENU COLUMNS } xpath://div[contains(@class, 'lm -Menu-itemLabel')][contains(text(), "columns")]
12
+ ${LAB MENU} css:.lm -Menu
12
13
13
14
*** Test Cases ***
14
15
Diagnostics Panel Opens
15
- Open Notebook And Panel Panel.ipynb
16
16
Capture Page Screenshot 03-panel-opens.png
17
- Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count
18
- [Teardown] Clean Up After Working With File Panel.ipynb
17
+ Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count ${EXPECTED_COUNT }
19
18
20
19
Diagnostics Panel Works After Rename
21
20
[Documentation] Test for #141 bug (diagnostics were not cleared after rename)
22
- Open Notebook And Panel Panel.ipynb
23
21
Rename Jupyter File Panel.ipynb PanelRenamed.ipynb
24
22
Close Diagnostics Panel
25
23
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title*="${DIAGNOSTIC } "] timeout=20s
26
24
Capture Page Screenshot 00-panel-rename.png
27
25
Open Diagnostics Panel
28
26
Capture Page Screenshot 01-panel-rename.png
29
- Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count
27
+ Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count ${ EXPECTED_COUNT }
30
28
Clean Up After Working With File PanelRenamed.ipynb
31
- [Teardown] Clean Up After Working With File Panel.ipynb
32
29
33
30
Diagnostics Panel Can Be Restored
34
- Open Notebook And Panel Panel.ipynb
35
31
Close Diagnostics Panel
36
32
Open Diagnostics Panel
37
- Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count
38
- [Teardown] Clean Up After Working With File Panel.ipynb
33
+ Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count ${EXPECTED_COUNT }
39
34
40
35
Columns Can Be Hidden
41
- Open Notebook And Panel Panel.ipynb
42
36
Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL } ${DIAGNOSTIC MESSAGE }
43
37
Open Context Menu Over css:.lsp-diagnostics-listing th
44
38
Capture Page Screenshot 01-menu-visible.png
45
- Mouse Over ${MENU COLUMNS }
46
- Wait Until Page Contains Element ${MENU COLUMN MESSAGE } timeout=10s
47
- Mouse Over ${MENU COLUMN MESSAGE }
48
- Capture Page Screenshot 02-message-column-visible.png
49
- Click Element ${MENU COLUMN MESSAGE }
39
+ Expand Menu Entry columns
40
+ Select Menu Entry Message
50
41
Capture Page Screenshot 03-message-column-toggled.png
51
42
Wait Until Keyword Succeeds 10 x 1s Element Should Not Contain ${DIAGNOSTICS PANEL } ${DIAGNOSTIC MESSAGE }
52
- [Teardown] Clean Up After Working With File Panel.ipynb
43
+
44
+ Diagnostics Can Be Ignored By Code
45
+ Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count 1
46
+ Open Context Menu Over css:.lsp-diagnostics-listing tbody tr
47
+ Expand Menu Entry Ignore diagnostics
48
+ Select Menu Entry code
49
+ Open in Advanced Settings ${DIAGNOSTICS PLUGIN ID }
50
+ Capture Page Screenshot 02-code-pressed.png
51
+ Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count 0
52
+
53
+ Diagnostics Can Be Ignored By Message
54
+ Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count 1
55
+ Open Context Menu Over css:.lsp-diagnostics-listing tbody tr
56
+ Expand Menu Entry Ignore diagnostics
57
+ Capture Page Screenshot 02-menu-visible.png
58
+ Select Menu Entry Ignore diagnostics with "W291 trailing whitespace" message
59
+ Open in Advanced Settings ${DIAGNOSTICS PLUGIN ID }
60
+ Capture Page Screenshot 02-message-pressed.png
61
+ Wait Until Keyword Succeeds 10 x 1s Should Have Expected Rows Count 0
62
+
63
+ Diagnostic Message Can Be Copied
64
+ Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL } ${DIAGNOSTIC MESSAGE }
65
+ Open Context Menu Over css:.lsp-diagnostics-listing tbody tr
66
+ Select Menu Entry Copy diagnostic
67
+ Close Diagnostics Panel
68
+ Wait Until Element Contains css:.lsp-statusbar-item Successfully copied timeout=10s
53
69
54
70
*** Keywords ***
71
+ Expand Menu Entry
72
+ [Arguments] ${label }
73
+ ${entry } = Set Variable xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "${label } ")]
74
+ Wait Until Page Contains Element ${entry } timeout=10s
75
+ ${menus before } = Get Element Count ${LAB MENU }
76
+ Mouse Over ${entry }
77
+ ${expected menus } = Evaluate ${menus before } + 1
78
+ Wait Until Keyword Succeeds 10 x 1s Menus Count Equal ${expected menus }
79
+
80
+ Menus Count Equal
81
+ [Arguments] ${count }
82
+ ${menus count } = Get Element Count ${LAB MENU }
83
+ Should Be Equal ${menus count } ${count }
84
+
85
+ Select Menu Entry
86
+ [Arguments] ${label }
87
+ ${entry } Set Variable xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), '${label } ')]
88
+ Wait Until Page Contains Element ${entry } timeout=10s
89
+ Mouse Over ${entry }
90
+ Click Element ${entry }
91
+ Wait Until Page Does Not Contain Element ${entry } timeout=10s
92
+
55
93
Open Notebook And Panel
56
94
[Arguments] ${notebook }
57
95
Setup Notebook Python ${notebook }
@@ -61,5 +99,15 @@ Open Notebook And Panel
61
99
Capture Page Screenshot 00-notebook-and-panel-opened.png
62
100
63
101
Should Have Expected Rows Count
102
+ [Arguments] ${expected_count }
64
103
${count } = Count Diagnostics In Panel
65
- Should Be True ${count } == ${EXPECTED_COUNT }
104
+ Should Be True ${count } == ${expected_count }
105
+
106
+ Set Up
107
+ Gently Reset Workspace
108
+ Open Notebook And Panel Panel.ipynb
109
+
110
+ Clean Up
111
+ Clean Up After Working With File Panel.ipynb
112
+ Reset Plugin Settings plugin=diagnostics
113
+ Reset Application State
0 commit comments