Skip to content

Commit

Permalink
deleting reports before tests starts
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshwinThomasIBM authored and JoshwinThomasIBM committed Jan 24, 2025
1 parent 06b2568 commit 6c8c117
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
25 changes: 23 additions & 2 deletions src/test/MavenTestDevModeActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ it('Open dasboard shows items - Maven', async () => {
item = await section.findItem(constants.MAVEN_PROJECT) as DefaultTreeItem;
expect(item).not.undefined;
utils.clearMavenPluginCache(); // clearing the cache so initially it uses the latest verison of the plugins and initiate the testing
utils.deleteReportsFiles();//deleting the report files if they exist

}).timeout(275000);


Expand Down Expand Up @@ -241,6 +241,27 @@ it('check all test reports exists', async () => {
expect(existenceResults.every(result => result === true)).to.be.true;
}).timeout(10000);

it('View Unit test report for maven project surefire 3.4.0', async () => {

await utils.deleteReports(path.join(utils.getMvnProjectPath(), "target", "reports", "failsafe.html"));
await utils.deleteReports(path.join(utils.getMvnProjectPath(), "target", "reports", "surefire.html"));

await utils.launchDashboardAction(item,constants.UTR_DASHABOARD_ACTION, constants.UTR_DASHABOARD_MAC_ACTION);
tabs = await new EditorView().getOpenEditorTitles();
//expect (tabs[1], "Unit test report not found").to.equal(constants.SUREFIRE_REPORT_TITLE);
expect (tabs.indexOf(constants.SUREFIRE_REPORT_TITLE)>-1, "Unit test report not found").to.equal(true);

}).timeout(10000);

it('View Integration test report for maven project surefire 3.4.0', async () => {

await utils.launchDashboardAction(item, constants.ITR_DASHBOARD_ACTION, constants.ITR_DASHBOARD_MAC_ACTION);
tabs = await new EditorView().getOpenEditorTitles();
//expect (tabs[2], "Integration test report not found").to.equal(constants.FAILSAFE_REPORT_TITLE);
expect (tabs.indexOf(constants.FAILSAFE_REPORT_TITLE)>-1, "Integration test report not found").to.equal(true);

}).timeout(10000);

it('attach debugger for start with custom parameter event', async () => {
console.log("start attach debugger");
let isServerRunning: Boolean = true;
Expand Down
16 changes: 15 additions & 1 deletion src/test/utils/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,18 @@ export async function revertPomFile() {
}
});
}


//function to delete the report files in the possible directories
export async function deleteReportsFiles() {
const reportPaths = [
path.join(getMvnProjectPath(), "target", "reports", "failsafe.html"),
path.join(getMvnProjectPath(), "target", "reports", "surefire.html"),
path.join(getMvnProjectPath(), "target", "site", "surefire-report.html"),
path.join(getMvnProjectPath(), "target", "site", "failsafe-report.html")
];
await Promise.all(
reportPaths.map(async (reportPath) => {
await deleteReports(reportPath);
})
);
}

0 comments on commit 6c8c117

Please sign in to comment.