<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';

export function setup() {
	describe('Search', () => {
		before(function () {
			this.app.suiteName = 'Search';
		});

		it('searches for body & checks for correct result number', async function () {
			const app = this.app as SpectronApplication;
			await app.workbench.search.openSearchViewlet();
			await app.workbench.search.searchFor('body');

			await app.workbench.search.waitForResultText('14 results in 5 files');
		});

		it('searches only for *.js files & checks for correct result number', async function () {
			const app = this.app as SpectronApplication;
			await app.workbench.search.openSearchViewlet();
			await app.workbench.search.searchFor('body');
			await app.workbench.search.showQueryDetails();
			await app.workbench.search.setFilesToIncludeText('*.js');
			await app.workbench.search.submitSearch();

			await app.workbench.search.waitForResultText('4 results in 1 file');
			await app.workbench.search.setFilesToIncludeText('');
			await app.workbench.search.hideQueryDetails();
		});

		it('dismisses result & checks for correct result number', async function () {
			const app = this.app as SpectronApplication;
			await app.workbench.search.openSearchViewlet();
			await app.workbench.search.searchFor('body');
			await app.workbench.search.removeFileMatch(1);
			await app.workbench.search.waitForResultText('10 results in 4 files');
		});

		it('replaces first search result with a replace term', async function () {
			const app = this.app as SpectronApplication;

			await app.workbench.search.openSearchViewlet();
			await app.workbench.search.searchFor('body');
			await app.workbench.search.expandReplace();
			await app.workbench.search.setReplaceText('ydob');
			await app.workbench.search.replaceFileMatch(1);
			await app.workbench.saveOpenedFile();

			await app.workbench.search.waitForResultText('10 results in 4 files');

			await app.workbench.search.searchFor('ydob');
			await app.workbench.search.setReplaceText('body');
			await app.workbench.search.replaceFileMatch(1);
			await app.workbench.saveOpenedFile();
		});
	});
}<commit_msg>Fix #44923 smoke test, save happens automatically after replace. See #46983<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';

export function setup() {
	describe('Search', () => {
		before(function () {
			this.app.suiteName = 'Search';
		});

		it('searches for body & checks for correct result number', async function () {
			const app = this.app as SpectronApplication;
			await app.workbench.search.openSearchViewlet();
			await app.workbench.search.searchFor('body');

			await app.workbench.search.waitForResultText('14 results in 5 files');
		});

		it('searches only for *.js files & checks for correct result number', async function () {
			const app = this.app as SpectronApplication;
			await app.workbench.search.openSearchViewlet();
			await app.workbench.search.searchFor('body');
			await app.workbench.search.showQueryDetails();
			await app.workbench.search.setFilesToIncludeText('*.js');
			await app.workbench.search.submitSearch();

			await app.workbench.search.waitForResultText('4 results in 1 file');
			await app.workbench.search.setFilesToIncludeText('');
			await app.workbench.search.hideQueryDetails();
		});

		it('dismisses result & checks for correct result number', async function () {
			const app = this.app as SpectronApplication;
			await app.workbench.search.openSearchViewlet();
			await app.workbench.search.searchFor('body');
			await app.workbench.search.removeFileMatch(1);
			await app.workbench.search.waitForResultText('10 results in 4 files');
		});

		it('replaces first search result with a replace term', async function () {
			const app = this.app as SpectronApplication;

			await app.workbench.search.openSearchViewlet();
			await app.workbench.search.searchFor('body');
			await app.workbench.search.expandReplace();
			await app.workbench.search.setReplaceText('ydob');
			await app.workbench.search.replaceFileMatch(1);

			await app.workbench.search.waitForResultText('10 results in 4 files');

			await app.workbench.search.searchFor('ydob');
			await app.workbench.search.setReplaceText('body');
			await app.workbench.search.replaceFileMatch(1);
		});
	});
}
{'fraction_non_alphanumeric': 0.19076065312624452, 'fraction_numerical': 0.007566706491437674, 'mean_word_length': 3.1307565789473686, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2262110', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1377, 'n_words': 330}