Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add function to send graphql request to update testset report #107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
14 changes: 13 additions & 1 deletion keployCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export const Test = async (appCmd: string, runOptions: RunOptions, callback: (er
}
}

await StopUserApplication(appId);
await UpdateReportWithCoverage(testRunId, testSet)

if (status !== TestRunStatus.PASSED) {
result = false;
console.error(`Test set: ${testSet} failed with status: ${status}`);
Expand All @@ -84,7 +87,6 @@ export const Test = async (appCmd: string, runOptions: RunOptions, callback: (er
console.log(`Test set: ${testSet} passed`);
}
testResult = testResult && result;
await StopUserApplication(appId);
}
} catch (error) {
callback(error as Error, false);
Expand Down Expand Up @@ -134,6 +136,16 @@ const RunTestSet = async (testRunId: string, testSet: string, appId: string): Pr
}
};

const UpdateReportWithCoverage = async (testRunId: string, testSet: string): Promise<void> => {
const client = await setHttpClient();
const response = await client.post('', {
query: `mutation UpdateReportWithCov { updateReportWithCov(testRunId: "${testRunId}", testSetId: "${testSet}", language: "typescript")}`
});
if (!(response.status >= 200 && response.status < 300 && response.data.data.runTestSet)) {
throw new Error(`Failed to update report with coverage data. Status code: ${response.status}`);
}
};

const CheckReportFile = async (reportPath: string, timeout: number): Promise<void> => {
const startTime = Date.now();
while (Date.now() - startTime < timeout * 1000) {
Expand Down
Loading