mirror of
https://github.com/Microsoft/vscode
synced 2024-10-01 08:50:48 +00:00
Clean up, simplify smoke test
This commit is contained in:
parent
ccff5bd116
commit
4b2ed32ec3
|
@ -11,9 +11,8 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
|||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { TerminalCapability } from 'vs/platform/terminal/common/capabilities/capabilities';
|
||||
import { ITerminalLogService, TerminalSettingId } from 'vs/platform/terminal/common/terminal';
|
||||
import { TerminalSettingId } from 'vs/platform/terminal/common/terminal';
|
||||
import { ITerminalContribution, ITerminalInstance, IXtermTerminal } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { TerminalInstance, TerminalInstanceColorProvider } from 'vs/workbench/contrib/terminal/browser/terminalInstance';
|
||||
import { TerminalWidgetManager } from 'vs/workbench/contrib/terminal/browser/widgets/widgetManager';
|
||||
|
@ -42,7 +41,6 @@ export class TerminalStickyScrollContribution extends Disposable implements ITer
|
|||
@IContextKeyService private readonly _contextKeyService: IContextKeyService,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService,
|
||||
@IKeybindingService private readonly _keybindingService: IKeybindingService,
|
||||
@ITerminalLogService private readonly _logService: ILogService,
|
||||
) {
|
||||
super();
|
||||
|
||||
|
@ -91,10 +89,8 @@ export class TerminalStickyScrollContribution extends Disposable implements ITer
|
|||
}
|
||||
|
||||
private _tryEnable(): void {
|
||||
this._logService.info('TESTING: _tryEnable');
|
||||
if (this._shouldBeEnabled()) {
|
||||
const xtermCtorEventually = TerminalInstance.getXtermConstructor(this._keybindingService, this._contextKeyService);
|
||||
this._logService.info('TESTING: _tryEnable - ENABLE!');
|
||||
this._overlay.value = this._instantiationService.createInstance(
|
||||
TerminalStickyScrollOverlay,
|
||||
this._xterm!,
|
||||
|
|
|
@ -13,9 +13,7 @@ import { Event } from 'vs/base/common/event';
|
|||
import { Disposable, MutableDisposable, combinedDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import 'vs/css!./media/stickyScroll';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ICommandDetectionCapability } from 'vs/platform/terminal/common/capabilities/capabilities';
|
||||
import { ITerminalLogService } from 'vs/platform/terminal/common/terminal';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IXtermColorProvider, IXtermTerminal } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { ScrollPosition } from 'vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon';
|
||||
|
@ -54,7 +52,6 @@ export class TerminalStickyScrollOverlay extends Disposable {
|
|||
xtermCtor: Promise<typeof XTermTerminal>,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IThemeService private readonly _themeService: IThemeService,
|
||||
@ITerminalLogService private readonly _logService: ILogService,
|
||||
) {
|
||||
super();
|
||||
|
||||
|
@ -137,8 +134,6 @@ export class TerminalStickyScrollOverlay extends Disposable {
|
|||
|
||||
@throttle(0)
|
||||
private _refresh(): void {
|
||||
this._logService.info('TESTING: _refresh', this._stickyScrollOverlay, this._serializeAddon);
|
||||
this._logService.info('TESTING: _refresh (xterm)', this._xterm.raw.element, this._xterm.raw.element?.parentElement);
|
||||
if (!this._xterm.raw.element?.parentElement || !this._stickyScrollOverlay || !this._serializeAddon) {
|
||||
return;
|
||||
}
|
||||
|
@ -150,7 +145,6 @@ export class TerminalStickyScrollOverlay extends Disposable {
|
|||
|
||||
// Sticky scroll only works with non-partial commands
|
||||
if (!command || !('marker' in command)) {
|
||||
this._logService.info('TESTING: _refresh - false 1');
|
||||
this._setVisible(false);
|
||||
return;
|
||||
}
|
||||
|
@ -164,7 +158,6 @@ export class TerminalStickyScrollOverlay extends Disposable {
|
|||
// Hide sticky scroll if it's on the same line
|
||||
marker.line === this._xterm.raw.buffer.active.viewportY
|
||||
) {
|
||||
this._logService.info('TESTING: _refresh - false 2');
|
||||
this._setVisible(false);
|
||||
return;
|
||||
}
|
||||
|
@ -190,10 +183,8 @@ export class TerminalStickyScrollOverlay extends Disposable {
|
|||
|
||||
if (content && command.exitCode !== undefined) {
|
||||
this._currentStickyMarker = marker;
|
||||
this._logService.info('TESTING: _refresh - true');
|
||||
this._setVisible(true);
|
||||
} else {
|
||||
this._logService.info('TESTING: _refresh - false 3');
|
||||
this._setVisible(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application, Terminal, SettingsEditor, TerminalCommandIdWithValue } from '../../../../automation';
|
||||
import { timeout } from '../../utils';
|
||||
import { setTerminalTestSettings } from './terminal-helpers';
|
||||
|
||||
export function setup() {
|
||||
|
@ -42,25 +41,21 @@ export function setup() {
|
|||
// A polling approach is used to avoid test flakiness. While it's not ideal that this
|
||||
// occurs, the main purpose of the tests is to verify sticky scroll shows and updates,
|
||||
// not edge case race conditions on terminal start up
|
||||
async function pollForCommandAndOutput(command: string, exitCode: number): Promise<void> {
|
||||
async function checkCommandAndOutput(command: string, exitCode: number): Promise<void> {
|
||||
const data = generateCommandAndOutput(command, exitCode);
|
||||
let element;
|
||||
for (let i = 0; i < 10; i++) {
|
||||
await terminal.runCommandWithValue(TerminalCommandIdWithValue.WriteDataToTerminal, data);
|
||||
element = await app.code.getElement('.terminal-sticky-scroll .xterm-rows');
|
||||
if (element && element.textContent.indexOf(`Prompt> ${command}`) >= 0) {
|
||||
return;
|
||||
}
|
||||
await timeout(1000);
|
||||
await terminal.runCommandWithValue(TerminalCommandIdWithValue.WriteDataToTerminal, data);
|
||||
const element = await app.code.getElement('.terminal-sticky-scroll .xterm-rows');
|
||||
if (element && element.textContent.indexOf(`Prompt> ${command}`) >= 0) {
|
||||
return;
|
||||
}
|
||||
throw new Error(`Polling failed for command ${command}, exitcode ${exitCode}, text content ${element?.textContent}`);
|
||||
throw new Error(`Failed for command ${command}, exitcode ${exitCode}, text content ${element?.textContent}`);
|
||||
}
|
||||
|
||||
// Write prompt, fill viewport, finish command, print new prompt, verify sticky scroll
|
||||
await pollForCommandAndOutput('sticky scroll 1', 0);
|
||||
await checkCommandAndOutput('sticky scroll 1', 0);
|
||||
|
||||
// And again with a failed command
|
||||
await pollForCommandAndOutput('sticky scroll 2', 1);
|
||||
await checkCommandAndOutput('sticky scroll 2', 1);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue