Skip to content

Commit e1c5c88

Browse files
committed
more work on themes, style screenshot testing
1 parent 4b86105 commit e1c5c88

File tree

6 files changed

+96
-12
lines changed

6 files changed

+96
-12
lines changed

atest/06_Style.robot

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,21 @@ Dark
1717

1818
*** Keywords ***
1919
Screenshot Editor Themes with Lab Theme
20-
[Arguments] ${lab theme} ${file}=example.py
20+
[Arguments] ${lab theme} ${file}=style.py ${notebook}=Diagnostic.ipynb
2121
${norm lab theme} = Set Variable ${lab theme.lower().replace(" ", "-")}
2222
Set Tags theme:lab:${norm lab theme}
2323
Set Screenshot Directory ${OUTPUT DIR}${/}style${/}${norm lab theme}
2424
Copy File examples${/}${file} ${OUTPUT DIR}${/}home${/}${file}
2525
Run Keyword If "${THEME NAMES}" == "" Wait Until Keyword Succeeds 3x 1s Get Theme Names
2626
Lab Command Use ${lab theme} Theme
2727
Try to Close All Tabs
28+
Setup Notebook python ${notebook} isolated=${False}
2829
Open ${file} in ${MENU EDITOR}
29-
Capture Page Screenshot 00-opened.png
30+
Drag and Drop By Offset ${JLAB XP DOCK TAB}\[contains(., '${file}')] -400 400
31+
Ensure Sidebar Is Closed
32+
Click Element ${JLAB XP DOCK TAB}\[contains(., '${file}')]
33+
Click the second Accumulate in Notebook
34+
Capture Page Screenshot 00-notebook.png
3035
FOR ${editor theme} IN @{THEME NAMES}
3136
Capture Theme Screenshot ${editor theme}
3237
END
@@ -37,11 +42,11 @@ Capture Theme Screenshot
3742
Change Editor Theme ${editor theme}
3843
Wait Until Fully Initialized
3944
Wait Until Page Contains Element css:.cm-lsp-diagnostic timeout=20s
40-
Click the second Accumulate
41-
Capture Page Screenshot ${editor theme.replace(' ', '-')}.png
45+
Click the second Accumulate in FileEditor
46+
Capture Page Screenshot 01-editor-${editor theme.replace(' ', '-')}.png
4247

43-
Click the second Accumulate
44-
Click Element xpath://span[text()\='accumulate'][2]
48+
Click the second Accumulate in ${editor}
49+
Click Element //div[contains(@class, 'jp-${editor}')]//div[contains(@class,'CodeMirror')]//span[text() = 'accumulate']
4550

4651
Change Editor Theme
4752
[Arguments] ${editor theme}

atest/Keywords.robot

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ Ensure File Browser is Open
158158
${els} = Get WebElements ${sel}
159159
Run Keyword If ${els.__len__()} Click Element ${sel}
160160

161+
Ensure Sidebar Is Closed
162+
[Arguments] ${side}=left
163+
${els} = Get WebElements css:#jp-${side}-stack
164+
Run Keyword If ${els.__len__()} Click Element css:.jp-mod-${side} .lm-TabBar-tab.lm-mod-current
165+
161166
Open Context Menu for File
162167
[Arguments] ${file}
163168
Ensure File Browser is Open
@@ -195,15 +200,15 @@ Clean Up After Working With File
195200
Reset Application State
196201

197202
Setup Notebook
198-
[Arguments] ${Language} ${file}
203+
[Arguments] ${Language} ${file} ${isolated}=${True}
199204
Set Tags language:${Language.lower()}
200-
Set Screenshot Directory ${OUTPUT DIR}${/}screenshots${/}notebook${/}${TEST NAME.replace(' ', '_')}
205+
Run Keyword If ${isolated} Set Screenshot Directory ${OUTPUT DIR}${/}screenshots${/}notebook${/}${TEST NAME.replace(' ', '_')}
201206
Copy File examples${/}${file} ${OUTPUT DIR}${/}home${/}${file}
202-
Try to Close All Tabs
207+
Run Keyword If ${isolated} Try to Close All Tabs
203208
Open ${file} in ${MENU NOTEBOOK}
204-
Capture Page Screenshot 00-opened.png
209+
Capture Page Screenshot 00-notebook-opened.png
205210
Wait Until Fully Initialized
206-
Capture Page Screenshot 01-initialized.png
211+
Capture Page Screenshot 01-notebook-initialized.png
207212

208213
Open Diagnostics Panel
209214
Lab Command Show Diagnostics Panel

atest/Variables.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ${CMD PALETTE ITEM ACTIVE} css:#command-palette .lm-CommandPalette-item.lm-mo
1111
${JLAB XP TOP} //div[@id='jp-top-panel']
1212
${JLAB XP MENU ITEM LABEL} //div[@class='lm-Menu-itemLabel']
1313
${JLAB XP MENU LABEL} //div[@class='lm-MenuBar-itemLabel']
14+
${JLAB XP DOCK TAB} xpath://div[contains(@class, 'lm-DockPanel-tabBar')]//li[contains(@class, 'lm-TabBar-tab')]
1415
${JLAB CSS VERSION} css:.jp-About-version
1516
${CSS DIALOG OK} css:.jp-Dialog .jp-mod-accept
1617
${MENU OPEN WITH} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "Open With")]

atest/examples/Diagnostic.ipynb

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"from itertools import (accumulate, chain); accumulate\n",
10+
"\n",
11+
"\n",
12+
"# fibs :: Integer :: [Integer]\n",
13+
"def fibs(n):\n",
14+
" '''An accumulation of the first n integers in\n",
15+
" the Fibonacci series. The accumulator is a\n",
16+
" pair of the two preceding numbers.\n",
17+
" '''\n",
18+
" def go(ab, _):\n",
19+
" a, b = ab\n",
20+
" return (b, a + b)\n",
21+
"\n",
22+
" return [xy[1] for xy in accumulate(\n",
23+
" chain(\n",
24+
" [(0, 1)],\n",
25+
" range(1, n)\n",
26+
" ),\n",
27+
" go\n",
28+
" )]"
29+
]
30+
},
31+
{
32+
"cell_type": "code",
33+
"execution_count": null,
34+
"metadata": {},
35+
"outputs": [],
36+
"source": [
37+
"%%R\n",
38+
"x = 1\n",
39+
"X = 1\n",
40+
"test \n",
41+
"valid\n",
42+
"0 / \"a\""
43+
]
44+
}
45+
],
46+
"metadata": {
47+
"kernelspec": {
48+
"display_name": "Python 3",
49+
"language": "python",
50+
"name": "python3"
51+
},
52+
"language_info": {
53+
"codemirror_mode": {
54+
"name": "ipython",
55+
"version": 3
56+
},
57+
"file_extension": ".py",
58+
"mimetype": "text/x-python",
59+
"name": "python",
60+
"nbconvert_exporter": "python",
61+
"pygments_lexer": "ipython3",
62+
"version": "3.7.6"
63+
}
64+
},
65+
"nbformat": 4,
66+
"nbformat_minor": 4
67+
}

atest/examples/style.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# style testing
2+
from itertools import accumulate; accumulate
3+
accumulate
4+
foo = 1
5+
foo + foo
6+
foo - "12333"

packages/jupyterlab-lsp/style/variables/cm-themes.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
}
4444

4545
.cm-s-the-matrix {
46-
--jp-editor-mirror-lsp-highlight-background-color: rgba(239, 231, 171, 0.2);
46+
--jp-editor-mirror-lsp-highlight-background-color: rgba(239, 231, 171, 0.1);
4747
}
4848

4949
.cm-s-xq-light {

0 commit comments

Comments
 (0)