Skip to content

Commit 7a85cd8

Browse files
authored
Bump UI tests global timeout (#2685)
* Bump timeout for all UI tests [ci] Seems like some ui tests run slower in ci. It's random so maybe a resource thing. I noticed in the docs that there's a new beta feature that sets browser tests to have a 15s timeout. I dont want to use a beta feature so I'm just manually bumping the global timeout here to 15_000ms https://vitest.dev/config/#testtimeout https://vitest.dev/guide/browser/ Signed-off-by: fayi-da <fayimora.femibalogun@digitalasset.com> --------- Signed-off-by: fayi-da <fayimora.femibalogun@digitalasset.com>
1 parent 820109a commit 7a85cd8

File tree

4 files changed

+298
-345
lines changed

4 files changed

+298
-345
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
export default {
22
test: {
3+
disableConsoleIntercept: true,
34
environment: 'happy-dom',
5+
exclude: ['../lib/**'],
6+
silent: false,
7+
testTimeout: 15000,
48
typecheck: {
59
include: ['**/*.{test,spec}-d.?(c|m)[jt]s?(x)', '**/*.{test,spec}.?(c|m)[jt]s?(x)'],
610
},
7-
exclude: ['../lib/**'],
8-
silent: false,
9-
disableConsoleIntercept: true,
1011
},
1112
};

apps/sv/frontend/src/__tests__/governance/forms/set-amulet-rules-form.test.tsx

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('SV user can', () => {
3636
});
3737
});
3838

39-
describe('Set Amulet Config Rules Form', { timeout: 5000 }, () => {
39+
describe('Set Amulet Config Rules Form', () => {
4040
test('should render all Set Amulet Config Rules Form components', () => {
4141
render(
4242
<Wrapper>
@@ -81,45 +81,41 @@ describe('Set Amulet Config Rules Form', { timeout: 5000 }, () => {
8181
);
8282
});
8383

84-
test(
85-
'should render errors when submit button is clicked on new form',
86-
async () => {
87-
const user = userEvent.setup();
84+
test('should render errors when submit button is clicked on new form', async () => {
85+
const user = userEvent.setup();
8886

89-
render(
90-
<Wrapper>
91-
<SetAmuletConfigRulesForm />
92-
</Wrapper>
93-
);
87+
render(
88+
<Wrapper>
89+
<SetAmuletConfigRulesForm />
90+
</Wrapper>
91+
);
9492

95-
const actionInput = screen.getByTestId('set-amulet-config-rules-action');
96-
const submitButton = screen.getByTestId('submit-button');
97-
expect(submitButton).toBeDefined();
93+
const actionInput = screen.getByTestId('set-amulet-config-rules-action');
94+
const submitButton = screen.getByTestId('submit-button');
95+
expect(submitButton).toBeDefined();
9896

99-
await user.click(submitButton);
100-
expect(submitButton.getAttribute('disabled')).toBeDefined();
101-
await expect(async () => await user.click(submitButton)).rejects.toThrowError(
102-
/Unable to perform pointer interaction/
103-
);
97+
await user.click(submitButton);
98+
expect(submitButton.getAttribute('disabled')).toBeDefined();
99+
await expect(async () => await user.click(submitButton)).rejects.toThrowError(
100+
/Unable to perform pointer interaction/
101+
);
104102

105-
expect(screen.getByText('Summary is required')).toBeDefined();
106-
expect(screen.getByText('Invalid URL')).toBeDefined();
103+
expect(screen.getByText('Summary is required')).toBeDefined();
104+
expect(screen.getByText('Invalid URL')).toBeDefined();
107105

108-
// completing the form should reenable the submit button
109-
const summaryInput = screen.getByTestId('set-amulet-config-rules-summary');
110-
expect(summaryInput).toBeDefined();
111-
await user.type(summaryInput, 'Summary of the proposal');
106+
// completing the form should reenable the submit button
107+
const summaryInput = screen.getByTestId('set-amulet-config-rules-summary');
108+
expect(summaryInput).toBeDefined();
109+
await user.type(summaryInput, 'Summary of the proposal');
112110

113-
const urlInput = screen.getByTestId('set-amulet-config-rules-url');
114-
expect(urlInput).toBeDefined();
115-
await user.type(urlInput, 'https://example.com');
111+
const urlInput = screen.getByTestId('set-amulet-config-rules-url');
112+
expect(urlInput).toBeDefined();
113+
await user.type(urlInput, 'https://example.com');
116114

117-
await user.click(actionInput); // using this to trigger the onBlur event which triggers the validation
115+
await user.click(actionInput); // using this to trigger the onBlur event which triggers the validation
118116

119-
expect(submitButton.getAttribute('disabled')).toBeNull();
120-
},
121-
{ timeout: 10000 }
122-
);
117+
expect(submitButton.getAttribute('disabled')).toBeNull();
118+
});
123119

124120
test('expiry date must be in the future', async () => {
125121
const user = userEvent.setup();
@@ -240,7 +236,7 @@ describe('Set Amulet Config Rules Form', { timeout: 5000 }, () => {
240236
expect(screen.getByText(PROPOSAL_SUMMARY_TITLE)).toBeDefined();
241237
});
242238

243-
test('should show error on form if submission fails', { timeout: 10000 }, async () => {
239+
test('should show error on form if submission fails', async () => {
244240
server.use(
245241
rest.post(`${svUrl}/v0/admin/sv/voterequest/create`, (_, res, ctx) => {
246242
return res(ctx.status(503), ctx.json({ error: 'Service Unavailable' }));

apps/sv/frontend/src/__tests__/sv.test.tsx

Lines changed: 87 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Expiration
122122
expect(await screen.findByText('Vote Requests')).toBeDefined();
123123
});
124124

125-
test('see proper time format in popup', { timeout: 10000 }, async () => {
125+
test('see proper time format in popup', async () => {
126126
const user = userEvent.setup();
127127
render(<AppWithConfig />);
128128

@@ -190,131 +190,119 @@ describe('An SetConfig request', () => {
190190
).toBe(true);
191191
});
192192

193-
test(
194-
'displays a warning when an SV tries to modify a DsoRules field already changed by another request',
195-
{ timeout: 10000 },
196-
async () => {
197-
const user = userEvent.setup();
198-
render(<AppWithConfig />);
193+
test('displays a warning when an SV tries to modify a DsoRules field already changed by another request', async () => {
194+
const user = userEvent.setup();
195+
render(<AppWithConfig />);
199196

200-
expect(await screen.findByText('Governance')).toBeDefined();
201-
await user.click(screen.getByText('Governance'));
197+
expect(await screen.findByText('Governance')).toBeDefined();
198+
await user.click(screen.getByText('Governance'));
202199

203-
expect(await screen.findByText('Vote Requests')).toBeDefined();
204-
expect(await screen.findByText('Governance')).toBeDefined();
200+
expect(await screen.findByText('Vote Requests')).toBeDefined();
201+
expect(await screen.findByText('Governance')).toBeDefined();
205202

206-
changeAction('SRARC_SetConfig');
203+
changeAction('SRARC_SetConfig');
207204

208-
const input = screen.getByTestId(
209-
'decentralizedSynchronizer.synchronizers.0.1.acsCommitmentReconciliationInterval-value'
210-
);
211-
await user.clear(input);
212-
await user.type(input, '481516');
213-
expect(await screen.findByDisplayValue('481516')).toBeDefined();
205+
const input = screen.getByTestId(
206+
'decentralizedSynchronizer.synchronizers.0.1.acsCommitmentReconciliationInterval-value'
207+
);
208+
await user.clear(input);
209+
await user.type(input, '481516');
210+
expect(await screen.findByDisplayValue('481516')).toBeDefined();
214211

215-
const summaryInput = screen.getByTestId('create-reason-summary');
216-
await user.type(summaryInput, 'summaryABC');
217-
expect(await screen.findByDisplayValue('summaryABC')).toBeDefined();
212+
const summaryInput = screen.getByTestId('create-reason-summary');
213+
await user.type(summaryInput, 'summaryABC');
214+
expect(await screen.findByDisplayValue('summaryABC')).toBeDefined();
218215

219-
const urlInput = screen.getByTestId('create-reason-url');
220-
await user.type(urlInput, 'https://vote-request.url');
216+
const urlInput = screen.getByTestId('create-reason-url');
217+
await user.type(urlInput, 'https://vote-request.url');
221218

222-
const warning = screen.getByTestId('voterequest-creation-alert');
223-
expect(warning).toBeDefined();
224-
expect(warning.textContent).toContain(
225-
'A Vote Request aiming to change similar fields already exists. ' +
226-
'You are therefore not allowed to modify the fields: decentralizedSynchronizer.synchronizers.acsCommitmentReconciliationInterval'
227-
);
219+
const warning = screen.getByTestId('voterequest-creation-alert');
220+
expect(warning).toBeDefined();
221+
expect(warning.textContent).toContain(
222+
'A Vote Request aiming to change similar fields already exists. ' +
223+
'You are therefore not allowed to modify the fields: decentralizedSynchronizer.synchronizers.acsCommitmentReconciliationInterval'
224+
);
228225

229-
const button = screen.getByRole('button', { name: 'Send Request to Super Validators' });
230-
expect(button.getAttribute('disabled')).toBeDefined();
231-
}
232-
);
226+
const button = screen.getByRole('button', { name: 'Send Request to Super Validators' });
227+
expect(button.getAttribute('disabled')).toBeDefined();
228+
});
233229

234-
test(
235-
'displays a warning when an SV tries to modify an AmuletRules field already changed by another request',
236-
{ timeout: 10000 },
237-
async () => {
238-
const user = userEvent.setup();
239-
render(<AppWithConfig />);
230+
test('displays a warning when an SV tries to modify an AmuletRules field already changed by another request', async () => {
231+
const user = userEvent.setup();
232+
render(<AppWithConfig />);
240233

241-
expect(await screen.findByText('Governance')).toBeDefined();
242-
await user.click(screen.getByText('Governance'));
234+
expect(await screen.findByText('Governance')).toBeDefined();
235+
await user.click(screen.getByText('Governance'));
243236

244-
expect(await screen.findByText('Vote Requests')).toBeDefined();
237+
expect(await screen.findByText('Vote Requests')).toBeDefined();
245238

246-
changeAction('CRARC_SetConfig');
239+
changeAction('CRARC_SetConfig');
247240

248-
const input = screen.getByTestId('transferConfig.createFee.fee-value');
249-
await user.clear(input);
250-
await user.type(input, '481516');
251-
expect(await screen.findByDisplayValue('481516')).toBeDefined();
241+
const input = screen.getByTestId('transferConfig.createFee.fee-value');
242+
await user.clear(input);
243+
await user.type(input, '481516');
244+
expect(await screen.findByDisplayValue('481516')).toBeDefined();
252245

253-
const input2 = screen.getByTestId('create-reason-summary');
254-
await user.type(input2, 'summaryABC');
255-
expect(await screen.findByDisplayValue('summaryABC')).toBeDefined();
246+
const input2 = screen.getByTestId('create-reason-summary');
247+
await user.type(input2, 'summaryABC');
248+
expect(await screen.findByDisplayValue('summaryABC')).toBeDefined();
256249

257-
const urlInput = screen.getByTestId('create-reason-url');
258-
await user.type(urlInput, 'https://vote-request.url');
250+
const urlInput = screen.getByTestId('create-reason-url');
251+
await user.type(urlInput, 'https://vote-request.url');
259252

260-
const warning = screen.getByTestId('voterequest-creation-alert');
261-
expect(warning).toBeDefined();
262-
expect(warning.textContent).toContain(
263-
'A Vote Request aiming to change similar fields already exists. ' +
264-
'You are therefore not allowed to modify the fields: transferConfig.createFee.fee'
265-
);
266-
const button = screen.getByTestId('create-voterequest-submit-button');
267-
expect(button.getAttribute('disabled')).toBeDefined();
268-
}
269-
);
253+
const warning = screen.getByTestId('voterequest-creation-alert');
254+
expect(warning).toBeDefined();
255+
expect(warning.textContent).toContain(
256+
'A Vote Request aiming to change similar fields already exists. ' +
257+
'You are therefore not allowed to modify the fields: transferConfig.createFee.fee'
258+
);
259+
const button = screen.getByTestId('create-voterequest-submit-button');
260+
expect(button.getAttribute('disabled')).toBeDefined();
261+
});
270262

271-
test(
272-
'disables the Proceed button in the confirmation dialog if a conflict arises after request creation',
273-
{ timeout: 10000 },
274-
async () => {
275-
server.use(
276-
rest.get(`${svUrl}/v0/admin/sv/voterequests`, (_, res, ctx) => {
277-
return res(ctx.json<ListDsoRulesVoteRequestsResponse>({ dso_rules_vote_requests: [] }));
278-
})
279-
);
263+
test('disables the Proceed button in the confirmation dialog if a conflict arises after request creation', async () => {
264+
server.use(
265+
rest.get(`${svUrl}/v0/admin/sv/voterequests`, (_, res, ctx) => {
266+
return res(ctx.json<ListDsoRulesVoteRequestsResponse>({ dso_rules_vote_requests: [] }));
267+
})
268+
);
280269

281-
const user = userEvent.setup();
282-
render(<AppWithConfig />);
270+
const user = userEvent.setup();
271+
render(<AppWithConfig />);
283272

284-
expect(await screen.findByText('Governance')).toBeDefined();
285-
await user.click(screen.getByText('Governance'));
273+
expect(await screen.findByText('Governance')).toBeDefined();
274+
await user.click(screen.getByText('Governance'));
286275

287-
expect(await screen.findByText('Vote Requests')).toBeDefined();
288-
expect(await screen.findByText('Governance')).toBeDefined();
276+
expect(await screen.findByText('Vote Requests')).toBeDefined();
277+
expect(await screen.findByText('Governance')).toBeDefined();
289278

290-
changeAction('CRARC_SetConfig');
279+
changeAction('CRARC_SetConfig');
291280

292-
const input = screen.getByTestId('transferConfig.createFee.fee-value');
293-
await user.clear(input);
294-
await user.type(input, '481516');
295-
expect(await screen.findByDisplayValue('481516')).toBeDefined();
281+
const input = screen.getByTestId('transferConfig.createFee.fee-value');
282+
await user.clear(input);
283+
await user.type(input, '481516');
284+
expect(await screen.findByDisplayValue('481516')).toBeDefined();
296285

297-
const input2 = screen.getByTestId('create-reason-summary');
298-
await user.type(input2, 'summaryABC');
299-
expect(await screen.findByDisplayValue('summaryABC')).toBeDefined();
286+
const input2 = screen.getByTestId('create-reason-summary');
287+
await user.type(input2, 'summaryABC');
288+
expect(await screen.findByDisplayValue('summaryABC')).toBeDefined();
300289

301-
const urlInput = screen.getByTestId('create-reason-url');
302-
await user.type(urlInput, 'https://vote-request.url');
303-
expect(await screen.findByDisplayValue('https://vote-request.url')).toBeDefined();
290+
const urlInput = screen.getByTestId('create-reason-url');
291+
await user.type(urlInput, 'https://vote-request.url');
292+
expect(await screen.findByDisplayValue('https://vote-request.url')).toBeDefined();
304293

305-
expect(await screen.findByText('Send Request to Super Validators')).toBeDefined();
306-
await user.click(screen.getByText('Send Request to Super Validators'));
294+
expect(await screen.findByText('Send Request to Super Validators')).toBeDefined();
295+
await user.click(screen.getByText('Send Request to Super Validators'));
307296

308-
server.use(
309-
rest.get(`${svUrl}/v0/admin/sv/voterequests`, (_, res, ctx) => {
310-
return res(ctx.json<ListDsoRulesVoteRequestsResponse>(voteRequests));
311-
})
312-
);
297+
server.use(
298+
rest.get(`${svUrl}/v0/admin/sv/voterequests`, (_, res, ctx) => {
299+
return res(ctx.json<ListDsoRulesVoteRequestsResponse>(voteRequests));
300+
})
301+
);
313302

314-
const button = screen.getByRole('button', { name: 'Proceed' });
315-
expect(button.getAttribute('disabled')).toBeDefined();
316-
}
317-
);
303+
const button = screen.getByRole('button', { name: 'Proceed' });
304+
expect(button.getAttribute('disabled')).toBeDefined();
305+
});
318306
});
319307

320308
describe('An AddFutureAmuletConfigSchedule request', () => {

0 commit comments

Comments
 (0)