Skip to content

Commit

Permalink
Fix for the flaky failing test: Jest Tests.x-pack/plugins/stack_conne…
Browse files Browse the repository at this point in the history
…ctors/public/connector_types/inference - ConnectorFields renders Validation validates correctly "url-input" (elastic#204835)

Resolves elastic#204806

(cherry picked from commit 9f01087)
  • Loading branch information
YulNaumenko committed Dec 19, 2024
1 parent 7d997f3 commit 9b50dd7
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ describe('ConnectorFields renders', () => {
...openAiConnector.config,
providerConfig: {
url: '',
modelId: 'gpt-4o',
model_id: 'gpt-4o',
},
},
};
Expand All @@ -809,6 +809,10 @@ describe('ConnectorFields renders', () => {
<ConnectorFields readOnly={false} isEdit={true} registerPreSubmitValidator={() => {}} />
</ConnectorFormTestProvider>
);
await userEvent.type(
res.getByTestId('api_key-password'),
'{selectall}{backspace}goodpassword'
);

await userEvent.click(res.getByTestId('form-test-provide-submit'));
await waitFor(async () => {
Expand All @@ -819,7 +823,7 @@ describe('ConnectorFields renders', () => {
});

const tests: Array<[string, string]> = [
['url-input', 'not-valid'],
['url-input', ''],
['api_key-password', ''],
];
it.each(tests)('validates correctly %p', async (field, value) => {
Expand All @@ -837,9 +841,7 @@ describe('ConnectorFields renders', () => {
</ConnectorFormTestProvider>
);

await userEvent.type(res.getByTestId(field), `{selectall}{backspace}${value}`, {
delay: 10,
});
await userEvent.type(res.getByTestId(field), `{selectall}{backspace}${value}`);

await userEvent.click(res.getByTestId('form-test-provide-submit'));
await waitFor(async () => {
Expand Down

0 comments on commit 9b50dd7

Please sign in to comment.