Skip to content

Commit 7e114c4

Browse files
committed
test: unified timeout for all tests
1 parent a89090c commit 7e114c4

9 files changed

+58
-73
lines changed

src/__tests__/about.test.e2e.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
const {spawnElectron, createTestServer} = require('./');
2020

21-
const STARTUP_TIMEOUT = 15000;
22-
2321
describe('E2E :: About dialog test suite', () => {
2422
describe('opening and displaying about information', () => {
2523
let electron;
@@ -44,11 +42,11 @@ describe('E2E :: About dialog test suite', () => {
4442
});
4543
mainWindow = await electron.waitForWindow(
4644
({url, title}) => url.includes('chrome-tabs') || title === 'ElectronIM tabs');
47-
}, STARTUP_TIMEOUT);
45+
});
4846

4947
afterAll(async () => {
5048
await Promise.all([electron.kill(), testServer.close()]);
51-
}, STARTUP_TIMEOUT);
49+
});
5250

5351
test('starts the application', () => {
5452
expect(electron.app).toBeDefined();

src/__tests__/first-time-install.test.e2e.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
const {spawnElectron} = require('./');
2121

22-
const STARTUP_TIMEOUT = 15000;
23-
2422
describe('E2E :: First-time install test suite', () => {
2523
describe('on first launch with no configured services', () => {
2624
let electron;
@@ -30,11 +28,11 @@ describe('E2E :: First-time install test suite', () => {
3028
electron = await spawnElectron({settings: {tabs: []}});
3129
// Wait for settings dialog to appear (it should appear automatically when no tabs are configured)
3230
settingsWindow = await electron.waitForWindow(({url}) => url.includes('settings/index.html'));
33-
}, STARTUP_TIMEOUT);
31+
});
3432

3533
afterAll(async () => {
3634
await electron.kill();
37-
}, STARTUP_TIMEOUT);
35+
});
3836

3937
test('starts the application', () => {
4038
expect(electron.app).toBeDefined();

src/__tests__/help.test.e2e.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
const {spawnElectron, createTestServer} = require('./');
2020

21-
const STARTUP_TIMEOUT = 15000;
22-
2321
describe('E2E :: Help dialog test suite', () => {
2422
describe('opening and displaying help information', () => {
2523
let electron;
@@ -44,11 +42,11 @@ describe('E2E :: Help dialog test suite', () => {
4442
});
4543
mainWindow = await electron.waitForWindow(
4644
({url, title}) => url.includes('chrome-tabs') || title === 'ElectronIM tabs');
47-
}, STARTUP_TIMEOUT);
45+
});
4846

4947
afterAll(async () => {
5048
await Promise.all([electron.kill(), testServer.close()]);
51-
}, STARTUP_TIMEOUT);
49+
});
5250

5351
test('starts the application', () => {
5452
expect(electron.app).toBeDefined();

src/__tests__/keyboard-shortcuts.test.e2e.js

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
*/
1919
const {spawnElectron, createTestServer} = require('./');
2020

21-
const STARTUP_TIMEOUT = 30000;
22-
const TEST_TIMEOUT = 15000;
23-
2421
describe('E2E :: Keyboard shortcuts test suite', () => {
2522
let electron;
2623
let mainWindow;
@@ -52,14 +49,14 @@ describe('E2E :: Keyboard shortcuts test suite', () => {
5249
});
5350
mainWindow = await electron.waitForWindow(
5451
({url, title}) => url.includes('chrome-tabs') || title === 'ElectronIM tabs');
55-
}, STARTUP_TIMEOUT);
52+
});
5653

5754
afterAll(async () => {
5855
await Promise.all([
5956
electron.kill(),
6057
testServer.close()
6158
]);
62-
}, STARTUP_TIMEOUT);
59+
});
6360

6461
test('application starts with multiple tabs', async () => {
6562
const tabs = mainWindow.locator('.chrome-tab');
@@ -82,7 +79,7 @@ describe('E2E :: Keyboard shortcuts test suite', () => {
8279
);
8380
// Then
8481
expect(await electron.isFullScreen()).toBe(!initialFullScreen);
85-
}, TEST_TIMEOUT);
82+
});
8683

8784
test('pressing F11 again toggles back to initial state', async () => {
8885
// Given
@@ -95,7 +92,7 @@ describe('E2E :: Keyboard shortcuts test suite', () => {
9592
);
9693
// Then
9794
expect(await electron.isFullScreen()).toBe(initialFullScreen);
98-
}, TEST_TIMEOUT);
95+
});
9996
});
10097

10198
describe('Ctrl+[1-9] tab switching', () => {
@@ -108,23 +105,23 @@ describe('E2E :: Keyboard shortcuts test suite', () => {
108105
await electron.waitForActiveTab(mainWindow, 'test-service-1');
109106
// Then
110107
expect(await electron.getActiveTabId(mainWindow)).toBe('test-service-1');
111-
}, TEST_TIMEOUT);
108+
});
112109

113110
test('Ctrl+2 activates second tab', async () => {
114111
// When
115112
await electron.sendKeys('2', ['control']);
116113
await electron.waitForActiveTab(mainWindow, 'test-service-2');
117114
// Then
118115
expect(await electron.getActiveTabId(mainWindow)).toBe('test-service-2');
119-
}, TEST_TIMEOUT);
116+
});
120117

121118
test('Ctrl+3 activates third tab', async () => {
122119
// When
123120
await electron.sendKeys('3', ['control']);
124121
await electron.waitForActiveTab(mainWindow, 'test-service-3');
125122
// Then
126123
expect(await electron.getActiveTabId(mainWindow)).toBe('test-service-3');
127-
}, TEST_TIMEOUT);
124+
});
128125
});
129126

130127
describe('Ctrl+Tab tab traversal', () => {
@@ -137,7 +134,7 @@ describe('E2E :: Keyboard shortcuts test suite', () => {
137134
await electron.waitForActiveTab(mainWindow, 'test-service-2');
138135
// Then
139136
expect(await electron.getActiveTabId(mainWindow)).toBe('test-service-2');
140-
}, TEST_TIMEOUT);
137+
});
141138

142139
test('Ctrl+Shift+Tab cycles to previous tab', async () => {
143140
// Given
@@ -148,7 +145,7 @@ describe('E2E :: Keyboard shortcuts test suite', () => {
148145
await electron.waitForActiveTab(mainWindow, 'test-service-1');
149146
// Then
150147
expect(await electron.getActiveTabId(mainWindow)).toBe('test-service-1');
151-
}, TEST_TIMEOUT);
148+
});
152149

153150
test('Ctrl+Tab wraps around from last to first tab', async () => {
154151
// Given
@@ -160,7 +157,7 @@ describe('E2E :: Keyboard shortcuts test suite', () => {
160157
await electron.waitForActiveTab(mainWindow, 'test-service-1');
161158
// Then
162159
expect(await electron.getActiveTabId(mainWindow)).toBe('test-service-1');
163-
}, TEST_TIMEOUT);
160+
});
164161
});
165162

166163
describe('Ctrl+f find in page', () => {
@@ -177,7 +174,7 @@ describe('E2E :: Keyboard shortcuts test suite', () => {
177174
);
178175
// Then
179176
expect(await electron.isFindInPageOpen()).toBe(true);
180-
}, TEST_TIMEOUT);
177+
});
181178

182179
test('pressing Escape closes find-in-page dialog', async () => {
183180
// Given
@@ -197,7 +194,7 @@ describe('E2E :: Keyboard shortcuts test suite', () => {
197194
);
198195
// Then
199196
expect(await electron.isFindInPageOpen()).toBe(false);
200-
}, TEST_TIMEOUT);
197+
});
201198
});
202199

203200
describe('Meta key shortcuts (macOS legacy support)', () => {
@@ -207,14 +204,14 @@ describe('E2E :: Keyboard shortcuts test suite', () => {
207204
await electron.waitForActiveTab(mainWindow, 'test-service-1');
208205
// Then
209206
expect(await electron.getActiveTabId(mainWindow)).toBe('test-service-1');
210-
}, TEST_TIMEOUT);
207+
});
211208

212209
test('Meta+2 activates first tab', async () => {
213210
// When
214211
await electron.sendKeys('2', ['meta']);
215212
await electron.waitForActiveTab(mainWindow, 'test-service-2');
216213
// Then
217214
expect(await electron.getActiveTabId(mainWindow)).toBe('test-service-2');
218-
}, TEST_TIMEOUT);
215+
});
219216
});
220217
});

src/__tests__/playwright.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
const {spawnElectron, createTestServer} = require('./');
2121

22-
jest.setTimeout(30000);
23-
2422
describe('Playwright utilities test suite', () => {
2523
let sharedTestServer;
2624

src/__tests__/screen-sharing.test.e2e.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
*/
1919
const {spawnElectron, createTestServer} = require('./');
2020

21-
const STARTUP_TIMEOUT = 30000;
22-
const TEST_TIMEOUT = 15000;
23-
2421
describe('E2E :: Screen sharing test suite', () => {
2522
describe('screen sharing functionality', () => {
2623
let electron;
@@ -52,11 +49,11 @@ describe('E2E :: Screen sharing test suite', () => {
5249
({url}) => url === testServer.url || url.includes('localhost'),
5350
5000
5451
);
55-
}, STARTUP_TIMEOUT);
52+
});
5653

5754
afterAll(async () => {
5855
await Promise.all([electron.kill(), testServer.close()]);
59-
}, STARTUP_TIMEOUT);
56+
});
6057

6158
test('starts the application', () => {
6259
expect(electron.app).toBeDefined();
@@ -86,7 +83,7 @@ describe('E2E :: Screen sharing test suite', () => {
8683
// Wait for the shim overlay to appear
8784
const shimRoot = testPageWindow.locator('.electron-desktop-capturer-root');
8885
await expect(shimRoot).toBeVisible({timeout: 5000});
89-
}, TEST_TIMEOUT);
86+
});
9087

9188
test('shim overlay has overlay container', async () => {
9289
const shimOverlay = testPageWindow.locator('.electron-desktop-capturer-root__overlay');
@@ -142,7 +139,7 @@ describe('E2E :: Screen sharing test suite', () => {
142139
// Wait for the overlay to disappear
143140
const shimRoot = testPageWindow.locator('.electron-desktop-capturer-root');
144141
await expect(shimRoot).not.toBeVisible({timeout: 5000});
145-
}, TEST_TIMEOUT);
142+
});
146143

147144
test('screen sharing status shows success', async () => {
148145
const screenShareStatus = testPageWindow.locator('#screen-share-status');
@@ -185,7 +182,7 @@ describe('E2E :: Screen sharing test suite', () => {
185182
// Wait for the shim overlay to appear
186183
shimRoot = testPageWindow.locator('.electron-desktop-capturer-root');
187184
await expect(shimRoot).toBeVisible({timeout: 5000});
188-
}, TEST_TIMEOUT);
185+
});
189186

190187
test('clicking overlay background closes the shim', async () => {
191188
// Click the overlay (not the sources container)
@@ -194,7 +191,7 @@ describe('E2E :: Screen sharing test suite', () => {
194191

195192
// Wait for the overlay to disappear
196193
await expect(shimRoot).not.toBeVisible({timeout: 5000});
197-
}, TEST_TIMEOUT);
194+
});
198195

199196
test('screen sharing status shows cancellation error', async () => {
200197
const screenShareStatus = testPageWindow.locator('#screen-share-status');

src/__tests__/setup-jest.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16+
17+
// Set unified timeout for all tests
18+
jest.setTimeout(45000);
19+
1620
afterEach(async () => {
1721
jest.useRealTimers();
1822
const fs = require('node:fs');

src/__tests__/startup.test.e2e.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
const {spawnElectron, createTestServer} = require('./');
2020

21-
const STARTUP_TIMEOUT = 30000;
22-
2321
describe('E2E :: Application startup test suite', () => {
2422
describe('with configured tab services', () => {
2523
let electron;
@@ -45,11 +43,11 @@ describe('E2E :: Application startup test suite', () => {
4543
});
4644
mainWindow = await electron.waitForWindow(
4745
({url, title}) => url.includes('chrome-tabs') || title === 'ElectronIM tabs');
48-
}, STARTUP_TIMEOUT);
46+
});
4947

5048
afterAll(async () => {
5149
await Promise.all([electron.kill(), testServer.close()]);
52-
}, STARTUP_TIMEOUT);
50+
});
5351

5452
test('starts the application', () => {
5553
expect(electron.app).toBeDefined();

0 commit comments

Comments
 (0)