Skip to content

Commit 3d1a6d0

Browse files
authored
More ci flake fixes 🤖📦❄️ (#72)
* actually reload page after resetting state * retry some ci steps, if needed * always try to ope the file browser * add selector flavor to file browser click * don't reload page (because node) but close all tabs * count file browser openers (1) rather than blindly clicking * capture browser log, and shut down kernels if running (for some reason) * also wait for splash to disappear * close all tabs in feature test teardown * try lighter-weight setup * wuks bash * fix keyword name * check if measures have actually addressed flake
1 parent 6964754 commit 3d1a6d0

File tree

6 files changed

+67
-28
lines changed

6 files changed

+67
-28
lines changed

atest/01_Editor.robot

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ ${CM CURSORS} css:.CodeMirror-cursors:not([style='visibility: hidden'])
1111

1212
*** Test Cases ***
1313
Bash
14-
Editor Shows Features for Language Bash example.sh Diagnostics=Failed to parse expression Jump to Definition=fib
14+
[Documentation] TODO: figure out why the first server is extra flaky
15+
Wait Until Keyword Succeeds 3x 10s Editor Shows Features for Language Bash example.sh Diagnostics=Failed to parse expression
16+
... Jump to Definition=fib
1517

1618
CSS
1719
${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable-2')][contains(text(), '--some-var')])[last()]
@@ -65,26 +67,40 @@ Editor Shows Features for Language
6567
Set Tags language:${Language.lower()}
6668
Set Screenshot Directory ${OUTPUT DIR}${/}screenshots${/}editor${/}${Language.lower()}
6769
Copy File examples${/}${file} ${OUTPUT DIR}${/}home${/}${file}
68-
Reset Application State
70+
Lab Command Close All Tabs
6971
Open ${file} in Editor
72+
Capture Page Screenshot 00-opened.png
7073
FOR ${f} IN @{features}
7174
Run Keyword If "${f}" == "Diagnostics" Editor Should Show Diagnostics ${features["${f}"]}
7275
... ELSE IF "${f}" == "Jump to Definition" Editor Should Jump To Definition ${features["${f}"]}
7376
END
74-
[Teardown] Remove File ${OUTPUT DIR}${/}home${/}${file}
77+
Capture Page Screenshot 99-done.png
78+
[Teardown] Clean Up After Working With File ${file}
79+
80+
Clean Up After Working With File
81+
[Arguments] ${file}
82+
Remove File ${OUTPUT DIR}${/}home${/}${file}
83+
Reset Application State
7584

7685
Open ${file} in Editor
86+
Ensure File Browser is Open
87+
Click Element css:button[title="Refresh File List"]
7788
Open Context Menu css:.jp-DirListing-item[title="${file}"]
7889
Mouse Over ${MENU OPEN WITH}
7990
Wait Until Page Contains Element ${MENU EDITOR}
8091
Mouse Over ${MENU EDITOR}
8192
Click Element ${MENU EDITOR}
8293

94+
Ensure File Browser is Open
95+
${sel} = Set Variable css:.p-TabBar-tab[data-id="filebrowser"]:not(.p-mod-current)
96+
${els} = Get WebElements ${sel}
97+
Run Keyword If ${els.__len__()} Click Element ${sel}
98+
8399
Editor Should Show Diagnostics
84100
[Arguments] ${diagnostic}
85101
Set Tags feature:diagnostics
86102
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title*="${diagnostic}"] timeout=20s
87-
Capture Page Screenshot diagnostics.png
103+
Capture Page Screenshot 01-diagnostics.png
88104

89105
Editor Should Jump To Definition
90106
[Arguments] ${symbol}
@@ -96,12 +112,12 @@ Editor Should Jump To Definition
96112
Wait Until Keyword Succeeds 10 x 0.1 s Click Element ${sel}
97113
Wait Until Keyword Succeeds 10 x 0.1 s Open Context Menu ${sel}
98114
${cursor} = Measure Cursor Position
99-
Capture Page Screenshot jump-to-definition-0.png
115+
Capture Page Screenshot 02-jump-to-definition-0.png
100116
Mouse Over ${MENU JUMP}
101-
Capture Page Screenshot jump-to-definition-1.png
117+
Capture Page Screenshot 02-jump-to-definition-1.png
102118
Click Element ${MENU JUMP}
103119
Wait Until Keyword Succeeds 10 x 1 s Cursor Should Jump ${cursor}
104-
Capture Page Screenshot jump-to-definition-2.png
120+
Capture Page Screenshot 02-jump-to-definition-2.png
105121

106122
Cursor Should Jump
107123
[Arguments] ${original}

atest/Keywords.robot

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,35 +47,49 @@ Tear Down Everything
4747

4848
Wait For Splash
4949
Wait Until Page Contains Element ${SPLASH} timeout=180s
50-
Wait Until Page Does Not Contain Element ${SPLASH}
50+
Wait Until Page Does Not Contain Element ${SPLASH} timeout=180s
51+
Execute Javascript window.onbeforeunload \= function (){}
5152

5253
Open JupyterLab
5354
Set Environment Variable MOZ_HEADLESS ${HEADLESS}
5455
${firefox} = Which firefox
5556
${geckodriver} = Which geckodriver
56-
Create WebDriver Firefox executable_path=${geckodriver} firefox_binary=${firefox}
57+
Create WebDriver Firefox executable_path=${geckodriver} firefox_binary=${firefox} service_log_path=${OUTPUT DIR}${/}geckodriver.log
5758
Go To ${URL}lab?token=${TOKEN}
5859
Set Window Size 1024 768
5960
Wait For Splash
60-
Execute Javascript window.onbeforeunload \= function (){}
6161

6262
Close JupyterLab
6363
Close All Browsers
6464

6565
Reset Application State
66+
Lab Command Close All Tabs
67+
Ensure All Kernels Are Shut Down
6668
Lab Command Reset Application State
6769
Wait For Splash
70+
Lab Command Close All Tabs
71+
72+
Ensure All Kernels Are Shut Down
73+
Enter Command Name Shut Down All Kernels
74+
${els} = Get WebElements ${CMD PALETTE ITEM ACTIVE}
75+
Run Keyword If ${els.__len__()} Click Element ${CMD PALETTE ITEM ACTIVE}
76+
Run Keyword If ${els.__len__()} Click Element css:.jp-mod-accept.jp-mod-warn
77+
78+
Open Command Palette
79+
Press Keys id:main ${ACCEL}+SHIFT+c
80+
Wait Until Page Contains Element ${CMD PALETTE INPUT}
81+
Click Element ${CMD PALETTE INPUT}
82+
83+
Enter Command Name
84+
[Arguments] ${cmd}
85+
Open Command Palette
86+
Input Text ${CMD PALETTE INPUT} ${cmd}
6887

6988
Lab Command
7089
[Arguments] ${cmd}
71-
Press Keys id:main ${ACCEL}+SHIFT+c
72-
${cmd input} = Set Variable css:.p-CommandPalette-input
73-
Wait Until Page Contains Element ${cmd input}
74-
Click Element ${cmd input}
75-
Input Text ${cmd input} ${cmd}
76-
${cmd item} = Set Variable css:.p-CommandPalette-item.p-mod-active
77-
Wait Until Page Contains Element ${cmd item}
78-
Click Element ${cmd item}
90+
Enter Command Name ${cmd}
91+
Wait Until Page Contains Element ${CMD PALETTE ITEM ACTIVE}
92+
Click Element ${CMD PALETTE ITEM ACTIVE}
7993

8094
Which
8195
[Arguments] ${cmd}

atest/Variables.robot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ ${BASE} /@est/
66

77
# override with `python scripts/atest.py --variable HEADLESS:0`
88
${HEADLESS} 1
9+
10+
11+
${CMD PALETTE INPUT} css:.p-CommandPalette-input
12+
13+
${CMD PALETTE ITEM ACTIVE} css:.p-CommandPalette-item.p-mod-active

ci/job.combine.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ parameters:
66
pythons:
77
- ThreeSix
88
- ThreeSeven
9+
install_robot: conda install -yc conda-forge robotframework
910

1011
jobs:
1112
- job: Combine
@@ -21,7 +22,7 @@ jobs:
2122
parameters:
2223
packages: robotframework
2324

24-
- script: conda install -yc conda-forge robotframework
25+
- script: ${{ parameters.install_robot }} || ${{ parameters.install_robot }} || ${{ parameters.install_robot }}
2526
displayName: get robotframework
2627

2728
- ${{ each platform in parameters.platforms }}:

ci/job.test.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ parameters:
1414
spec: '>=3.6,<3.7.0a0'
1515
- name: ThreeSeven
1616
spec: '>=3.7,<3.8.0a0'
17+
env_update: conda env update -n jupyterlab-lsp --file env-test.yml --quiet
18+
lab_build: jupyter labextension install krassowski-jupyterlab-lsp-$(JLSP_VERSION).tgz @krassowski/jupyterlab_go_to_definition
1719

1820
jobs:
1921
- ${{ each platform in parameters.platforms }}:
@@ -29,19 +31,19 @@ jobs:
2931
- script: ${{ platform.activate }} && cd ci && python env_template.py "${{ python.spec }}"
3032
displayName: update environment with python version
3133

32-
- script: conda env update -n jupyterlab-lsp --file env-test.yml --quiet
34+
- script: ${{ parameters.env_update }} || ${{ parameters.env_update }} || ${{ parameters.env_update }}
3335
displayName: update conda environment with test dependencies
3436

3537
- script: conda info && conda list -n jupyterlab-lsp
3638
displayName: list conda packages and info
3739

38-
# - task: CacheBeta@0
39-
# inputs:
40-
# key: yarn | $(Agent.OS) | yarn.lock
41-
# path: $(YARN_CACHE_FOLDER)
42-
# displayName: restore cached yarn packages
40+
- task: CacheBeta@0
41+
inputs:
42+
key: yarn | $(Agent.OS) | yarn.lock
43+
path: $(YARN_CACHE_FOLDER)
44+
displayName: restore cached yarn packages
4345

44-
- script: ${{ platform.activate }} jupyterlab-lsp && jlpm
46+
- script: ${{ platform.activate }} jupyterlab-lsp && jlpm || jlpm || jlpm
4547
displayName: install npm dependencies
4648

4749
- script: ${{ platform.activate }} jupyterlab-lsp && jlpm build
@@ -78,7 +80,7 @@ jobs:
7880
- script: ${{ platform.activate }} jupyterlab-lsp && python scripts/utest.py --test-run-title="Pytest ${{ platform.name }}${{ python.name }}"
7981
displayName: run python tests
8082

81-
- script: ${{ platform.activate }} jupyterlab-lsp && cd dist && jupyter labextension install krassowski-jupyterlab-lsp-$(JLSP_VERSION).tgz @krassowski/jupyterlab_go_to_definition
83+
- script: ${{ platform.activate }} jupyterlab-lsp && cd dist && ${{ parameters.lab_build }} || ${{ parameters.lab_build }} || ${{ parameters.lab_build }}
8284
displayName: install labextensions
8385

8486
- script: ${{ platform.activate }} jupyterlab-lsp && jupyter labextension list

ci/steps.conda.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
parameters:
22
name: Linux
33
packages: ''
4+
install_cmd: conda install -yn base -c conda-forge conda python-libarchive-c
45

56
steps:
67
- ${{ if eq(parameters.name, 'Linux') }}:
@@ -18,5 +19,5 @@ steps:
1819
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
1920
displayName: conda %PATH%
2021

21-
- script: conda install -yn base -c conda-forge conda python-libarchive-c ${{ parameters.packages}}
22+
- script: ${{ parameters.install_cmd }} ${{ parameters.packages}} || ${{ parameters.install_cmd }} ${{ parameters.packages}} || ${{ parameters.install_cmd }} ${{ parameters.packages}}
2223
displayName: update conda

0 commit comments

Comments
 (0)