@@ -115,6 +158,20 @@ export default function RunnerResults({collection}) {
);
})}
+
+ {runnerInfo.status === 'ended' ? (
+
+
+
+
+
+ ) : null}
{selectedItem ? (
diff --git a/packages/bruno-app/src/globalStyles.js b/packages/bruno-app/src/globalStyles.js
index 687db8c1..7cf517bd 100644
--- a/packages/bruno-app/src/globalStyles.js
+++ b/packages/bruno-app/src/globalStyles.js
@@ -43,7 +43,11 @@ const GlobalStyle = createGlobalStyle`
.btn-close {
color: ${(props) => props.theme.button.close.color};
background: ${(props) => props.theme.button.close.bg};
- border: solid 1px ${(props) => props.theme.button.close.border};;
+ border: solid 1px ${(props) => props.theme.button.close.border};
+
+ &.btn-border {
+ border: solid 1px #696969;
+ }
&:hover,
&:focus {
diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js
index b01dfc02..fc132bb1 100644
--- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js
+++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js
@@ -888,10 +888,8 @@ export const collectionsSlice = createSlice({
const { collectionUid } = action.payload;
const collection = findCollectionByUid(state.collections, collectionUid);
- console.log('here');
if (collection) {
- console.log('here2');
- collection.showRunner = !collection.showRunner;
+ collection.showRunner = !collection.showRunner;
}
},
showRunnerView: (state, action) => {
@@ -919,14 +917,30 @@ export const collectionsSlice = createSlice({
}
},
runFolderEvent: (state, action) => {
- const { collectionUid, folderUid, itemUid, type, error } = action.payload;
+ const { collectionUid, folderUid, itemUid, type, isRecursive, error } = action.payload;
const collection = findCollectionByUid(state.collections, collectionUid);
if (collection) {
const folder = findItemInCollection(collection, folderUid);
const request = findItemInCollection(collection, itemUid);
- collection.runnerResult = collection.runnerResult || {items: []};
+ collection.runnerResult = collection.runnerResult || {info: {}, items: []};
+
+ // todo
+ // get startedAt and endedAt from the runner and display it in the UI
+ if(type === 'testrun-started') {
+ const info = collection.runnerResult.info;
+ info.collectionUid = collectionUid;
+ info.folderUid = folderUid;
+ info.isRecursive = isRecursive;
+ info.status = 'started';
+ }
+
+ if(type === 'testrun-ended') {
+ const info = collection.runnerResult.info;
+ info.status = 'ended';
+ }
+
if(type === 'request-queued') {
collection.runnerResult.items.push({
@@ -959,6 +973,15 @@ export const collectionsSlice = createSlice({
item.status = "error";
}
}
+ },
+ closeCollectionRunner: (state, action) => {
+ const { collectionUid } = action.payload;
+ const collection = findCollectionByUid(state.collections, collectionUid);
+
+ if (collection) {
+ collection.runnerResult = null;
+ collection.showRunner = false;
+ }
}
}
});
@@ -1017,7 +1040,8 @@ export const {
showRunnerView,
hideRunnerView,
resetRunResults,
- runFolderEvent
+ runFolderEvent,
+ closeCollectionRunner
} = collectionsSlice.actions;
export default collectionsSlice.reducer;
diff --git a/packages/bruno-app/src/utils/collections/index.js b/packages/bruno-app/src/utils/collections/index.js
index 5b2e2357..6c9f066a 100644
--- a/packages/bruno-app/src/utils/collections/index.js
+++ b/packages/bruno-app/src/utils/collections/index.js
@@ -518,6 +518,19 @@ export const getEnvironmentVariables = (collection) => {
return variables;
}
+export const getTotalRequestCountInCollection = (collection) => {
+ let count = 0;
+ each(collection.items, (item) => {
+ if (isItemARequest(item)) {
+ count++;
+ } else if (isItemAFolder(item)) {
+ count += getTotalRequestCountInCollection(item);
+ }
+ });
+
+ return count;
+};
+
export const getAllVariables = (collection) => {
const environmentVariables = getEnvironmentVariables(collection);
diff --git a/packages/bruno-electron/src/ipc/network/index.js b/packages/bruno-electron/src/ipc/network/index.js
index ee3e2005..3f7695cf 100644
--- a/packages/bruno-electron/src/ipc/network/index.js
+++ b/packages/bruno-electron/src/ipc/network/index.js
@@ -229,6 +229,13 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => {
folder = collection;
}
+ mainWindow.webContents.send('main:run-folder-event', {
+ type: 'testrun-started',
+ isRecursive: recursive,
+ collectionUid,
+ folderUid
+ });
+
try {
const envVars = getEnvVars(environment);
let folderRequests = [];
@@ -374,6 +381,12 @@ const registerNetworkIpc = (mainWindow, watcher, lastOpenedCollections) => {
});
}
}
+
+ mainWindow.webContents.send('main:run-folder-event', {
+ type: 'testrun-ended',
+ collectionUid,
+ folderUid
+ });
} catch (error) {
mainWindow.webContents.send('main:run-folder-event', {
type: 'error',