fix: disable run collection icon once triggered to avoid multiple collection runs

This commit is contained in:
sanish-bruno
2025-12-10 18:12:04 +05:30
parent 4bb01ca0ac
commit 80b4ab0561
4 changed files with 9 additions and 20 deletions

View File

@@ -310,7 +310,7 @@ export default function RunnerResults({ collection }) {
<div className="flex flex-row gap-2">
<Button
type="submit"
disabled={shouldDisableCollectionRun || (configureMode && selectedRequestItems.length === 0) || isCollectionLoading}
disabled={shouldDisableCollectionRun || (configureMode && selectedRequestItems.length === 0) || isCollectionLoading || runnerInfo.status === 'started'}
onClick={runCollection}
>
{configureMode && selectedRequestItems.length > 0

View File

@@ -1412,6 +1412,14 @@ const registerNetworkIpc = (mainWindow) => {
folder = collection;
}
mainWindow.webContents.send('main:run-folder-event', {
type: 'testrun-started',
isRecursive: recursive,
collectionUid,
folderUid,
cancelTokenUid
});
// Create a map to store HookManagers for this collection/folder run
// Key format: 'collection:<collectionUid>', 'folder:<folderUid>', 'request:<requestUid>'
const hookManagersMap = new Map();
@@ -1463,14 +1471,6 @@ const registerNetworkIpc = (mainWindow) => {
await collectionHookManager.call(HOOK_EVENTS.RUNNER_BEFORE_COLLECTION_RUN, { collection, collectionUid });
}
mainWindow.webContents.send('main:run-folder-event', {
type: 'testrun-started',
isRecursive: recursive,
collectionUid,
folderUid,
cancelTokenUid
});
try {
let folderRequests = [];

View File

@@ -21,11 +21,6 @@ tests {
expect(apiToken).to.equal('mock-token-12345');
});
test("setup should have initialized counters", function() {
const requestCounter = bru.getVar('request-counter');
expect(requestCounter).to.equal('0');
});
test("request should have access to setup vars", function() {
const setupComplete = bru.getVar('setup-complete');
expect(setupComplete).to.equal('true');

View File

@@ -65,10 +65,6 @@ script:hooks {
bru.setEnvVar('api-token', 'mock-token-12345');
bru.setEnvVar('setup-timestamp', Date.now().toString());
// Test: Setup - Initialize counters
bru.setVar('request-counter', '0');
bru.setVar('success-counter', '0');
console.log('[onBeforeCollectionRun] Setup complete - token and counters initialized');
});
@@ -136,8 +132,6 @@ script:hooks {
bru.deleteVar('async-start-time');
bru.deleteVar('setup-token');
bru.deleteVar('setup-complete');
bru.deleteVar('request-counter');
bru.deleteVar('success-counter');
bru.deleteVar('request-count');
bru.deleteVar('success-count');
bru.deleteVar('final-stats');