|
| 1 | +*** Settings *** |
| 2 | +Suite Setup Setup Suite For Screenshots hover |
| 3 | +Test Setup Setup Hover Test |
| 4 | +Test Teardown Clean Up After Working With File Hover.ipynb |
| 5 | +Force Tags feature:hover |
| 6 | +Resource ../Keywords.robot |
| 7 | +Library ../mouse_over_extension.py |
| 8 | + |
| 9 | +*** Variables *** |
| 10 | +${HOVER_BOX} css:.lsp-hover |
| 11 | +${HOVER_SIGNAL} css:.cm-lsp-hover-available |
| 12 | + |
| 13 | +*** Test Cases *** |
| 14 | +Hover works in notebooks |
| 15 | + Enter Cell Editor 1 |
| 16 | + Trigger Tooltip python_add |
| 17 | + Element Text Should Be ${HOVER_SIGNAL} python_add |
| 18 | + Capture Page Screenshot 02-hover-shown.png |
| 19 | + Element Should Contain ${HOVER_BOX} python_add(a: int, b: int) |
| 20 | + # syntax highlight should work |
| 21 | + Page Should Contain Element ${HOVER_BOX} code.language-python |
| 22 | + # testing multi-element responses |
| 23 | + Element Should Contain ${HOVER_BOX} Add documentation |
| 24 | + # it should be possible to move the mouse over the tooltip in order to copy/scroll |
| 25 | + Mouse Over ${HOVER_BOX} |
| 26 | + |
| 27 | +Hover can be triggered via modifier key once cursor stopped moving |
| 28 | + Enter Cell Editor 1 |
| 29 | + ${element} = Last Occurrence python_add |
| 30 | + Wait Until Keyword Succeeds 5x 0.1 s Trigger Via Modifier Key Press ${element} |
| 31 | + |
| 32 | +Hover works in foreign code (javascript) |
| 33 | + Enter Cell Editor 2 |
| 34 | + Trigger Tooltip js_add |
| 35 | + Capture Page Screenshot 02-hover-shown.png |
| 36 | + Element Should Contain ${HOVER_BOX} function js_add(a: any, b: any): any |
| 37 | + Page Should Contain Element ${HOVER_BOX} code.language-typescript |
| 38 | + # should be hidden once moving the mouse away |
| 39 | + Mouse Over ${STATUSBAR} |
| 40 | + Page Should Not Contain Element ${HOVER_BOX} |
| 41 | + Page Should Not Contain Element ${HOVER_SIGNAL} |
| 42 | + # also for multiple cells of the same document |
| 43 | + Enter Cell Editor 3 |
| 44 | + Trigger Tooltip Math |
| 45 | + Element Should Contain ${HOVER_BOX} const Math: Math |
| 46 | + |
| 47 | +*** Keywords *** |
| 48 | +Last Occurrence |
| 49 | + [Arguments] ${symbol} |
| 50 | + ${sel} = Set Variable If "${symbol}".startswith(("xpath", "css")) ${symbol} xpath:(//span[@role="presentation"][contains(., "${symbol}")])[last()] |
| 51 | + [Return] ${sel} |
| 52 | + |
| 53 | +Trigger Via Hover With Modifier |
| 54 | + [Arguments] ${sel} |
| 55 | + # bring the cursor to the element |
| 56 | + Mouse Over ${sel} |
| 57 | + # move it back and forth (wiggle) while hodling the ctrl modifier |
| 58 | + Mouse Over With Control ${sel} x_wiggle=5 |
| 59 | + Wait Until Page Contains Element ${HOVER_SIGNAL} |
| 60 | + Wait Until Keyword Succeeds 4x 0.1s Page Should Contain Element ${HOVER_BOX} |
| 61 | + |
| 62 | +Trigger Via Modifier Key Press |
| 63 | + [Arguments] ${sel} |
| 64 | + # bring the cursor to the element |
| 65 | + Mouse Over ${sel} |
| 66 | + Wait Until Page Contains Element ${HOVER_SIGNAL} timeout=10s |
| 67 | + Mouse Over And Wiggle ${sel} 5 |
| 68 | + Press Keys ${sel} CTRL |
| 69 | + Wait Until Keyword Succeeds 4x 0.1s Page Should Contain Element ${HOVER_BOX} |
| 70 | + |
| 71 | +Trigger Tooltip |
| 72 | + [Arguments] ${symbol} |
| 73 | + [Documentation] The default way to trigger the hover tooltip |
| 74 | + ${sel} = Last Occurrence ${symbol} |
| 75 | + Wait Until Keyword Succeeds 4x 0.1 s Trigger Via Hover With Modifier ${sel} |
| 76 | + |
| 77 | +Setup Hover Test |
| 78 | + Setup Notebook Python Hover.ipynb |
0 commit comments