Skip to content
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to the "vectorcastTestExplorer" extension will be documented in this file.

## [1.0.21] - 2025-10-02

### Added
- Enabled creation of a new environment in a freshly created project.

## [1.0.20] - 2025-08-25

### Bug Fixes
Expand Down Expand Up @@ -115,7 +120,7 @@ All notable changes to the "vectorcastTestExplorer" extension will be documented
## [1.0.8] - 2023-11-15
- Added new right click menu choices for .vce (open environment) and .env (build environment) files #30
- Added new right click menu choice for test explorer tree to allow you to insert Basis Path and ATG tests #31
- Added Generate ATG and Generate Basis Path choices to the "flask+" icons in the text editor
- Added Generate ATG and Generate Basis Path choices to the "flask+" icons in the text editor
- Added support for TEST.REQUIREMENT_KEY syntax, including a hover-over that displays the requirement text #34
- Improved the 'open settings' feature to default to the 'Workspace' tab

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vectorcasttestexplorer",
"displayName": "VectorCAST Test Explorer",
"description": "VectorCAST Test Explorer for VS Code",
"version": "1.0.20",
"version": "1.0.21",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
9 changes: 9 additions & 0 deletions src/vcastUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,15 @@ export function checkIfAnyProjectsAreOpened() {
return true;
}
}

// In case we have empty projects without envs in it
if (
typeof globalProjectDataCache !== "undefined" &&
globalProjectDataCache.size > 0
) {
return true;
}

return false;
}

Expand Down
158 changes: 115 additions & 43 deletions tests/internal/e2e/test/specs/vcast_manage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,49 +128,6 @@ describe("vTypeCheck VS Code Extension", () => {
expect(compilerNode).toBeDefined();
});

it("testing creating new project", async () => {
await updateTestID();
await bottomBar.toggle(true);
const outputView = await bottomBar.openOutputView();
await outputView.clearText();

const notificationsCenter = await workbench.openNotificationsCenter();
await notificationsCenter.clearAllNotifications();

console.log("Executing Create New Project Command:");
await browser.executeWorkbench((vscode) => {
vscode.commands.executeCommand("vectorcastTestExplorer.createNewProject");
});

console.log("Inserting Data to Webview");
// For the compiler tab we need to do it that way, because it's input is not found
// The different strucutre (autocompletion) + we already clicked on the same webview
// make the problems, so we just navigate with tab and enter within the webview
await insertStringToInput("NewProject", "Project Name Input");
await browser.keys(["Tab"]);
await browser.keys("GNU Native_Automatic_C++17");
await browser.keys(["Tab"]);
await browser.keys(["Tab"]);
await browser.keys(["Enter"]);

await browser.waitUntil(
async () =>
(await outputView.getText())
.toString()
.includes(`Added Compiler CCAST_.CFG to Project NewProject`),
{ timeout: TIMEOUT }
);

console.log("Checking existence of new Project");
const projectNode = await findTreeNodeAtLevel(0, "NewProject.vcm");
const compilerNode = await findTreeNodeAtLevel(
1,
"GNU_Native_Automatic_C++17"
);
expect(projectNode).toBeDefined();
expect(compilerNode).toBeDefined();
});

it("testing tree structure", async () => {
await updateTestID();

Expand Down Expand Up @@ -912,4 +869,119 @@ describe("vTypeCheck VS Code Extension", () => {
{ timeout: TIMEOUT }
);
});

it("testing creating new project", async () => {
await updateTestID();
await bottomBar.toggle(true);
const outputView = await bottomBar.openOutputView();
await outputView.clearText();

const notificationsCenter = await workbench.openNotificationsCenter();
await notificationsCenter.clearAllNotifications();

console.log("Executing Create New Project Command:");
await browser.pause(3000);
await browser.executeWorkbench((vscode) => {
vscode.commands.executeCommand("vectorcastTestExplorer.createNewProject");
});

console.log("Inserting Data to Webview");
// For the compiler tab we need to do it that way, because it's input is not found
// The different strucutre (autocompletion) + we already clicked on the same webview
// make the problems, so we just navigate with tab and enter within the webview
await insertStringToInput("ANewProject", "Project Name Input");
await browser.keys(["Tab"]);
await browser.keys("GNU Native_Automatic_C++17");
await browser.keys(["Tab"]);
await browser.keys(["Tab"]);
await browser.keys(["Enter"]);

await browser.waitUntil(
async () =>
(await outputView.getText())
.toString()
.includes(`Added Compiler CCAST_.CFG to Project ANewProject`),
{ timeout: TIMEOUT }
);

console.log("Checking existence of new Project");
const projectNode = await findTreeNodeAtLevel(0, "ANewProject.vcm");
const compilerNode = await findTreeNodeAtLevel(
1,
"GNU_Native_Automatic_C++17"
);
expect(projectNode).toBeDefined();
expect(compilerNode).toBeDefined();
});

it("testing creating new environment in new project", async () => {
await updateTestID();
await bottomBar.toggle(true);
const outputView = await bottomBar.openOutputView();
await outputView.clearText();

const notificationsCenter = await workbench.openNotificationsCenter();
await notificationsCenter.clearAllNotifications();

console.log("Create new ENV in Project");
const activityBar = workbench.getActivityBar();
const explorerView = await activityBar.getViewControl("Explorer");
await explorerView?.openView();

const workspaceFolderSection =
await expandWorkspaceFolderSectionInExplorer("vcastTutorial");

// const cppFolder = workspaceFolderSection.findItem("tutorial");
// await (await cppFolder).select();

const managerCpp = await workspaceFolderSection.findItem("manager.cpp");
await executeCtrlClickOn(managerCpp);
await releaseCtrl();

await managerCpp.openContextMenu();
await (await $("aria/Create VectorCAST Environment in Project")).click();

// Wait for webview to appear
let webviews = await workbench.getAllWebviews();
expect(webviews).toHaveLength(1);
let webview = webviews[0];
await webview.open();

// -----------------------------
// Select the correct project
// -----------------------------
const projectDropdown = await $("aria/Project Path");
await projectDropdown.waitForDisplayed({ timeout: TIMEOUT });
await projectDropdown.click(); // Open dropdown
await browser.keys(["ArrowDown"]); // Navigate to desired project
await browser.keys(["Enter"]); // Select it

// -----------------------------
// Click OK to create the environment
// -----------------------------
const okButton = await $("aria/Import OK");
await okButton.waitForDisplayed({ timeout: TIMEOUT });
await okButton.click();

console.log("Checking Logs");
await browser.waitUntil(
async () =>
(await outputView.getText())
.toString()
.includes("--force --migrate' returned exit code: 0"),
{ timeout: TIMEOUT }
);

await browser.waitUntil(
async () =>
(await outputView.getText()).toString().includes("ANewProject.vcm"),
{ timeout: TIMEOUT }
);
await browser.pause(3000);

// Should now find the env in the project
await getViewContent("Testing");
const envNode = await findTreeNodeAtLevel(3, "MANAGER");
expect(envNode).toBeDefined();
});
});
Loading