-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce support for the Jupyter/Elyra 4.
These changes are required to support the Jupyter/Elyra 4.x IDE version bump which is expected in the OOTB Workbench images 2024.2+. All changes are done so that the backward compatibility with the current Jupyter/Elyra 3.x version is preserved. Note: since the 'default' version of the workbench images still points to 2024a with Jupyter 3, the line with the global env variable update to work with Jupyter 4 is commented out now with a TODO comment. Also, the reason why we are adding some code from the JupyterLibrary is that we're trying to use SeleniumLibrary for the browser opening. This doesn't match with some part of the code of the JupyterLibrary where it is expected that some keywords that are present in both (SeleniumLibrary and JupyterLibrary) are used from the JupyterLibrary. Since to narrow down this discrepancy (using JupyterLibrary explicitly and completely for the JupyterHub testing) would require more changes, I did it via this ughly hack now having part of the source from the JupyterLibrary directly in our codebase. Truth is that JupyterLibrary project seems to be abandonded so we may also think about fork it and handle it by ourselves in case we'll need more changes there.
- Loading branch information
Showing
8 changed files
with
1,533 additions
and
1,379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
*** Comments *** | ||
# This whole file is a copy of the "clients/jupyterlab/Icons.resource" file from the JupyterLibrary. | ||
|
||
# Motivation for the copy is that there is an explicit usage of the JupyterLibrary on one line of | ||
# the PageInfo.resource file in that library. So this file and the PageInfo.resource file were moved | ||
# to our repository with the one line fix. | ||
|
||
|
||
*** Settings *** | ||
Documentation Icon keywords for JupyterLab | ||
# Resource JupyterLibrary/clients/jupyterlab/PageInfo.resource | ||
Resource ./PageInfo.resource # Edited - our change | ||
|
||
|
||
*** Variables *** | ||
&{JLAB1 CSS ICONS} | ||
... add=span[data-icon="add"] | ||
... run=span[data-icon="run"] | ||
... filled circle=.jp-CircleFilledIcon | ||
... empty circle=.jp-CircleEmptyIcon | ||
&{JLAB2 CSS ICONS} | ||
... add=svg[@data-icon='ui-components:add'] | ||
... run=svg[@data-icon='ui-components:run'] | ||
... filled circle=svg[@data-icon='ui-components:circle-filled'] | ||
... empty circle=svg[@data-icon='ui-components:circle-empty'] | ||
&{JLAB1 XP ICONS} | ||
... add=span[@data-icon = 'add'] | ||
... run=span[@data-icon = 'run'] | ||
... filled circle=div[contains(@class, 'jp-CircleFilledIcon')] | ||
... empty circle=div[contains(@class, 'jp-CircleEmptyIcon')] | ||
&{JLAB2 XP ICONS} | ||
... add=*[@data-icon='ui-components:add'] | ||
... run=*[@data-icon='ui-components:run'] | ||
... filled circle=*[@data-icon='ui-components:circle-filled'] | ||
... empty circle=*[@data-icon='ui-components:circle-empty'] | ||
|
||
|
||
*** Keywords *** | ||
Get JupyterLab Icon CSS Custom # Edited | ||
[Documentation] Get a Lab version-specific, but general CSS selector for an ``icon``. | ||
[Arguments] ${icon} | ||
${version} = Get JupyterLab Application Version Info Custom | ||
${sel} = Set Variable If ${version[0].__eq__('1')} | ||
... ${JLAB1 CSS ICONS['${icon}']} | ||
... ${JLAB2 CSS ICONS['${icon}']} | ||
[Return] ${sel} | ||
|
||
Get JupyterLab Icon XPath Custom # Edited | ||
[Documentation] Get a Lab version-specific, but general XPath selector for an ``icon``. | ||
[Arguments] ${icon} | ||
${version} = Get JupyterLab Application Version Info Custom | ||
${sel} = Set Variable If ${version[0].__eq__('1')} | ||
... ${JLAB1 XP ICONS['${icon}']} | ||
... ${JLAB2 XP ICONS['${icon}']} | ||
[Return] ${sel} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
ods_ci/tests/Resources/Page/ODH/JupyterHub/PageInfo.resource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
*** Comments *** | ||
# This whole file is a copy of the "clients/jupyterlab/PageInfo.resource" file from the JupyterLibrary. | ||
|
||
# Motivation for the copy is that there is an explicit usage of the JupyterLibrary on one line of | ||
# the PageInfo.resource file in that library. So this file and the Icons.resource file were moved | ||
# to our repository with the one line fix. See the "Edited - our fix" line. | ||
|
||
|
||
*** Settings *** | ||
Documentation Page config keywords for JupyterLab | ||
Resource JupyterLibrary/clients/jupyterlab/Selectors.resource | ||
Library String | ||
Library json WITH NAME JSON | ||
|
||
|
||
*** Variables *** | ||
${JLAB XP PAGEINFO} script[contains(@id, 'jupyter-config-data')] | ||
# keep this updated below | ||
@{JLAB DEFAULT PAGEINFO TAGS} appName appVersion buildAvailable | ||
... buildCheck notebookVersion devMode | ||
|
||
|
||
*** Keywords *** | ||
Get JupyterLab Page Info Custom # Edited | ||
[Documentation] Get one (or all) of the ``pageInfo`` ``key`` s from JupyterLab's HTML ``<head>``. | ||
... Optionally ``clear`` the cached info first. | ||
... | ||
... See also: | ||
... - [#Tag With JupyterLab Metadata|Tag With JupyterLab Metadata] | ||
[Arguments] ${key}=${EMPTY} ${clear}=${False} | ||
${pageInfo} = Get Variable Value ${JLAB PAGEINFO CACHE} ${EMPTY} | ||
# Run Keyword If ${clear} or not ${pageInfo.__len__()} Update JupyterLab PageInfo Cache | ||
Run Keyword If ${clear} or not ${pageInfo.__len__()} Update JupyterLab PageInfo Cache Custom # Edited | ||
${pageInfo} = Set Variable ${JLAB PAGEINFO CACHE} | ||
${result} = Set Variable If ${key.__len__()} ${pageInfo.get("${key}")} ${pageInfo} | ||
[Return] ${result} | ||
|
||
Update JupyterLab PageInfo Cache Custom # Edited | ||
[Documentation] Update the cached JupyterLab ``pageInfo``. _Not usually needed._ | ||
${sel} = Set Variable xpath://${JLAB XP PAGEINFO} | ||
Wait Until Page Contains Element ${sel} | ||
# ${txt} = JupyterLibrary.Get Element Attribute ${sel} innerHTML | ||
${txt} = Get Element Attribute ${sel} innerHTML # Edited - our fix | ||
${pageInfo} = JSON.Loads ${txt} | ||
Set Suite Variable ${JLAB PAGEINFO CACHE} ${pageInfo} children=${True} | ||
|
||
Tag With JupyterLab Metadata Custom # Edited | ||
[Documentation] Tag the current test (or suite) with ``keys`` from the | ||
... JupyterLab ``pageInfo``. | ||
... The default ``keys``: ``appName`` ``appVersion`` ``buildAvailable`` | ||
... ``buildCheck`` ``notebookVersion`` ``devMode`` | ||
[Arguments] ${keys}=${JLAB DEFAULT PAGEINFO TAGS} ${clear}=${False} | ||
# ${info} = Get JupyterLab Page Info clear=${clear} | ||
${info} = Get JupyterLab Page Info Custom clear=${clear} # Edited | ||
FOR ${key} IN @{keys} | ||
${val} = Set Variable ${info.get("${key}")} | ||
Set Tags jupyterlab:${key}:${val} | ||
END | ||
|
||
Get JupyterLab Application Version Info Custom # Edited | ||
[Documentation] Get the version of the application ``2.3.0.rc1`` as a list of | ||
... strings from ``pageInfo``, e.g. ``["2", "3", "1", "rc1"]``. Optionally ``clear`` | ||
... the cached info first. | ||
[Arguments] ${clear}=${False} | ||
# ${version} = Get JupyterLab Page Info appVersion clear=${clear} | ||
${version} = Get JupyterLab Page Info Custom appVersion clear=${clear} # Edited | ||
${version_info} = Set Variable ${version.split(".")} | ||
[Return] ${version_info} |
Oops, something went wrong.