Skip to content

Commit

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

# Backport

This will backport the following commits from `main` to `8.x`:
- [Fix for the flaky failing test: Jest
Tests.x-pack/plugins/stack_connectors/public/connector_types/inference -
ConnectorFields renders Validation validates correctly
"url-input"
(#204835)](#204835)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Yuliia
Naumenko","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-19T02:54:57Z","message":"Fix
for the flaky failing test: Jest
Tests.x-pack/plugins/stack_connectors/public/connector_types/inference -
ConnectorFields renders Validation validates correctly \"url-input\"
(#204835)\n\nResolves
https://github.com/elastic/kibana/issues/204806","sha":"9f01087417b7d257b385067063ec7a3113982c59","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","v9.0.0","backport:version","v8.18.0"],"title":"Fix
for the flaky failing test: Jest
Tests.x-pack/plugins/stack_connectors/public/connector_types/inference -
ConnectorFields renders Validation validates correctly
\"url-input\"","number":204835,"url":"https://github.com/elastic/kibana/pull/204835","mergeCommit":{"message":"Fix
for the flaky failing test: Jest
Tests.x-pack/plugins/stack_connectors/public/connector_types/inference -
ConnectorFields renders Validation validates correctly \"url-input\"
(#204835)\n\nResolves
https://github.com/elastic/kibana/issues/204806","sha":"9f01087417b7d257b385067063ec7a3113982c59"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204835","number":204835,"mergeCommit":{"message":"Fix
for the flaky failing test: Jest
Tests.x-pack/plugins/stack_connectors/public/connector_types/inference -
ConnectorFields renders Validation validates correctly \"url-input\"
(#204835)\n\nResolves
https://github.com/elastic/kibana/issues/204806","sha":"9f01087417b7d257b385067063ec7a3113982c59"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Yuliia Naumenko <[email protected]>
  • Loading branch information
kibanamachine and YulNaumenko authored Dec 19, 2024
1 parent 7d997f3 commit b8031cc
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 b8031cc

Please sign in to comment.