-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathShell.resource
93 lines (82 loc) · 4.19 KB
/
Shell.resource
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
*** Settings ***
Documentation Application shell keywords for JupyterLab
Resource JupyterLibrary/clients/jupyterlab/Selectors.resource
Resource JupyterLibrary/clients/jupyterlab/PageInfo.resource
*** Keywords ***
# robocop: disable=too-many-arguments
Open JupyterLab
[Documentation] Open JupyterLab, served from the given (or most-recently-started)
... ``nbserver`` in a ``browser`` (or ``headlessfirefox``) or ``url``,
... then wait for the splash screen.
... Extra ``configuration`` is passed on to SeleniumLibrary's [#Open Browser|Open Browser].
[Arguments] ${browser}=headlessfirefox
... ${nbserver}=${None}
... ${url}=${EMPTY}
... ${clear}=${False}
... ${pageinfo tags}=@{JLAB DEFAULT PAGEINFO TAGS}
... &{configuration}
${nbserver_url} = Run Keyword If not "${url}" Get Jupyter Server URL ${nbserver}
${token} = Run Keyword If not "${url}" Get Jupyter Server Token ${nbserver}
${final_url} = Set Variable If "${url}" ${url} ${nbserver_url}lab?token=${token}
Open Browser url=${final_url} browser=${browser} &{configuration}
Wait For JupyterLab Splash Screen
Tag With JupyterLab Metadata ${pageinfo tags} clear=${clear}
Wait For JupyterLab Splash Screen
[Documentation] Wait for the JupyterLab splash animation, waiting ``timeout``
... for the splash screen to appear/disappear, then ``sleep``.
[Arguments] ${timeout}=10s ${sleep}=2s
Wait Until Page Contains Element css:#${JLAB ID SPLASH} timeout=${timeout}
Wait Until Page Does Not Contain Element css:#${JLAB ID SPLASH} timeout=${timeout}
Sleep ${sleep}
Click JupyterLab Menu
[Documentation] Click a top-level JupyterLab menu bar item by ``label``,
... e.g. _File_, _Help_, etc.
[Arguments] ${label}
${xpath} = Set Variable ${JLAB XP TOP}${JLAB XP MENU LABEL}\[text() = '${label}']
Wait Until Page Contains Element ${xpath}
Mouse Over ${xpath}
Click Element ${xpath}
Run Keyword And Ignore Error Mouse Over ${xpath}
Click JupyterLab Menu Item
[Documentation] Click a currently-visible JupyterLab menu item by ``label``.
[Arguments] ${label}
${item} = Set Variable ${JLAB XP MENU ITEM LABEL ENABLED}\[text() = '${label}']
Wait Until Page Contains Element ${item}
Mouse Over ${item}
Click Element ${item}
Run Keyword And Ignore Error Mouse Over ${item}
Open With JupyterLab Menu
[Documentation] Click into a ``menu``, then a series of ``submenus``.
[Arguments] ${menu} @{submenus}
Click JupyterLab Menu ${menu}
FOR ${submenu} IN @{submenus}
Click JupyterLab Menu Item ${submenu}
END
Maybe Accept A JupyterLab Prompt
[Documentation] Click the last button in a JupyterLab dialog (if one is open).
${accept} = Get WebElements xpath:${JLAB POPUP}
${len} = Get Length ${accept}
# Click the right most button of the popup
Run Keyword If ${accept} Click Element xpath:${JLAB POPUP}/button[last()]
[Return] ${len}
Maybe Accept All JupyterLab Prompts
[Documentation] Try accepting all JL popups.
${total} = Set Variable ${0}
FOR ${i} IN RANGE 9999999
${closed} = Maybe Accept A JupyterLab Prompt
${total} = ${total}+${closed}
Exit For Loop If ${closed}==0
END
[Return] ${total}
Get JupyterLab Dock Panel Tab
[Documentation] Get the ``n`` -th JupyterLab Dock Panel Tab with ``label`` as a ``WebElement``.
... ``n`` is the 1-based index of the like- ``label`` ed tabs.
[Arguments] ${label} ${n}=1
${els} = Get WebElements xpath:${JLAB XP DOCK TAB LABEL}\[. = '${label}']/..
[Return] ${els[${n}-1]}
Close JupyterLab Dock Panel Tab
[Documentation] Close the ``n`` -th JupyterLab Dock Panel Tab with ``label`` as a ``WebElement``.
... ``n`` is the 1-based index of the like- ``label`` ed tabs.
[Arguments] ${label} ${n}=1
${tab} = Get JupyterLab Dock Panel Tab ${label} ${n}
Click Element ${tab.find_element_by_xpath('./div[last()]')}