mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-11 09:51:30 +00:00
Fix: Cross button not resetting timeout to inherit (#5749)
* Fix: Cross button not resetting timeout to inherit
This commit is contained in:
@@ -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' })}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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 }) => {
|
||||
|
||||
Reference in New Issue
Block a user