diff --git a/packages/bruno-app/src/components/RequestPane/Settings/index.js b/packages/bruno-app/src/components/RequestPane/Settings/index.js index 2f5c7306d..9a3340b6d 100644 --- a/packages/bruno-app/src/components/RequestPane/Settings/index.js +++ b/packages/bruno-app/src/components/RequestPane/Settings/index.js @@ -68,12 +68,12 @@ const Settings = ({ item, collection }) => { const handleTimeoutDropdownSelect = useCallback((option) => { if (option === 'inherit') { - onTimeoutChange({ target: { value: 'inherit' } }); + updateSetting({ timeout: 'inherit' }); } else if (option === 'custom') { // Switch to custom value - start with 0 - onTimeoutChange({ target: { value: 0 } }); + updateSetting({ timeout: 0 }); } - }, [onTimeoutChange]); + }, [updateSetting]); // Keyboard shortcut handlers const onSave = useCallback(() => { @@ -148,7 +148,7 @@ const Settings = ({ item, collection }) => { isInherited={isTimeoutInherited} onDropdownSelect={handleTimeoutDropdownSelect} onValueChange={(e) => !isTimeoutInherited && onTimeoutChange(e)} - onCustomValueReset={() => onTimeoutChange({ target: { value: 'inherit' } })} + onCustomValueReset={() => updateSetting({ timeout: 'inherit' })} /> diff --git a/tests/request/settings/max-redirects.spec.ts b/tests/request/settings/max-redirects.spec.ts index 22de00ad4..1b6b856c7 100644 --- a/tests/request/settings/max-redirects.spec.ts +++ b/tests/request/settings/max-redirects.spec.ts @@ -36,10 +36,8 @@ test.describe('Max Redirects Settings Tests', () => { await maxRedirectsInput.fill('2'); await page.getByTestId('send-arrow-icon').click(); await expect(page.getByTestId('response-status-code')).toContainText('200', { timeout: 15000 }); - }); - test.afterEach(async ({ pageWithUserData: page }) => { - // Close the single open tab + // Close without saving to avoid modifying the .bru file await page.locator('.close-icon-container').click(); await page.locator('button:has-text("Don\'t Save")').first().click(); }); diff --git a/tests/request/settings/no-redirects.spec.ts b/tests/request/settings/no-redirects.spec.ts index c9e6d828f..eb3792f40 100644 --- a/tests/request/settings/no-redirects.spec.ts +++ b/tests/request/settings/no-redirects.spec.ts @@ -40,10 +40,8 @@ test.describe('No Redirects Settings Tests', () => { // Send request again - now should follow redirects and get 200 await page.getByTestId('send-arrow-icon').click(); await expect(page.getByTestId('response-status-code')).toContainText('200', { timeout: 15000 }); - }); - test.afterEach(async ({ pageWithUserData: page }) => { - // Close the single open tab + // Close without saving to avoid modifying the .bru file await page.locator('.close-icon-container').click(); await page.locator('button:has-text("Don\'t Save")').first().click(); }); diff --git a/tests/request/settings/timeout.spec.ts b/tests/request/settings/timeout.spec.ts index 8c54d2d2d..b71871216 100644 --- a/tests/request/settings/timeout.spec.ts +++ b/tests/request/settings/timeout.spec.ts @@ -15,7 +15,7 @@ test.describe('Timeout Settings Tests', () => { // Go to Settings tab await page.getByRole('tab', { name: 'Settings' }).click(); - // Test Timeout Settings + // Test Timeout Settings with custom value const timeoutInput = page.locator('input[id="timeout"]'); await expect(timeoutInput).toBeVisible(); @@ -27,8 +27,26 @@ test.describe('Timeout Settings Tests', () => { const responsePane = page.locator('.response-pane'); await expect(responsePane).toContainText('timeout of 5ms exceeded'); - // go to welcome page - await page.locator('.bruno-logo').click(); + // Now test inherit functionality + // Click the X button to reset to inherit + const resetButton = page.locator('button[title="Reset to inherit"]'); + await expect(resetButton).toBeVisible(); + await resetButton.click(); + + // After reset, should see "Inherit" button instead of input + const inheritButton = page.locator('button:has-text("Inherit")'); + await expect(inheritButton).toBeVisible(); + await expect(timeoutInput).not.toBeVisible(); + + // Run the request with inherit timeout + await page.getByTestId('send-arrow-icon').click(); + + // Verify the request runs successfully with inherited timeout (should not timeout) + await expect(responsePane).toContainText('302'); + + // Close without saving to avoid modifying the .bru file + await page.locator('.close-icon-container').click(); + await page.locator('button:has-text("Don\'t Save")').first().click(); }); test.afterEach(async ({ pageWithUserData: page }) => {