mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Add some detach/attach tests
This commit is contained in:
@@ -26,7 +26,8 @@ export enum TerminalCommandIdWithValue {
|
||||
ChangeColor = 'workbench.action.terminal.changeColor',
|
||||
ChangeIcon = 'workbench.action.terminal.changeIcon',
|
||||
NewWithProfile = 'workbench.action.terminal.newWithProfile',
|
||||
SelectDefaultProfile = 'workbench.action.terminal.selectDefaultShell'
|
||||
SelectDefaultProfile = 'workbench.action.terminal.selectDefaultShell',
|
||||
AttachToSession = 'workbench.action.terminal.attachToSession',
|
||||
}
|
||||
|
||||
export enum TerminalCommandId {
|
||||
@@ -41,7 +42,8 @@ export enum TerminalCommandId {
|
||||
MoveToPanel = 'workbench.action.terminal.moveToTerminalPanel',
|
||||
MoveToEditor = 'workbench.action.terminal.moveToEditor',
|
||||
NewWithProfile = 'workbench.action.terminal.newWithProfile',
|
||||
SelectDefaultProfile = 'workbench.action.terminal.selectDefaultShell'
|
||||
SelectDefaultProfile = 'workbench.action.terminal.selectDefaultShell',
|
||||
DetachSession = 'workbench.action.terminal.detachSession',
|
||||
}
|
||||
interface TerminalLabel {
|
||||
name?: string,
|
||||
@@ -108,6 +110,27 @@ export class Terminal {
|
||||
}
|
||||
}
|
||||
|
||||
async getTerminalGroups(): Promise<TerminalGroup[]> {
|
||||
const tabCount = (await this.code.waitForElements(Selector.Tabs, true)).length;
|
||||
console.log('tabCount', tabCount);
|
||||
const groups: TerminalGroup[] = [];
|
||||
for (let i = 0; i < tabCount; i++) {
|
||||
const instance = await this.code.waitForElement(`${Selector.Tabs}[data-index="${i}"] ${Selector.TabsEntry}`);
|
||||
console.log('instance', instance);
|
||||
const label: TerminalLabel = {
|
||||
name: instance.textContent.replace(/^[├┌└]\s*/, '')
|
||||
};
|
||||
// It's a new group if the the tab does not start with ├ or └
|
||||
if (instance.textContent.match(/^[├└]/)) {
|
||||
groups[groups.length - 1].push(label);
|
||||
} else {
|
||||
groups.push([label]);
|
||||
}
|
||||
}
|
||||
console.log('groups', groups);
|
||||
return groups;
|
||||
}
|
||||
|
||||
private async assertTabExpected(selector?: string, listIndex?: number, nameRegex?: RegExp, icon?: string, color?: string): Promise<void> {
|
||||
if (listIndex) {
|
||||
if (nameRegex) {
|
||||
@@ -132,6 +155,10 @@ export class Terminal {
|
||||
}
|
||||
}
|
||||
|
||||
async assertTerminalViewHidden(): Promise<void> {
|
||||
await this.code.waitForElement(Selector.TerminalView, result => result === undefined);
|
||||
}
|
||||
|
||||
async clickPlusButton(): Promise<void> {
|
||||
await this.code.waitAndClick(Selector.PlusButton);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user