|
4 | 4 | * Copyright IBM Corp. 2026 |
5 | 5 | */ |
6 | 6 | import { expect } from 'chai'; |
7 | | -import { EditorView, TextEditor, VSBrowser, Workbench, WebDriver, BottomBarPanel, MarkerType, Key, By } from 'vscode-extension-tester'; |
| 7 | +import { EditorView, VSBrowser, WebDriver } from 'vscode-extension-tester'; |
8 | 8 | import * as utils from './utils/testUtils'; |
9 | 9 | import { logger } from './utils/testLogger'; |
10 | 10 | import * as path from 'path'; |
11 | 11 | import { ProblemsPage } from './pages/ProblemsPage'; |
12 | 12 | import { EditorPage } from './pages/EditorPage'; |
13 | 13 | import { CodeAssistPage } from './pages/CodeAssistPage'; |
14 | 14 | import { QuickFixPage } from './pages/QuickFixPage'; |
| 15 | +import * as editorUtils from './utils/editorUtils'; |
15 | 16 |
|
16 | 17 | describe('Rest Class Snippet Test for Maven Project', () => { |
17 | 18 | let editorPage: EditorPage; |
@@ -61,7 +62,7 @@ describe('Rest Class Snippet Test for Maven Project', () => { |
61 | 62 | // selectText may fail but setText still works |
62 | 63 | } |
63 | 64 |
|
64 | | - await editorPage.clear(); |
| 65 | + await editorUtils.clearEditor(editorPage.getEditor()); |
65 | 66 | logger.info('Reset TestRest.java to empty after test'); |
66 | 67 | } |
67 | 68 | } catch (error) { |
@@ -101,15 +102,15 @@ describe('Rest Class Snippet Test for Maven Project', () => { |
101 | 102 | logger.testStart('rest_class snippet inserts correct REST class'); |
102 | 103 |
|
103 | 104 | // at the top of the rest_class snippet test, before positioning the cursor |
104 | | - await editorPage.clear(); |
| 105 | + await editorUtils.clearEditor(editorPage.getEditor()); |
105 | 106 | await wait.sleep(1500); // let any auto-stub settle, then confirm |
106 | 107 | const check = await editorPage.getEditor().getText(); |
107 | 108 | logger.info('Buffer before snippet: ' + JSON.stringify(check)); |
108 | 109 |
|
109 | 110 | try { |
110 | 111 | logger.step(1, 'Positioning cursor for snippet insertion'); |
111 | 112 | // Position cursor at end of file |
112 | | - await editorPage.moveCursorToEnd(); |
| 113 | + await editorUtils.moveCursorToEnd(editorPage.getEditor()); |
113 | 114 |
|
114 | 115 | // Type rest and trigger snippet insertion |
115 | 116 | logger.step(2, 'Opening content assist'); |
@@ -139,7 +140,7 @@ describe('Rest Class Snippet Test for Maven Project', () => { |
139 | 140 | logger.testStart('Diagnostic for a private @GET method and quick fix clears it'); |
140 | 141 | try { |
141 | 142 | // Find the method with @GET and change it to private |
142 | | - await editorPage.replaceTextWithinLineContaining('methodname', 'public' , 'private'); |
| 143 | + await editorUtils.replaceTextWithinLineContaining(editorPage.getEditor(), 'methodname', 'public', 'private'); |
143 | 144 |
|
144 | 145 | // Save file and wait for reanalysis |
145 | 146 | await editorPage.getEditor().save(); |
|
0 commit comments