Compare commits

...

1 Commits

Author SHA1 Message Date
Ashwin Bhatkal
6239328112 fix(alert-channel-integrations): paste instead of type in the Google Chat save tests
The two Google Chat save tests drive the form with userEvent.type(), which
dispatches one keystroke at a time and re-renders the whole channel form on
each one. The payload test types 91 characters (a 13-char channel name plus a
78-char chat.googleapis.com webhook URL), which costs ~850ms locally. The file
runs ~5x slower on CI, putting that test right at the 5000ms jest timeout, so
ordinary runner variance tips it over.

Click + paste is a single input event per field, exercises the same onChange
path, and matches how a webhook URL actually gets entered. The payload test
drops to ~280ms and the invalid-URL test to ~330ms.
2026-08-11 16:51:32 +05:30

View File

@@ -437,6 +437,17 @@ describe('Create Alert Channel', () => {
render(<CreateAlertChannels preType={ChannelType.GoogleChat} />);
});
// paste instead of type: a per-keystroke re-render of the whole form
// pushes these tests past the 5s jest timeout on slower CI runners
async function fillField(
user: ReturnType<typeof userEvent.setup>,
testId: string,
value: string,
): Promise<void> {
await user.click(screen.getByTestId(testId));
await user.paste(value);
}
it('Should check if the selected item in the type dropdown has text "Google Chat"', () => {
expect(screen.getByText('Google Chat')).toBeInTheDocument();
});
@@ -463,14 +474,8 @@ describe('Create Alert Channel', () => {
it('Should check if saving with a webhook url outside chat.googleapis.com displays error notification', async () => {
const user = userEvent.setup();
await user.type(
screen.getByTestId('channel-name-textbox'),
'gchat-channel',
);
await user.type(
screen.getByTestId('webhook-url-textbox'),
'https://example.com/webhook',
);
await fillField(user, 'channel-name-textbox', 'gchat-channel');
await fillField(user, 'webhook-url-textbox', 'https://example.com/webhook');
await user.click(screen.getByTestId('save-channel-button'));
@@ -496,11 +501,8 @@ describe('Create Alert Channel', () => {
const user = userEvent.setup();
await user.type(
screen.getByTestId('channel-name-textbox'),
'gchat-channel',
);
await user.type(screen.getByTestId('webhook-url-textbox'), validWebhookUrl);
await fillField(user, 'channel-name-textbox', 'gchat-channel');
await fillField(user, 'webhook-url-textbox', validWebhookUrl);
await user.click(screen.getByTestId('save-channel-button'));