11*** Settings ***
22Suite Setup Setup Suite For Screenshots diagnostics_panel
33Resource ../Keywords.robot
4- Test Setup Gently Reset Workspace
4+ Test Setup Set Up
5+ Test Teardown Clean Up
56
67*** Variables ***
78${EXPECTED_COUNT } 1
89${DIAGNOSTIC } W291 trailing whitespace (pycodestyle)
910${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
1213
1314*** Test Cases ***
1415Diagnostics Panel Opens
15- Open Notebook And Panel Panel.ipynb
1616 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 }
1918
2019Diagnostics Panel Works After Rename
2120 [Documentation] Test for #141 bug (diagnostics were not cleared after rename)
22- Open Notebook And Panel Panel.ipynb
2321 Rename Jupyter File Panel.ipynb PanelRenamed.ipynb
2422 Close Diagnostics Panel
2523 Wait Until Page Contains Element css:.cm-lsp-diagnostic[title*="${DIAGNOSTIC } "] timeout=20s
2624 Capture Page Screenshot 00-panel-rename.png
2725 Open Diagnostics Panel
2826 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 }
3028 Clean Up After Working With File PanelRenamed.ipynb
31- [Teardown] Clean Up After Working With File Panel.ipynb
3229
3330Diagnostics Panel Can Be Restored
34- Open Notebook And Panel Panel.ipynb
3531 Close Diagnostics Panel
3632 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 }
3934
4035Columns Can Be Hidden
41- Open Notebook And Panel Panel.ipynb
4236 Wait Until Keyword Succeeds 10 x 1s Element Should Contain ${DIAGNOSTICS PANEL } ${DIAGNOSTIC MESSAGE }
4337 Open Context Menu Over css:.lsp-diagnostics-listing th
4438 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
5041 Capture Page Screenshot 03-message-column-toggled.png
5142 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
5369
5470*** 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+
5593Open Notebook And Panel
5694 [Arguments] ${notebook }
5795 Setup Notebook Python ${notebook }
@@ -61,5 +99,15 @@ Open Notebook And Panel
6199 Capture Page Screenshot 00-notebook-and-panel-opened.png
62100
63101Should Have Expected Rows Count
102+ [Arguments] ${expected_count }
64103 ${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