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
  • Loading branch information
YulNaumenko authored Dec 19, 2024
1 parent 7d4bf21 commit 9f01087
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ describe('ConnectorFields renders', () => {
...openAiConnector.config,
providerConfig: {
url: '',
modelId: 'gpt-4o',
model_id: 'gpt-4o',
},
},
};
Expand All @@ -815,6 +815,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 @@ -825,7 +829,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 @@ -843,9 +847,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 9f01087

Please sign in to comment.