diff options
Diffstat (limited to 'test/automation/src/terminal.ts')
-rw-r--r-- | test/automation/src/terminal.ts | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/test/automation/src/terminal.ts b/test/automation/src/terminal.ts index ec10f841279..cd8f5968dea 100644 --- a/test/automation/src/terminal.ts +++ b/test/automation/src/terminal.ts @@ -9,6 +9,9 @@ import { QuickAccess } from './quickaccess'; export enum Selector { TerminalView = `#terminal`, + CommandDecorationPlaceholder = `.terminal-command-decoration.codicon-circle-outline`, + CommandDecorationSuccess = `.terminal-command-decoration.codicon-primitive-dot`, + CommandDecorationError = `.terminal-command-decoration.codicon-error-small`, Xterm = `#terminal .terminal-wrapper`, XtermEditor = `.editor-instance .terminal-wrapper`, TabsEntry = '.terminal-tabs-entry', @@ -62,6 +65,12 @@ interface TerminalLabel { } type TerminalGroup = TerminalLabel[]; +interface ICommandDecorationCounts { + placeholder: number; + success: number; + error: number; +} + export class Terminal { constructor(private code: Code, private quickaccess: QuickAccess, private quickinput: QuickInput) { } @@ -73,8 +82,8 @@ export class Terminal { await this.code.dispatchKeybinding('enter'); await this.quickinput.waitForQuickInputClosed(); } - if (commandId === TerminalCommandId.Show) { - return await this._waitForTerminal(undefined); + if (commandId === TerminalCommandId.Show || commandId === TerminalCommandId.CreateNewEditor || commandId === TerminalCommandId.CreateNew || commandId === TerminalCommandId.NewWithProfile) { + return await this._waitForTerminal(commandId === TerminalCommandId.CreateNewEditor ? 'editor' : 'panel'); } } @@ -146,6 +155,10 @@ export class Terminal { } } + async assertShellIntegrationActivated(): Promise<void> { + await this.waitForTerminalText(buffer => buffer.some(e => e.includes('Shell integration activated'))); + } + async getTerminalGroups(): Promise<TerminalGroup[]> { const tabCount = (await this.code.waitForElements(Selector.Tabs, true)).length; const groups: TerminalGroup[] = []; @@ -204,6 +217,17 @@ export class Terminal { await this.code.waitForElement(Selector.TerminalView, result => result === undefined); } + async assertCommandDecorations(expectedCounts?: ICommandDecorationCounts, customConfig?: { updatedIcon: string; count: number }): Promise<void> { + if (expectedCounts) { + await this.code.waitForElements(Selector.CommandDecorationPlaceholder, true, decorations => decorations && decorations.length === expectedCounts.placeholder); + await this.code.waitForElements(Selector.CommandDecorationSuccess, true, decorations => decorations && decorations.length === expectedCounts.success); + await this.code.waitForElements(Selector.CommandDecorationError, true, decorations => decorations && decorations.length === expectedCounts.error); + } + if (customConfig) { + await this.code.waitForElements(`.terminal-command-decoration.codicon-${customConfig.updatedIcon}`, true, decorations => decorations && decorations.length === customConfig.count); + } + } + async clickPlusButton(): Promise<void> { await this.code.waitAndClick(Selector.PlusButton); } |