File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
packages/page-objects/src/components/workbench/input
tests/test-project/src/test/workbench Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 1818import { AbstractElement } from '../../AbstractElement' ;
1919import { Key , WebElement } from 'selenium-webdriver' ;
2020import { NullAttributeError , QuickOpenBox } from '../../..' ;
21+ import { sep } from 'path' ;
2122
2223/**
2324 * Abstract page object for input fields
@@ -224,7 +225,16 @@ export abstract class Input extends AbstractElement {
224225 private async resetPosition ( ) : Promise < void > {
225226 const text = await this . getText ( ) ;
226227 await this . clear ( ) ;
227- await this . setText ( text ) ;
228+
229+ // handle path as path, not as text - use platform-specific separator
230+ const hasTrailingSeparator = text . endsWith ( sep ) ;
231+ if ( hasTrailingSeparator ) {
232+ await this . setText ( text . slice ( 0 , - 1 ) ) ;
233+ const input = await this . findElement ( Input . locators . Input . inputBox ) . findElement ( Input . locators . Input . input ) ;
234+ await input . sendKeys ( sep ) ;
235+ } else {
236+ await this . setText ( text ) ;
237+ }
228238 }
229239}
230240
Original file line number Diff line number Diff line change @@ -196,6 +196,31 @@ describe('InputBox', () => {
196196 } ) ;
197197} ) ;
198198
199+ describe ( 'InputBox - works for path' , ( ) => {
200+ let input : InputBox ;
201+
202+ before ( async function ( ) {
203+ this . timeout ( 10000 ) ;
204+ await new Workbench ( ) . executeCommand ( 'File: Open Folder...' ) ;
205+ input = await InputBox . create ( ) ;
206+ } ) ;
207+
208+ after ( async ( ) => {
209+ await new EditorView ( ) . closeAllEditors ( ) ;
210+ } ) ;
211+
212+ it ( 'findQuickPick works' , async function ( ) {
213+ const quickpick = await input . findQuickPick ( 'test-folder' ) ;
214+ expect ( quickpick ) . to . not . be . undefined ;
215+ } ) ;
216+
217+ it ( 'selectQuickPick works' , async function ( ) {
218+ await input . selectQuickPick ( 'test-folder' ) ;
219+ const quickpick2 = await input . findQuickPick ( 'foolder' ) ;
220+ expect ( quickpick2 ) . to . not . be . undefined ;
221+ } ) ;
222+ } ) ;
223+
199224describe ( 'Multiple selection input' , ( ) => {
200225 let input : InputBox ;
201226
You can’t perform that action at this time.
0 commit comments