Skip to content

Commit

Permalink
fix: locator selection and outputChannel selector (#138)
Browse files Browse the repository at this point in the history
* fix:

    The locator selection by vscode version did not work, because the vscode version was overwritten by the underlying chrome version and "122" was larger than all vscode versions. The vscode version is now preserved and use for locator selection.

    As of vscode 1.87.0 the bottombar's outputChanel selector does not have an attribute title anymore. The locator for 1.87.0 was thus added.

* fix: fixed no-trailing-spaces

---------

Co-authored-by: jan872 <[email protected]>
  • Loading branch information
jan872 and jan872 authored Sep 25, 2024
1 parent 78f45a9 commit 1429340
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default class VSCodeServiceLauncher {
}

const version = cap[VSCODE_CAPABILITY_KEY].version || cap.browserVersion || DEFAULT_CHANNEL
cap[VSCODE_CAPABILITY_KEY].version = version

/**
* setup VSCode Desktop
Expand Down
9 changes: 9 additions & 0 deletions src/locators/1.87.0.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { BottomBarViews as BottomBarViewsImport } from './1.84.0.js'

export * from './1.84.0.js'
export const locatorVersion = '1.87.0'

export const BottomBarViews = {
...BottomBarViewsImport,
outputChannels: 'ul[aria-label="Output actions"] select'
}
4 changes: 2 additions & 2 deletions src/locators/insiders.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
QuickOpenBox as QuickOpenBoxImport
} from './1.84.0.js'
} from './1.87.0.js'

export * from './1.84.0.js'
export * from './1.87.0.js'
export const locatorVersion = 'insiders'
export const QuickOpenBox = {
...QuickOpenBoxImport,
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/bottomBar/AbstractViews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export abstract class ChannelView<T> extends ElementWithContextMenu<T> {
*/
async getCurrentChannel (): Promise<string> {
const combo = await this.parent.$(this.locatorMap.BottomBarViews.channelCombo as string)
return combo.getAttribute('title')
return combo.getValue()
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/pageobjects/workbench/Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export abstract class Input extends BasePage<AllInputLocators> {
*/
async getText (): Promise<string> {
const input = await this.inputBox$.$(this.locators.input)
return input.getAttribute('value')
return input.getValue()
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,13 @@ export default class VSCodeWorkerService implements Services.ServiceInstance {
await browser.url('/')
}

const vsCodeVersion = capabilities[VSCODE_CAPABILITY_KEY]?.version || capabilities.browserVersion || 'insiders'
this._browser = browser
const locators = await getLocators(capabilities.browserVersion || 'insiders')
const locators = await getLocators(vsCodeVersion)
const workbenchPO = new Workbench(locators)
this._browser.addCommand('getWorkbench', () => workbenchPO.wait())
this._browser.addCommand('executeWorkbench', this._executeVSCode.bind(this))
this._browser.addCommand('getVSCodeVersion', () => capabilities.browserVersion)
this._browser.addCommand('getVSCodeVersion', () => vsCodeVersion)
this._browser.addCommand('isVSCodeWebSession', () => this._isWebSession)
this._browser.addCommand('getVSCodeChannel', () => (
capabilities.browserVersion === 'insiders' ? 'insiders' : 'vscode'
Expand Down

0 comments on commit 1429340

Please sign in to comment.