smoke - select tab over quick pick (#139944)

* smoke - further try to reduce usages of quick pick

* poke
This commit is contained in:
Benjamin Pasero 2021-12-30 22:38:59 +01:00 committed by GitHub
parent 30627dc56e
commit 18a7108073
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 13 deletions

View file

@ -94,8 +94,8 @@ async function poll<T>(
acceptFn: (result: T) => boolean,
logger: Logger,
timeoutMessage: string,
retryCount: number = 200,
retryInterval: number = 100 // millis
retryCount = 200,
retryInterval = 100 // millis
): Promise<T> {
let trial = 1;
let lastError: string = '';
@ -174,8 +174,8 @@ export class Code {
}
}
async waitForWindowIds(fn: (windowIds: number[]) => boolean): Promise<void> {
await poll(() => this.driver.getWindowIds(), fn, this.logger, `get window ids`);
async waitForWindowIds(accept: (windowIds: number[]) => boolean): Promise<void> {
await poll(() => this.driver.getWindowIds(), accept, this.logger, `get window ids`);
}
async dispatchKeybinding(keybinding: string): Promise<void> {
@ -262,9 +262,9 @@ export class Code {
await poll(() => this.driver.isActiveElement(windowId, selector), r => r, this.logger, `is active element '${selector}'`, retryCount);
}
async waitForTitle(fn: (title: string) => boolean): Promise<void> {
async waitForTitle(accept: (title: string) => boolean): Promise<void> {
const windowId = await this.getActiveWindowId();
await poll(() => this.driver.getTitle(windowId), fn, this.logger, `get title`);
await poll(() => this.driver.getTitle(windowId), accept, this.logger, `get title`);
}
async waitForTypeInEditor(selector: string, text: string): Promise<void> {
@ -284,12 +284,12 @@ export class Code {
async getLocaleInfo(): Promise<ILocaleInfo> {
const windowId = await this.getActiveWindowId();
return await this.driver.getLocaleInfo(windowId);
return this.driver.getLocaleInfo(windowId);
}
async getLocalizedStrings(): Promise<ILocalizedStrings> {
const windowId = await this.getActiveWindowId();
return await this.driver.getLocalizedStrings(windowId);
return this.driver.getLocalizedStrings(windowId);
}
private async getActiveWindowId(): Promise<number> {

View file

@ -95,7 +95,7 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger
await app.workbench.editors.waitForTab('readme.md', !autoSave);
if (typeof restartDelay === 'number') {
// this is an OK use of a timeout in a smoke test
// this is an OK use of a timeout in a smoke test:
// we want to simulate a user having typed into
// the editor and pausing for a moment before
// terminating
@ -105,10 +105,11 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger
await app.restart();
await app.workbench.editors.waitForTab('readme.md', !autoSave);
await app.workbench.quickaccess.openFile(join(app.workspacePathOrFolder, 'readme.md'));
await app.workbench.editors.waitForTab('Untitled-1', true);
await app.workbench.editors.selectTab('readme.md');
await app.workbench.editor.waitForEditorContents('readme.md', contents => contents.indexOf(textToType) > -1);
await app.workbench.editors.waitForTab('Untitled-1', true);
await app.workbench.editors.selectTab('Untitled-1');
await app.workbench.editor.waitForEditorContents('Untitled-1', contents => contents.indexOf(textToTypeInUntitled) > -1);
@ -230,10 +231,11 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger
await insidersApp.start();
await insidersApp.workbench.editors.waitForTab('readme.md', true);
await insidersApp.workbench.quickaccess.openFile(join(insidersApp.workspacePathOrFolder, 'readme.md'));
await insidersApp.workbench.editors.waitForTab('Untitled-1', true);
await insidersApp.workbench.editors.selectTab('readme.md');
await insidersApp.workbench.editor.waitForEditorContents('readme.md', contents => contents.indexOf(textToType) > -1);
await insidersApp.workbench.editors.waitForTab('Untitled-1', true);
await insidersApp.workbench.editors.selectTab('Untitled-1');
await insidersApp.workbench.editor.waitForEditorContents('Untitled-1', contents => contents.indexOf(textToTypeInUntitled) > -1);