diff --git a/locators/lib/1.37.0.ts b/locators/lib/1.37.0.ts index a9272d400..5bdd1c9a1 100644 --- a/locators/lib/1.37.0.ts +++ b/locators/lib/1.37.0.ts @@ -79,7 +79,8 @@ const bottomBar = { }, OutputView: { constructor: By.id('workbench.panel.output'), - actionsLabel: 'Output actions' + actionsLabel: 'Output actions', + optionByName: (name: string) => By.xpath(`.//option[@value='${name}']`) }, WebviewView: { iframe: By.xpath(`//div[not(@class)]/iframe[@class='webview ready' and not(@data-parent-flow-to-element-id)]`) diff --git a/page-objects/src/components/bottomBar/AbstractViews.ts b/page-objects/src/components/bottomBar/AbstractViews.ts index 0472f2cda..1f2f0feb6 100644 --- a/page-objects/src/components/bottomBar/AbstractViews.ts +++ b/page-objects/src/components/bottomBar/AbstractViews.ts @@ -1,4 +1,4 @@ -import { Key, WebElement } from 'selenium-webdriver'; +import { Key } from 'selenium-webdriver'; import { ElementWithContexMenu } from "../ElementWithContextMenu"; /** @@ -31,6 +31,9 @@ export abstract class ChannelView extends ElementWithContexMenu { * @returns Promise resolving to the current channel name */ async getCurrentChannel(): Promise { + if(ChannelView.versionInfo.version >= '1.87.0' && process.platform !== 'darwin') { + throw Error(`The 'ChannelView.getCurrentChannel' method is broken! Read more information in 'Known Issues > Limitations in testing with VS Code 1.87+' - https://github.com/microsoft/vscode/issues/206897.`); + } const combo = await this.enclosingItem.findElement(ChannelView.locators.BottomBarViews.channelCombo); return await combo.getAttribute('title'); } @@ -40,43 +43,9 @@ export abstract class ChannelView extends ElementWithContexMenu { * @param name name of the channel to open */ async selectChannel(name: string): Promise { - const rows = await this.getOptions(); - for (let i = 0; i < rows.length; i++) { - if ((await rows[i].getAttribute('class')).indexOf('disabled') < 0) { - const text = await (await rows[i].findElement(ChannelView.locators.BottomBarViews.channelText)).getText(); - if (name === text) { - await rows[i].click(); - await new Promise(res => setTimeout(res, 500)); - return; - } - } - } - throw new Error(`Channel ${name} not found`); - } - - private async getOptions(): Promise { const combo = await this.enclosingItem.findElement(ChannelView.locators.BottomBarViews.channelCombo); - const workbench = await this.getDriver().findElement(ChannelView.locators.Workbench.constructor); - const menus = await workbench.findElements(ChannelView.locators.ContextMenu.contextView); - let menu!: WebElement; - - if (menus.length < 1) { - await combo.click(); - await this.getDriver().sleep(500); - menu = await workbench.findElement(ChannelView.locators.ContextMenu.contextView); - return await menu.findElements(ChannelView.locators.BottomBarViews.channelRow); - } else if (await menus[0].isDisplayed()) { - await combo.click(); - await this.getDriver().sleep(500); - } - await combo.click(); - await this.getDriver().sleep(500); - menu = await workbench.findElement(ChannelView.locators.ContextMenu.contextView); - if (!await menu.isDisplayed()) { - await combo.click(); - await this.getDriver().sleep(500); - } - return await menu.findElements(ChannelView.locators.BottomBarViews.channelRow); + const option = await combo.findElement(ChannelView.locators.OutputView.optionByName(name)); + await option.click(); } } diff --git a/page-objects/src/components/bottomBar/Views.ts b/page-objects/src/components/bottomBar/Views.ts index a9e456d2f..31085dad9 100644 --- a/page-objects/src/components/bottomBar/Views.ts +++ b/page-objects/src/components/bottomBar/Views.ts @@ -1,5 +1,5 @@ import { Key, until } from "selenium-webdriver"; -import { BottomBarPanel, ContentAssist, InputBox, Workbench } from "../.."; +import { BottomBarPanel, ContentAssist, Workbench } from "../.."; import { TextView, ChannelView } from "./AbstractViews"; import { ElementWithContexMenu } from "../ElementWithContextMenu"; @@ -17,13 +17,7 @@ export class OutputView extends TextView { * @param name name of the channel to open */ async selectChannel(name: string): Promise { - if (process.platform === 'darwin') { - await new Workbench().executeCommand('Output: Show Output Channels...'); - const input = await InputBox.create(); - await input.selectQuickPick(name); - } else { - await super.selectChannel(name); - } + await super.selectChannel(name); } } diff --git a/page-objects/src/components/sidebar/debug/DebugView.ts b/page-objects/src/components/sidebar/debug/DebugView.ts index a4305cf8c..58fc7f688 100644 --- a/page-objects/src/components/sidebar/debug/DebugView.ts +++ b/page-objects/src/components/sidebar/debug/DebugView.ts @@ -12,6 +12,9 @@ export class DebugView extends SideBarView { * @returns Promise resolving to the title */ async getLaunchConfiguration(): Promise { + if(DebugView.versionInfo.version >= '1.87.0' && process.platform !== 'darwin') { + throw Error(`The 'DebugView.getLaunchConfiguration' method is broken! Read more information in 'Known Issues > Limitations in testing with VS Code 1.87+' - https://github.com/microsoft/vscode/issues/206897.`); + } const action = await this.getTitlePart().findElement(DebugView.locators.DebugView.launchCombo); const combo = await action.findElement(DebugView.locators.DebugView.launchSelect); return await combo.getAttribute('title'); diff --git a/page-objects/src/locators/locators.ts b/page-objects/src/locators/locators.ts index a03d59643..5f9e72403 100644 --- a/page-objects/src/locators/locators.ts +++ b/page-objects/src/locators/locators.ts @@ -86,6 +86,7 @@ export interface Locators { OutputView: { constructor: By actionsLabel: string + optionByName: (name: string) => By } WebviewView: { iframe: By diff --git a/test/test-project/src/test/bottomBar/views-test.ts b/test/test-project/src/test/bottomBar/views-test.ts index ade3c84ff..3c299683b 100644 --- a/test/test-project/src/test/bottomBar/views-test.ts +++ b/test/test-project/src/test/bottomBar/views-test.ts @@ -37,12 +37,18 @@ describe('Output View/Text Views', function () { }); it('getCurrentChannel returns the selected channel name', async function () { + if(process.platform !== 'darwin' && VSBrowser.instance.version >= '1.87.0') { + this.skip(); + } const channel = await view.getCurrentChannel(); expect(channel).not.empty; }); it('selectChannel works', async function () { this.timeout(10000); + if(process.platform !== 'darwin' && VSBrowser.instance.version >= '1.87.0') { + this.skip(); + } await view.selectChannel('Tasks'); const final = await view.getCurrentChannel(); expect('Tasks').equals(final); diff --git a/test/test-project/src/test/debug/debug-test.ts b/test/test-project/src/test/debug/debug-test.ts index 7850b4840..f5620be51 100644 --- a/test/test-project/src/test/debug/debug-test.ts +++ b/test/test-project/src/test/debug/debug-test.ts @@ -34,6 +34,9 @@ describe('Debugging', function () { describe('Debug View', () => { it('getLaunchConfiguration works', async function () { + if(process.platform !== 'darwin' && VSBrowser.instance.version >= '1.87.0') { + this.skip(); + } const config = await view.getLaunchConfiguration(); expect(config).equals('Test Launch'); }); @@ -45,6 +48,9 @@ describe('Debugging', function () { }); it('selectLaunchConfiguration works', async function () { + if(process.platform !== 'darwin' && VSBrowser.instance.version >= '1.87.0') { + this.skip(); + } await view.selectLaunchConfiguration('Test Launch2'); const config = await view.getLaunchConfiguration(); expect(config).equals('Test Launch2');