diff --git a/x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_actions/actions/delete/delete_action.test.tsx b/x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_actions/actions/delete/delete_action.test.tsx
index f5f4a0b7e8bdc..7c807ac223ea9 100644
--- a/x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_actions/actions/delete/delete_action.test.tsx
+++ b/x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_actions/actions/delete/delete_action.test.tsx
@@ -40,20 +40,20 @@ describe('Delete Action', () => {
it('renders', () => {
render();
- expect(screen.getByTestId('inferenceUIDeleteAction')).toBeEnabled();
+ expect(screen.getByTestId(/inferenceUIDeleteAction/)).toBeEnabled();
});
it('disable the delete action for preconfigured endpoint', () => {
const preconfiguredMockItem = { ...mockItem, endpoint: '.multilingual-e5-small-elasticsearch' };
render();
- expect(screen.getByTestId('inferenceUIDeleteAction')).toBeDisabled();
+ expect(screen.getByTestId(/inferenceUIDeleteAction/)).toBeDisabled();
});
it('loads confirm delete modal', () => {
render();
- fireEvent.click(screen.getByTestId('inferenceUIDeleteAction'));
+ fireEvent.click(screen.getByTestId(/inferenceUIDeleteAction/));
expect(screen.getByTestId('deleteModalForInferenceUI')).toBeInTheDocument();
});
});
diff --git a/x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_actions/actions/delete/delete_action.tsx b/x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_actions/actions/delete/delete_action.tsx
index fb31aeb31dcaa..5ab456e3694f4 100644
--- a/x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_actions/actions/delete/delete_action.tsx
+++ b/x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_actions/actions/delete/delete_action.tsx
@@ -33,6 +33,9 @@ export const DeleteAction: React.FC = ({ selectedEndpoint })
});
};
+ const isPreconfigured = isEndpointPreconfigured(selectedEndpoint.endpoint);
+ const testSubj = `inferenceUIDeleteAction-${isPreconfigured ? 'preconfigured' : 'user-defined'}`;
+
return (
<>
= ({ selectedEndpoint })
defaultMessage: 'Delete inference endpoint {selectedEndpointName}',
values: { selectedEndpointName: selectedEndpoint.endpoint },
})}
- data-test-subj="inferenceUIDeleteAction"
- disabled={isEndpointPreconfigured(selectedEndpoint.endpoint)}
+ data-test-subj={testSubj}
+ disabled={isPreconfigured}
key="delete"
iconType="trash"
color="danger"
diff --git a/x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/tabular_page.test.tsx b/x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/tabular_page.test.tsx
index 60fb799074f14..b156c39d45f1b 100644
--- a/x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/tabular_page.test.tsx
+++ b/x-pack/plugins/search_inference_endpoints/public/components/all_inference_endpoints/tabular_page.test.tsx
@@ -127,7 +127,7 @@ describe('When the tabular page is loaded', () => {
it('should only disable delete action for preconfigured endpoints', () => {
render();
- const deleteActions = screen.getAllByTestId('inferenceUIDeleteAction');
+ const deleteActions = screen.getAllByTestId(/inferenceUIDeleteAction/);
expect(deleteActions[0]).toBeDisabled();
expect(deleteActions[1]).toBeDisabled();
diff --git a/x-pack/test_serverless/functional/page_objects/svl_search_inference_management_page.ts b/x-pack/test_serverless/functional/page_objects/svl_search_inference_management_page.ts
index 4424238a9c809..4e4c6147e8f77 100644
--- a/x-pack/test_serverless/functional/page_objects/svl_search_inference_management_page.ts
+++ b/x-pack/test_serverless/functional/page_objects/svl_search_inference_management_page.ts
@@ -27,53 +27,29 @@ export function SvlSearchInferenceManagementPageProvider({ getService }: FtrProv
const table = await testSubjects.find('inferenceEndpointTable');
const rows = await table.findAllByClassName('euiTableRow');
- expect(rows.length).to.equal(2);
+ // we need at least one (ELSER) otherwise index_mapping might experience some issues
+ expect(rows.length).to.greaterThan(1);
- const elserEndpointCell = await rows[0].findByTestSubject('endpointCell');
- const elserEndpointName = await elserEndpointCell.getVisibleText();
- expect(elserEndpointName).to.contain('.elser-2-elasticsearch');
+ const texts = await Promise.all(rows.map((row) => row.getVisibleText()));
+ const hasElser2 = texts.some((text) => text.includes('.elser-2'));
+ const hasE5 = texts.some((text) => text.includes('.multilingual-e5'));
- const elserProviderCell = await rows[0].findByTestSubject('providerCell');
- const elserProviderName = await elserProviderCell.getVisibleText();
- expect(elserProviderName).to.contain('Elasticsearch');
- expect(elserProviderName).to.contain('.elser_model_2');
-
- const elserTypeCell = await rows[0].findByTestSubject('typeCell');
- const elserTypeName = await elserTypeCell.getVisibleText();
- expect(elserTypeName).to.contain('sparse_embedding');
-
- const e5EndpointCell = await rows[1].findByTestSubject('endpointCell');
- const e5EndpointName = await e5EndpointCell.getVisibleText();
- expect(e5EndpointName).to.contain('.multilingual-e5-small-elasticsearch');
-
- const e5ProviderCell = await rows[1].findByTestSubject('providerCell');
- const e5ProviderName = await e5ProviderCell.getVisibleText();
- expect(e5ProviderName).to.contain('Elasticsearch');
- expect(e5ProviderName).to.contain('.multilingual-e5-small');
-
- const e5TypeCell = await rows[1].findByTestSubject('typeCell');
- const e5TypeName = await e5TypeCell.getVisibleText();
- expect(e5TypeName).to.contain('text_embedding');
+ expect(hasElser2).to.be(true);
+ expect(hasE5).to.be(true);
},
async expectPreconfiguredEndpointsCannotBeDeleted() {
- const table = await testSubjects.find('inferenceEndpointTable');
- const rows = await table.findAllByClassName('euiTableRow');
-
- const elserDeleteAction = await rows[0].findByTestSubject('inferenceUIDeleteAction');
- const e5DeleteAction = await rows[1].findByTestSubject('inferenceUIDeleteAction');
-
- expect(await elserDeleteAction.isEnabled()).to.be(false);
- expect(await e5DeleteAction.isEnabled()).to.be(false);
+ const preconfigureEndpoints = await testSubjects.findAll(
+ 'inferenceUIDeleteAction-preconfigured'
+ );
+ for (const endpoint of preconfigureEndpoints) {
+ expect(await endpoint.isEnabled()).to.be(false);
+ }
},
async expectEndpointWithoutUsageTobeDelete() {
- const table = await testSubjects.find('inferenceEndpointTable');
- const rows = await table.findAllByClassName('euiTableRow');
-
- const userCreatedEndpoint = await rows[2].findByTestSubject('inferenceUIDeleteAction');
-
- await userCreatedEndpoint.click();
+ const userDefinedEdnpoint = await testSubjects.find('inferenceUIDeleteAction-user-defined');
+ await userDefinedEdnpoint.click();
await testSubjects.existOrFail('deleteModalForInferenceUI');
await testSubjects.existOrFail('deleteModalInferenceEndpointName');
@@ -83,12 +59,8 @@ export function SvlSearchInferenceManagementPageProvider({ getService }: FtrProv
},
async expectEndpointWithUsageTobeDelete() {
- const table = await testSubjects.find('inferenceEndpointTable');
- const rows = await table.findAllByClassName('euiTableRow');
-
- const userCreatedEndpoint = await rows[2].findByTestSubject('inferenceUIDeleteAction');
-
- await userCreatedEndpoint.click();
+ const userDefinedEdnpoint = await testSubjects.find('inferenceUIDeleteAction-user-defined');
+ await userDefinedEdnpoint.click();
await testSubjects.existOrFail('deleteModalForInferenceUI');
await testSubjects.existOrFail('deleteModalInferenceEndpointName');
diff --git a/x-pack/test_serverless/functional/test_suites/search/inference_management.ts b/x-pack/test_serverless/functional/test_suites/search/inference_management.ts
index 5293655ef092f..ecb49911edb18 100644
--- a/x-pack/test_serverless/functional/test_suites/search/inference_management.ts
+++ b/x-pack/test_serverless/functional/test_suites/search/inference_management.ts
@@ -37,10 +37,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await pageObjects.svlCommonPage.loginWithRole('developer');
});
- after(async () => {
- await ml.api.cleanMlIndices();
- });
-
beforeEach(async () => {
await svlSearchNavigation.navigateToInferenceManagementPage();
});