Re-enable auto replies tests with retries on Windows only

Fixes #139076
This commit is contained in:
Daniel Imms 2022-01-14 08:56:11 -08:00
parent 6c4b8882ba
commit 0b7bc6d73c

View file

@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { Application, Terminal, SettingsEditor } from '../../../../automation'; import { Application, Terminal, SettingsEditor } from '../../../../automation';
import { itSkipOnFail } from '../../utils';
export function setup() { export function setup() {
describe('Terminal Input', () => { describe('Terminal Input', () => {
@ -18,14 +17,21 @@ export function setup() {
settingsEditor = app.workbench.settingsEditor; settingsEditor = app.workbench.settingsEditor;
}); });
describe('Auto replies', () => { describe('Auto replies', function () {
// HACK: Retry this suite only on Windows because conpty can rarely lead to unexpected behavior which would
// cause flakiness. If this does happen, the feature is expected to fail.
if (process.platform === 'win32') {
this.retries(3);
}
async function writeTextForAutoReply(text: string): Promise<void> { async function writeTextForAutoReply(text: string): Promise<void> {
// Put the matching word in quotes to avoid powershell coloring the first word and // Put the matching word in quotes to avoid powershell coloring the first word and
// on a new line to avoid cursor move/line switching sequences // on a new line to avoid cursor move/line switching sequences
await terminal.runCommandInTerminal(`"\r${text}`, true); await terminal.runCommandInTerminal(`"\r${text}`, true);
} }
itSkipOnFail('should automatically reply to default "Terminate batch job (Y/N)"', async () => { // TODO@daniel https://github.com/microsoft/vscode/issues/139076 it('should automatically reply to default "Terminate batch job (Y/N)"', async () => {
await terminal.createTerminal(); await terminal.createTerminal();
await writeTextForAutoReply('Terminate batch job (Y/N)?'); await writeTextForAutoReply('Terminate batch job (Y/N)?');
await terminal.waitForTerminalText(buffer => buffer.some(line => line.match(/\?.*Y/))); await terminal.waitForTerminalText(buffer => buffer.some(line => line.match(/\?.*Y/)));