Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Closes:#8 Added Support for TestCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
SkySingh04 committed Mar 6, 2024
1 parent dbeb124 commit abf54cc
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 14 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Keploy-VsCode offers the following features:

## Release Notes

### 2.0.0
- Added support for Keploy Test Command

### 1.2.2
- Added support for installing Keploy
- Better UI Updates
Expand Down
22 changes: 17 additions & 5 deletions out/Test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion out/Test.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "heykeploy",
"displayName": "Keploy-VScode",
"displayName": "Keploy",
"description": "Hello Keploy Community!",
"version": "1.2.7",
"version": "2.0.0",
"publisher": "Akash-Singh04",
"icon": "media/logo.png",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions scripts/keploy_test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ touch "$log_file_path"
chmod 666 "$log_file_path"

# Execute the keploy record command, redirecting output to the log file
# /usr/local/bin/keploybin test -c "$command" "$filepath" | tee -a "$log_file_path"
/usr/local/bin/keploybin test -c "/home/akash/Desktop/samples-go/gin-mongo/test-app-url-shortener" | tee -a "$log_file_path"
/usr/local/bin/keploybin test -c "$command" "$filepath" | tee -a "$log_file_path"
# /usr/local/bin/keploybin test -c "/home/akash/Desktop/samples-go/gin-mongo/test-app-url-shortener" | tee -a "$log_file_path"

6 changes: 6 additions & 0 deletions sidebar/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ button{
grid-template-columns: 1fr 1fr;
grid-gap : 5px;
}
#testbuttons{
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap : 5px;

}
#stopRecordingButton{
display: none;
}
Expand Down
2 changes: 1 addition & 1 deletion sidebar/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ window.addEventListener('message', event => {
else if(message.type === "testResults"){
console.log("message.value", message.value);
console.log("message.textSummary", message.textSummary);
const testCaseElement = document.createElement('p');
const testCaseElement = document.createElement('pre');
testCaseElement.textContent = message.textSummary;
testResultsDiv.appendChild(testCaseElement); // Append the testCaseElement itself instead of its text content
}
Expand Down
19 changes: 16 additions & 3 deletions src/Test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export async function displayTestCases(logfilePath: string, webview: any): Promi

// Extract the desired part
const testSummary = logLines.slice(startIndex, endIndex + 1).join('\n');
console.log(testSummary);
// Display the captured test cases in your frontend
if (testSummary.length === 0) {
webview.postMessage({
Expand All @@ -44,11 +43,25 @@ export async function displayTestCases(logfilePath: string, webview: any): Promi
});
return;
}
webview.postMessage({
//remove ansi escape codes
const ansiRegex = /[\u001B\u009B][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
const cleanSummary = testSummary.replace(ansiRegex, '');
console.log(cleanSummary);
const testSummaryList = cleanSummary.split('\n');
console.log(testSummaryList);
testSummaryList.forEach((line, index) => {
webview.postMessage({
type: 'testResults',
value: 'Test Summary Generated',
textSummary: testSummary
textSummary: line
});
});

// webview.postMessage({
// type: 'testResults',
// value: 'Test Summary Generated',
// textSummary: cleanSummary
// });
// recordedTestCasesDiv.appendChild(testCaseElement);
}
catch (error) {
Expand Down

0 comments on commit abf54cc

Please sign in to comment.