diff --git a/test/integration-tests/testexplorer/TestExplorerIntegration.test.ts b/test/integration-tests/testexplorer/TestExplorerIntegration.test.ts index f963e84d..cd86355c 100644 --- a/test/integration-tests/testexplorer/TestExplorerIntegration.test.ts +++ b/test/integration-tests/testexplorer/TestExplorerIntegration.test.ts @@ -15,7 +15,6 @@ import * as assert from "assert"; import * as vscode from "vscode"; import { beforeEach, afterEach } from "mocha"; -import { testAssetUri } from "../../fixtures"; import { TestExplorer } from "../../../src/TestExplorer/TestExplorer"; import { assertContains, @@ -39,7 +38,11 @@ import { reduceTestItemChildren, } from "../../../src/TestExplorer/TestUtils"; import { runnableTag } from "../../../src/TestExplorer/TestDiscovery"; -import { activateExtensionForSuite, updateSettings } from "../utilities/testutilities"; +import { + activateExtensionForSuite, + folderInRootWorkspace, + updateSettings, +} from "../utilities/testutilities"; import { Commands } from "../../../src/commands"; import { SwiftToolchain } from "../../../src/toolchain/toolchain"; @@ -54,10 +57,7 @@ suite("Test Explorer Suite", function () { activateExtensionForSuite({ async setup(ctx) { workspaceContext = ctx; - const packageFolder = testAssetUri("defaultPackage"); - const targetFolder = workspaceContext.folders.find( - folder => folder.folder.path === packageFolder.path - ); + const targetFolder = await folderInRootWorkspace("defaultPackage", workspaceContext); if (!targetFolder) { throw new Error("Unable to find test explorer"); diff --git a/test/integration-tests/testexplorer/utilities.ts b/test/integration-tests/testexplorer/utilities.ts index af64c673..20662258 100644 --- a/test/integration-tests/testexplorer/utilities.ts +++ b/test/integration-tests/testexplorer/utilities.ts @@ -164,7 +164,7 @@ export function assertTestResults( ); } -function syncPromise(callback: () => void): Promise { +export function syncPromise(callback: () => void): Promise { return new Promise(resolve => { callback(); resolve(); @@ -188,14 +188,11 @@ export function eventPromise(event: vscode.Event): Promise { export async function waitForTestExplorerReady( testExplorer: TestExplorer ): Promise { - return ( - await Promise.all([ - testExplorer.controller.items.size === 0 - ? eventPromise(testExplorer.onTestItemsDidChange) - : Promise.resolve(testExplorer.controller), - syncPromise(() => vscode.commands.executeCommand("workbench.view.testing.focus")), - ]) - )[0]; + await vscode.commands.executeCommand("workbench.view.testing.focus"); + const controller = await (testExplorer.controller.items.size === 0 + ? eventPromise(testExplorer.onTestItemsDidChange) + : Promise.resolve(testExplorer.controller)); + return controller; } /**