Skip to content

Commit 347194c

Browse files
committed
Removed unused codepath (DH-18428-2)
1 parent c8c1457 commit 347194c

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

e2e-testing/src/pageObjects/EditorViewExtended.ts

+10-18
Original file line numberDiff line numberDiff line change
@@ -160,35 +160,27 @@ export class EditorViewExtended extends EditorView {
160160
}
161161

162162
/**
163-
* Get the WebView tab for a given tab group and title. If the tab is not
164-
* currently active, it will be selected unless `throwIfTitleNotAlreadyActive`
165-
* is set to true, in which case it will throw an error.
163+
* Switch to a TextEditor tab with the given title + optional group index.
164+
* Throws if a matching Editor is found that isn't associated with a WebView.
166165
* @param groupIndex zero based index for the editor group
167166
* @param title title of the tab
168-
* @param throwIfTitleNotAlreadyActive if true, throw if the tab is not already active
169167
* @returns Promise resolving to `WebViewExtended` object
170168
*/
171169
async openWebView(
172-
groupIndex: number,
173170
title: string,
174-
throwIfTitleNotAlreadyActive = false
171+
groupIndex?: number
175172
): Promise<WebViewExtended> {
176-
const group = await this.getEditorGroup(groupIndex);
173+
const group = await this.getEditorGroup(groupIndex ?? 0);
177174

178-
const activeTab = await group.getActiveTab();
179-
const activeTitle = activeTab && (await activeTab?.getTitle());
180-
const isTitleAlreadyActive = activeTitle === title;
175+
const tab = await group.getTabByTitle(title);
176+
const resourceName = await tab.getAttribute('data-resource-name');
177+
const isWebView = resourceName.startsWith('webview-');
181178

182-
if (throwIfTitleNotAlreadyActive && !isTitleAlreadyActive) {
183-
throw new Error(
184-
`Expected tab title to be "${title}", but was "${activeTitle}"`
185-
);
179+
if (!isWebView) {
180+
throw new Error('Tab is not associated with a WebView');
186181
}
187182

188-
if (!isTitleAlreadyActive) {
189-
const tab = await group.getTabByTitle(title);
190-
await tab.select();
191-
}
183+
await tab.select();
192184

193185
return new WebViewExtended(group).wait();
194186
}

e2e-testing/src/specs/panels.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe('Panels Tests', () => {
8989
});
9090

9191
await step(3, 'Switch to another tab', async stepLabel => {
92-
await editorView.openWebView(2, 't1');
92+
await editorView.openWebView('t1', 2);
9393
const editorGroupsData = await editorView.getEditorGroupsData();
9494
assert.deepEqual(
9595
editorGroupsData,
@@ -117,7 +117,7 @@ describe('Panels Tests', () => {
117117
});
118118

119119
await step(4, 'Switch back to initial tab', async stepLabel => {
120-
await editorView.openWebView(2, 't3');
120+
await editorView.openWebView('t3', 2);
121121
const editorGroupsData = await editorView.getEditorGroupsData();
122122
assert.deepEqual(
123123
editorGroupsData,
@@ -203,7 +203,7 @@ describe('Panels Tests', () => {
203203
);
204204

205205
await step(8, 'Move tab to new group', async stepLabel => {
206-
await editorView.openWebView(2, 't3');
206+
await editorView.openWebView('t3', 2);
207207

208208
await new Workbench().executeCommand('View: Move Editor into Next Group');
209209

0 commit comments

Comments
 (0)