<commit_before>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import { SpectronApplication } from '../../spectron/application';
import { QuickOpen } from '../quickopen/quickopen';

export class CommandPallette extends QuickOpen {

	constructor(spectron: SpectronApplication) {
		super(spectron);
	}

	public async runCommand(commandText: string): Promise<void> {
		await this.spectron.command('workbench.action.showCommands');
		await this.waitForQuickOpenOpened();
		await this.typeCommand(commandText);
		await this.spectron.client.waitForText(`div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties div.monaco-tree-row:nth-child(1) .quick-open-entry a.label-name span.monaco-highlighted-label span.highlight`, commandText);
		await this.spectron.client.waitAndClick(`div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties div.monaco-tree-row:nth-child(1) .quick-open-entry`);
	}

	// Need to retry multiple times due to late context switches might eat up some keys (e.g space)
	private async typeCommand(commandText: string): Promise<void> {
		await this.spectron.client.waitFor(async () => {
			await this.spectron.command('workbench.action.showCommands');
			await this.waitForQuickOpenOpened();
			await this.spectron.client.type(commandText);
			const text = await this.spectron.webclient.getValue('.quick-open-input input');

			if (text === `>${commandText}`) {
				return true;
			}
			await this.spectron.client.clearElement('.quick-open-input input');
			await this.closeQuickOpen();
			return undefined;
		});
	}
}<commit_msg>Revert "smoke: Need to retry multiple times due to late context switches might eat up some keys (e.g space)"<commit_after>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import { SpectronApplication } from '../../spectron/application';
import { QuickOpen } from '../quickopen/quickopen';

export class CommandPallette extends QuickOpen {

	constructor(spectron: SpectronApplication) {
		super(spectron);
	}

	public async runCommand(commandText: string): Promise<void> {
		await this.spectron.command('workbench.action.showCommands');
		await this.waitForQuickOpenOpened();
		await this.spectron.client.type(commandText);
		await this.spectron.client.waitForText(`div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties div.monaco-tree-row:nth-child(1) .quick-open-entry a.label-name span.monaco-highlighted-label span.highlight`, commandText);
		await this.spectron.client.waitAndClick(`div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties div.monaco-tree-row:nth-child(1) .quick-open-entry`);
	}
}
{'fraction_non_alphanumeric': 0.23255813953488372, 'fraction_numerical': 0.001257071024512885, 'mean_word_length': 2.766863905325444, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '669659', 'n_tokens_mistral': 897, 'n_tokens_neox': 871, 'n_words': 195}