|
| 1 | +*** Settings *** |
| 2 | +Force Tags ui:editor |
| 3 | +Resource Keywords.robot |
| 4 | + |
| 5 | +*** Variables *** |
| 6 | +${MENU EDITOR} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(., "Editor")] |
| 7 | +${MENU OPEN WITH} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(text(), "Open With")] |
| 8 | +${MENU JUMP} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(text(), "Jump to definition")] |
| 9 | +${CM CURSOR} css:.CodeMirror-cursor |
| 10 | +${CM CURSORS} css:.CodeMirror-cursors:not([style='visibility: hidden']) |
| 11 | + |
| 12 | +*** Test Cases *** |
| 13 | +Bash |
| 14 | + Editor Shows Features for Language Bash example.sh Diagnostics=Failed to parse expression Jump to Definition=fib |
| 15 | + |
| 16 | +CSS |
| 17 | + ${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable-2')][contains(text(), '--some-var')])[last()] |
| 18 | + Editor Shows Features for Language CSS example.css Diagnostics=Do not use empty rulesets Jump to Definition=${def} |
| 19 | + |
| 20 | +Docker |
| 21 | + ${def} = Set Variable xpath://span[contains(@class, 'cm-string')][contains(text(), 'PLANET')] |
| 22 | + Editor Shows Features for Language Docker Dockerfile Diagnostics=Instruction has no arguments Jump to Definition=${def} |
| 23 | + |
| 24 | +JS |
| 25 | + ${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'fib')])[last()] |
| 26 | + Editor Shows Features for Language JS example.js Diagnostics=Expression expected Jump to Definition=${def} |
| 27 | + |
| 28 | +JSON |
| 29 | + Editor Shows Features for Language JSON example.json Diagnostics=Duplicate object key |
| 30 | + |
| 31 | +JSX |
| 32 | + ${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'hello')])[last()] |
| 33 | + Editor Shows Features for Language JSX example.jsx Diagnostics=Expression expected Jump to Definition=${def} |
| 34 | + |
| 35 | +Less |
| 36 | + ${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable-2')][contains(text(), '@width')])[last()] |
| 37 | + Editor Shows Features for Language Less example.less Diagnostics=Do not use empty rulesets Jump to Definition=${def} |
| 38 | + |
| 39 | +Python |
| 40 | + ${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'fib')])[last()] |
| 41 | + Editor Shows Features for Language Python example.py Diagnostics=multiple spaces after keyword Jump to Definition=${def} |
| 42 | + |
| 43 | +R |
| 44 | + ${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'fib')])[last()] |
| 45 | + Editor Shows Features for Language R example.R Diagnostics=Put spaces around all infix operators Jump to Definition=${def} |
| 46 | + |
| 47 | +SCSS |
| 48 | + ${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable-2')][contains(text(), 'primary-color')])[last()] |
| 49 | + Editor Shows Features for Language SCSS example.scss Diagnostics=Do not use empty rulesets Jump to Definition=${def} |
| 50 | + |
| 51 | +TSX |
| 52 | + ${def} = Set Variable xpath:(//span[contains(@class, 'cm-tag')][contains(text(), 'HelloWorld')])[last()] |
| 53 | + Editor Shows Features for Language TSX example.tsx Diagnostics=Cannot find module 'react' Jump to Definition=${def} |
| 54 | + |
| 55 | +TypeScript |
| 56 | + ${def} = Set Variable xpath:(//span[contains(@class, 'cm-variable')][contains(text(), 'inc')])[last()] |
| 57 | + Editor Shows Features for Language TypeScript example.ts Diagnostics=The left-hand side of an arithmetic Jump to Definition=${def} |
| 58 | + |
| 59 | +YAML |
| 60 | + Editor Shows Features for Language YAML example.yaml Diagnostics=duplicate key |
| 61 | + |
| 62 | +*** Keywords *** |
| 63 | +Editor Shows Features for Language |
| 64 | + [Arguments] ${Language} ${file} &{features} |
| 65 | + Set Tags language:${Language.lower()} |
| 66 | + Set Screenshot Directory ${OUTPUT DIR}${/}screenshots${/}editor${/}${Language.lower()} |
| 67 | + Copy File examples${/}${file} ${OUTPUT DIR}${/}home${/}${file} |
| 68 | + Reset Application State |
| 69 | + Open ${file} in Editor |
| 70 | + FOR ${f} IN @{features} |
| 71 | + Run Keyword If "${f}" == "Diagnostics" Editor Should Show Diagnostics ${features["${f}"]} |
| 72 | + ... ELSE IF "${f}" == "Jump to Definition" Editor Should Jump To Definition ${features["${f}"]} |
| 73 | + END |
| 74 | + [Teardown] Remove File ${OUTPUT DIR}${/}home${/}${file} |
| 75 | + |
| 76 | +Open ${file} in Editor |
| 77 | + Open Context Menu css:.jp-DirListing-item[title="${file}"] |
| 78 | + Mouse Over ${MENU OPEN WITH} |
| 79 | + Wait Until Page Contains Element ${MENU EDITOR} |
| 80 | + Mouse Over ${MENU EDITOR} |
| 81 | + Click Element ${MENU EDITOR} |
| 82 | + |
| 83 | +Editor Should Show Diagnostics |
| 84 | + [Arguments] ${diagnostic} |
| 85 | + Set Tags feature:diagnostics |
| 86 | + Wait Until Page Contains Element css:.cm-lsp-diagnostic[title*="${diagnostic}"] timeout=20s |
| 87 | + Capture Page Screenshot diagnostics.png |
| 88 | + |
| 89 | +Editor Should Jump To Definition |
| 90 | + [Arguments] ${symbol} |
| 91 | + Set Tags feature:jump-to-definition |
| 92 | + ${sel} = Set Variable If "${symbol}".startswith(("xpath", "css")) ${symbol} xpath:(//span[@role="presentation"][contains(., "${symbol}")])[last()] |
| 93 | + Mouse Over ${sel} |
| 94 | + Run Keyword If "${OS}" == "Windows" Sleep 10s |
| 95 | + Wait Until Keyword Succeeds 10 x 0.1 s Click Element ${sel} |
| 96 | + Wait Until Keyword Succeeds 10 x 0.1 s Open Context Menu ${sel} |
| 97 | + ${cursor} = Measure Cursor Position |
| 98 | + Capture Page Screenshot jump-to-definition-0.png |
| 99 | + Mouse Over ${MENU JUMP} |
| 100 | + Capture Page Screenshot jump-to-definition-1.png |
| 101 | + Click Element ${MENU JUMP} |
| 102 | + Wait Until Keyword Succeeds 10 x 1 s Cursor Should Jump ${cursor} |
| 103 | + Capture Page Screenshot jump-to-definition-2.png |
| 104 | + |
| 105 | +Cursor Should Jump |
| 106 | + [Arguments] ${original} |
| 107 | + ${current} = Measure Cursor Position |
| 108 | + Should Not Be Equal ${original} ${current} |
| 109 | + |
| 110 | +Measure Cursor Position |
| 111 | + Wait Until Page Contains Element ${CM CURSORS} |
| 112 | + ${position} = Wait Until Keyword Succeeds 20 x 0.05s Get Vertical Position ${CM CURSOR} |
| 113 | + [Return] ${position} |
0 commit comments