Skip to content

Commit 3df79a3

Browse files
authored
Merge pull request #892 from krassowski/faster-atest-do-not-reset-workspace
Speed up tests by not reloading page within suites
2 parents 538c1f1 + 37f15f6 commit 3df79a3

File tree

5 files changed

+32
-18
lines changed

5 files changed

+32
-18
lines changed

atest/04_Interface/BackendFailure.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ Setup Missing Extension Test
2828

2929
Teardown Missing Extension Test
3030
Set Server Extension State enabled=${True}
31+
Setup Server and Browser

atest/05_Features/Jump.robot

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Python Jumps Between Files
1919
Jump To Definition ${sel}
2020
Wait Until Page Contains ANOTHER_CONSTANT
2121
Capture Page Screenshot 10-jumped.png
22-
Clean Up After Working With File jump_b.py
22+
[Teardown] Clean Up Folder With Spaces jump_a.py jump_b.py
2323

2424
Jumps To References With Modifier Click
2525
[Setup] Prepare File for Editing Python editor jump_references.py
@@ -35,7 +35,7 @@ Jumps To References With Modifier Click
3535
Select From List By Index css:.jp-Dialog select 2
3636
Click Element css:.jp-Dialog-button.jp-mod-accept
3737
Wait Until Keyword Succeeds 10 x 1 s Cursor Should Jump ${original}
38-
Clean Up After Working With File jump_references.py
38+
[Teardown] Clean Up After Working With File jump_references.py
3939

4040
Jumps To References From Context Menu
4141
[Setup] Prepare File for Editing Python editor jump_references.py
@@ -51,7 +51,7 @@ Jumps To References From Context Menu
5151
Select From List By Index css:.jp-Dialog select 2
5252
Click Element css:.jp-Dialog-button.jp-mod-accept
5353
Wait Until Keyword Succeeds 10 x 1 s Cursor Should Jump ${original}
54-
Clean Up After Working With File jump_references.py
54+
[Teardown] Clean Up After Working With File jump_references.py
5555

5656
Ctrl Click And Jumping Back Works
5757
[Setup] Prepare File for Editing Python editor jump.py
@@ -82,6 +82,15 @@ Copy Files to Folder With Spaces
8282
Copy File examples${/}${file} ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE}${/}${file}
8383
END
8484

85+
Clean Up Folder With Spaces
86+
[Arguments] @{files}
87+
Try to Close All Tabs
88+
Navigate to Root Folder
89+
FOR ${file} IN @{files}
90+
Remove File ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE}${/}${file}
91+
END
92+
Remove Directory ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE} recursive=True
93+
8594
Select Token Occurrence
8695
[Arguments] ${token} ${type}=variable ${which}=last
8796
${sel} = Set Variable
@@ -92,7 +101,3 @@ Ctrl Click Element
92101
[Arguments] ${element}
93102
${key} = Evaluate 'COMMAND' if platform.system() == 'Darwin' else 'CTRL' platform
94103
Click Element ${element} modifier=${key}
95-
96-
Should Have Expected Count
97-
[Arguments] ${expected_count}
98-
${count} = Count Diagnostics In Panel

atest/Keywords.resource

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Setup Suite For Screenshots
8181
[Arguments] ${folder}
8282
Set Screenshot Directory ${SCREENSHOTS DIR}${/}${folder}
8383
Set Tags lab:${LAB VERSION}
84+
Reset Application State
8485

8586
Initialize User Settings
8687
Create File
@@ -142,8 +143,7 @@ Reset Application State
142143
Try to Close All Tabs
143144
Accept Default Dialog Option
144145
Ensure All Kernels Are Shut Down
145-
Lab Command Reset Application State
146-
Wait Until Keyword Succeeds 3x 5s Wait For Splash
146+
Accept Default Dialog Option
147147

148148
Accept Default Dialog Option
149149
[Documentation] Accept a dialog, if it exists
@@ -153,11 +153,9 @@ Accept Default Dialog Option
153153
Ensure All Kernels Are Shut Down
154154
Enter Command Name Shut Down All Kernels
155155
${els} = Get WebElements ${CMD PALETTE ITEM ACTIVE}
156-
IF ${els.__len__()} Click Element ${CMD PALETTE ITEM ACTIVE}
157-
${accept} = Set Variable css:.jp-mod-accept.jp-mod-warn
158156
IF ${els.__len__()}
159-
Wait Until Page Contains Element ${accept}
160-
Click Element ${accept}
157+
Click Element ${CMD PALETTE ITEM ACTIVE}
158+
Accept Default Dialog Option
161159
END
162160

163161
Open Command Palette
@@ -219,6 +217,7 @@ Ensure Sidebar Is Closed
219217
END
220218

221219
Refresh File List
220+
Ensure File Browser is Open
222221
IF [int(part) for part in "${LAB VERSION}".split(".")] >= [3, 4, 0]
223222
Click Element ${JLAB CSS REFRESH FILES}
224223
ELSE
@@ -227,7 +226,6 @@ Refresh File List
227226

228227
Open Context Menu for File
229228
[Arguments] ${file}
230-
Ensure File Browser is Open
231229
Refresh File List
232230
${selector} = Set Variable xpath://span[@class='jp-DirListing-itemText']/span\[text() = '${file}']
233231
Wait Until Page Contains Element ${selector} timeout=10s
@@ -259,6 +257,10 @@ Open Folder
259257
Double Click Element ${sel}
260258
END
261259

260+
Navigate to Root Folder
261+
Ensure File Browser is Open
262+
Click Element ${ROOT FOLDER}
263+
262264
Open ${file} in ${editor}
263265
${paths} = Set Variable ${file.split("/")}
264266
IF ${paths.__len__() > 1} Open Folder @{paths[:-1]}
@@ -269,12 +271,18 @@ Open ${file} in ${editor}
269271
Mouse Over ${editor}
270272
Click Element ${editor}
271273

272-
Clean Up After Working With File
273-
[Arguments] ${file}
274-
Remove File ${NOTEBOOK DIR}${/}${file}
274+
Clean Up After Working With Files
275+
[Arguments] @{files}
276+
FOR ${file} IN @{files}
277+
Remove File ${NOTEBOOK DIR}${/}${file}
278+
END
275279
Reset Application State
276280
Lab Log Should Not Contain Known Error Messages
277281

282+
Clean Up After Working With File
283+
[Arguments] ${file}
284+
Clean Up After Working With Files ${file}
285+
278286
Setup Notebook
279287
[Arguments] ${Language} ${file} ${isolated}=${True} ${wait}=${True}
280288
Set Tags language:${Language.lower()}

atest/Variables.resource

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ ${DIALOG WINDOW} css:.jp-Dialog
4141
${DIALOG INPUT} css:.jp-Input-Dialog input
4242
${DIALOG ACCEPT} css:button.jp-Dialog-button.jp-mod-accept
4343
${STATUSBAR} css:div.lsp-statusbar-item
44+
${ROOT FOLDER} css:.jp-BreadCrumbs-home
4445
${MENU EDITOR} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(., "Editor")]
4546
${MENU JUMP}
4647
... xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "Jump to definition")]

atest/__init__.robot

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Resource Keywords.resource
33

44
Suite Setup Setup Server and Browser
55
Suite Teardown Tear Down Everything
6-
Test Setup Reset Application State
76
Test Teardown Lab Log Should Not Contain Known Error Messages
87

98
Test Tags os:${os.lower()} py:${py}

0 commit comments

Comments
 (0)