Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions vscode/src/test/integration/suite/general/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import * as path from 'path';
import * as vscode from 'vscode';
import * as myExplorer from '../../../../views/projects';
import { CodeAction, commands, extensions, Selection, Uri, window, workspace, TreeItem } from 'vscode';
import { assertWorkspace, awaitClient, dumpJava, findClusters, getFilePaths, openFile, prepareProject, replaceCode } from '../../testutils';
import { addSleepIfWindowsPlatform, assertWorkspace, awaitClient, dumpJava, findClusters, getFilePaths, openFile, prepareProject, replaceCode } from '../../testutils';
import { FORMATTED_POM_XML, SAMPLE_CODE_FORMAT_DOCUMENT, SAMPLE_CODE_SORT_IMPORTS, SAMPLE_CODE_UNUSED_IMPORTS } from '../../constants';
import { extCommands } from '../../../../commands/commands';

Expand Down Expand Up @@ -124,7 +124,7 @@ suite('Extension Test Suite', function () {
test("Sort imports", async () => {
const editor = await openFile(filePaths.sortImports);
await replaceCode(editor, SAMPLE_CODE_SORT_IMPORTS);

await addSleepIfWindowsPlatform();
const isSaved = await editor.document.save();
assert.ok(isSaved, "document cannot be saved");

Expand All @@ -139,7 +139,7 @@ suite('Extension Test Suite', function () {
test("Remove unused imports", async () => {
const editor = await openFile(filePaths.unusedImports);
await replaceCode(editor, SAMPLE_CODE_UNUSED_IMPORTS);

await addSleepIfWindowsPlatform();
const isSaved = await editor.document.save();
assert.ok(isSaved, "document cannot be saved");

Expand Down
8 changes: 8 additions & 0 deletions vscode/src/test/integration/testutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import * as assert from "assert";
import * as fs from "fs";
import * as os from "os";
import { glob } from 'glob';
import * as Mocha from 'mocha';
import * as path from "path";
Expand Down Expand Up @@ -625,4 +626,11 @@ function isLocalizedObj(obj: any, localisableFields: any, id: string, category:
}
}
return localized;
}

export const addSleepIfWindowsPlatform = async (): Promise<void> => {
if (os.type().includes("Windows")) {
const timeoutEnv = parseInt(process.env['oracle_oracleJava_windows_sleep_timeout'] || "30000");
await new Promise<void>(r => setTimeout(() => r(), timeoutEnv));
}
}