Skip to content

Commit 84eae22

Browse files
committed
start theme screenshot matrix test
1 parent 5ad11ee commit 84eae22

File tree

5 files changed

+79
-7
lines changed

5 files changed

+79
-7
lines changed

atest/01_Editor.robot

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
Suite Setup Setup Suite For Screenshots editor
33
Force Tags ui:editor
44
Resource Keywords.robot
5-
6-
*** Variables ***
7-
${MENU EDITOR} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(., "Editor")]
8-
${MENU JUMP} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "Jump to definition")]
9-
${CM CURSOR} css:.CodeMirror-cursor
10-
${CM CURSORS} css:.CodeMirror-cursors:not([style='visibility: hidden'])
5+
Resource Variables.robot
116

127
*** Test Cases ***
138
Bash

atest/06_Style.robot

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
*** Settings ***
2+
Suite Setup Setup Suite For Screenshots style
3+
Force Tags ui:editor aspect:style
4+
Resource Keywords.robot
5+
Resource Variables.robot
6+
Library Collections
7+
8+
*** Variables ***
9+
${THEME NAMES} ${EMPTY}
10+
11+
*** Test Cases ***
12+
Light
13+
Screenshot Editor Themes with Lab Theme JupyterLab Light
14+
15+
Dark
16+
Screenshot Editor Themes with Lab Theme JupyterLab Dark
17+
18+
*** Keywords ***
19+
Screenshot Editor Themes with Lab Theme
20+
[Arguments] ${lab theme} ${file}=example.py
21+
${norm lab theme} = Set Variable ${lab theme.lower().replace(" ", "-")}
22+
Set Tags theme:lab:${norm lab theme}
23+
Set Screenshot Directory ${OUTPUT DIR}${/}style${/}${norm lab theme}
24+
Copy File examples${/}${file} ${OUTPUT DIR}${/}home${/}${file}
25+
Run Keyword If "${THEME NAMES}" == "" Wait Until Keyword Succeeds 3x 1s Get Theme Names
26+
Lab Command Use ${lab theme} Theme
27+
Try to Close All Tabs
28+
Open ${file} in ${MENU EDITOR}
29+
Capture Page Screenshot 00-opened.png
30+
FOR ${editor theme} IN @{THEME NAMES}
31+
Capture Theme Screenshot ${editor theme}
32+
END
33+
[Teardown] Clean Up After Working With File ${file}
34+
35+
Capture Theme Screenshot
36+
[Arguments] ${editor theme}
37+
Change Editor Theme ${editor theme}
38+
Wait Until Fully Initialized
39+
Wait Until Page Contains Element css:.cm-lsp-diagnostic timeout=20s
40+
Click the second Accumulate
41+
Capture Page Screenshot ${editor theme.replace(' ', '-')}.png
42+
43+
Click the second Accumulate
44+
Click Element xpath://span[text()\='accumulate'][2]
45+
46+
Change Editor Theme
47+
[Arguments] ${editor theme}
48+
Open Editor Theme Menu
49+
${sel} = Set Variable xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "${editor theme}")]
50+
Wait Until Page Contains Element ${sel}
51+
Mouse Over ${sel}
52+
Click Element ${sel}
53+
54+
Open Editor Theme Menu
55+
Wait Until Page Contains Element ${MENU SETTINGS}
56+
Mouse Over ${MENU SETTINGS}
57+
Click Element ${MENU SETTINGS}
58+
Wait Until Page Contains Element ${MENU EDITOR THEME}
59+
Mouse Over ${MENU EDITOR THEME}
60+
Click Element ${MENU EDITOR THEME}
61+
62+
Get Theme Names
63+
Open Editor Theme Menu
64+
${els} = Get WebElements css:[data-command\="codemirror:change-theme"]
65+
${theme names} = Create List
66+
FOR ${element} IN @{els}
67+
Append To List ${theme names} ${element.text}
68+
END
69+
Set Suite Variable ${THEME NAMES} ${theme names}

atest/Variables.robot

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ ${DIALOG WINDOW} css:.jp-Dialog
2424
${DIALOG INPUT} css:.jp-Input-Dialog input
2525
${DIALOG ACCEPT} css:button.jp-Dialog-button.jp-mod-accept
2626
${STATUSBAR} css:div.lsp-statusbar-item
27+
${MENU EDITOR} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(., "Editor")]
28+
${MENU JUMP} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "Jump to definition")]
29+
${MENU SETTINGS} xpath://div[contains(@class, 'lm-MenuBar-itemLabel')][contains(text(), "Settings")]
30+
${MENU EDITOR THEME} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "Text Editor Theme")]
31+
${CM CURSOR} css:.CodeMirror-cursor
32+
${CM CURSORS} css:.CodeMirror-cursors:not([style='visibility: hidden'])

atest/examples/example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''Fibonacci accumulation'''
22

3-
from itertools import (accumulate, chain)
3+
from itertools import (accumulate, chain); accumulate
44

55

66
# fibs :: Integer :: [Integer]

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
--jp-editor-mirror-lsp-highlight-background-color: rgba(144, 199, 255, 0.2);
33
}
44

5+
/* ... so many other themes ... */
6+
57
.cm-s-zenburn {
68
--jp-editor-mirror-lsp-highlight-background-color: rgba(239, 231, 171, 0.2);
79
}

0 commit comments

Comments
 (0)