Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: locator selection and outputChannel selector #138

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
}

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

cap[VSCODE_CAPABILITY_KEY].version = version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version is not a valid capability. What is the idea behind this change?

Copy link
Contributor Author

@jan872 jan872 Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From line 89 I assumed that version was a valid capability, as it was used there.

The idea was to store the actual vscode version before cap.browserVersion gets overwritten here: https://github.com/webdriverio-community/wdio-vscode-service/blob/main/src/launcher.ts#L174
such that it is available here for selection of the right locators:
https://github.com/webdriverio-community/wdio-vscode-service/blob/main/src/service.ts#L207
(see https://github.com/webdriverio-community/wdio-vscode-service/pull/138/files#diff-84b68bce2abfcb25c3328df0286963d7dacc924940adc41923bf4f502a6bc95aR206)

Currently the capabilities.browserVersion is overwritten to the chrome version, and the locators may thus not be selected correctly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jan872 actually this is correct, it is just changing the VSCODE_CAPABILITY_KEY capability object which can have arbitrary content.


Check failure on line 91 in src/launcher.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, stable)

Trailing spaces not allowed

Check failure on line 91 in src/launcher.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 1.86.0)

Trailing spaces not allowed

Check failure on line 91 in src/launcher.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, web)

Trailing spaces not allowed

Check failure on line 91 in src/launcher.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest, stable)

Trailing spaces not allowed

Check failure on line 91 in src/launcher.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest, 1.86.0)

Trailing spaces not allowed

Check failure on line 91 in src/launcher.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest, web)

Trailing spaces not allowed
/**
* 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
Loading