Skip to content

Commit

Permalink
Add tests for #393
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Dec 12, 2020
1 parent ececa35 commit 1906178
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
33 changes: 33 additions & 0 deletions atest/03_Notebook.robot
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,39 @@ Python
Capture Page Screenshot 01-python.png
[Teardown] Clean Up After Working With File Python.ipynb

Conversion Of Cell Types
[Setup] Setup Notebook Python Python.ipynb
${lsp_entry} = Set Variable Show diagnostics panel
# initial (code) cell
Open Context Menu Over Cell Editor 1
Capture Page Screenshot 01-initial-code-cell.png
Context Menu Should Contain ${lsp_entry}
Close Context Menu
# raw cell
Lab Command Change to Raw Cell Type
Open Context Menu Over Cell Editor 1
Capture Page Screenshot 02-as-raw-cell.png
Context Menu Should Not Contain ${lsp_entry}
Close Context Menu
# code cell again
Lab Command Change to Code Cell Type
Open Context Menu Over Cell Editor 1
Capture Page Screenshot 03-as-code-cell-again.png
Context Menu Should Contain ${lsp_entry}
Close Context Menu
[Teardown] Clean Up After Working With File Python.ipynb

Moving Cells Around
[Setup] Setup Notebook Python Python.ipynb
${diagnostic} = Set Variable undefined name 'test' (pyflakes)
Enter Cell Editor 1
Lab Command Move Cells Down
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title="${diagnostic}"] timeout=35s
Enter Cell Editor 1
Lab Command Move Cells Down
Wait Until Page Does Not Contain Element css:.cm-lsp-diagnostic[title="${diagnostic}"] timeout=35s
[Teardown] Clean Up After Working With File Python.ipynb

Foreign Extractors
${file} = Set Variable Foreign extractors.ipynb
Configure JupyterLab Plugin
Expand Down
18 changes: 18 additions & 0 deletions atest/Keywords.robot
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ Enter Cell Editor
Click Element css:.jp-Cell:nth-child(${cell_nr}) .CodeMirror-line:nth-child(${line})
Wait Until Page Contains Element css:.jp-Cell:nth-child(${cell_nr}) .CodeMirror-focused

Open Context Menu Over Cell Editor
[Arguments] ${cell_nr} ${line}=1
Enter Cell Editor ${cell_nr} line=${line}
Open Context Menu Over css:.jp-Cell:nth-child(${cell_nr}) .CodeMirror-line:nth-child(${line})

Place Cursor In Cell Editor At
[Arguments] ${cell_nr} ${line} ${character}
Enter Cell Editor ${cell_nr} ${line}
Expand All @@ -301,6 +306,19 @@ Open Context Menu Over
Wait Until Keyword Succeeds 10 x 0.1 s Mouse Over ${sel}
Wait Until Keyword Succeeds 10 x 0.1 s Open Context Menu ${sel}

Context Menu Should Contain
[Arguments] ${label} ${timeout}=10s
${entry} Set Variable xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), '${label}')]
Wait Until Page Contains Element ${entry} timeout=${timeout}

Context Menu Should Not Contain
[Arguments] ${label} ${timeout}=10s
${entry} Set Variable xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), '${label}')]
Wait Until Page Does Not Contain Element ${entry} timeout=${timeout}

Close Context Menu
Press Keys None ESCAPE

Prepare File for Editing
[Arguments] ${Language} ${Screenshots} ${file}
Set Tags language:${Language.lower()}
Expand Down

0 comments on commit 1906178

Please sign in to comment.