From d51601d346a3ec9ec4abd61ff338e6f62967a386 Mon Sep 17 00:00:00 2001 From: Joe McElroy Date: Mon, 9 Dec 2024 13:25:09 +0000 Subject: [PATCH] [OE] [Connectors] Enabling connectors FTRs (#203192) ## Summary - Fixes issue where deletes all connectors before starting - fixes issue where the first page is index_management - fixes devconsole tests - fixes where the creating the connector and searching for it may not appear (as hasn't propagated) made this test retry ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine --- .../connection_details_panel.tsx | 6 ++++- .../svl_search_connectors_page.ts | 22 +++++++++++++--- .../search/connectors/connectors_overview.ts | 26 ++++++++++++------- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/x-pack/plugins/serverless_search/public/application/components/connectors/connector_config/connection_details_panel.tsx b/x-pack/plugins/serverless_search/public/application/components/connectors/connector_config/connection_details_panel.tsx index 1a25b1d3c3dfa..4dc3d9db5b955 100644 --- a/x-pack/plugins/serverless_search/public/application/components/connectors/connector_config/connection_details_panel.tsx +++ b/x-pack/plugins/serverless_search/public/application/components/connectors/connector_config/connection_details_panel.tsx @@ -53,7 +53,11 @@ elasticsearch: /> - + {codeBlock} diff --git a/x-pack/test_serverless/functional/page_objects/svl_search_connectors_page.ts b/x-pack/test_serverless/functional/page_objects/svl_search_connectors_page.ts index 78554ea05beda..8279c89f05d03 100644 --- a/x-pack/test_serverless/functional/page_objects/svl_search_connectors_page.ts +++ b/x-pack/test_serverless/functional/page_objects/svl_search_connectors_page.ts @@ -11,7 +11,18 @@ export function SvlSearchConnectorsPageProvider({ getService }: FtrProviderConte const testSubjects = getService('testSubjects'); const browser = getService('browser'); const retry = getService('retry'); + const es = getService('es'); return { + helpers: { + async deleteAllConnectors() { + const connectors = await es.connector.list(); + for (const connector of connectors.results) { + await es.connector.delete({ + connector_id: connector.id!, + }); + } + }, + }, connectorConfigurationPage: { async createConnector() { await testSubjects.click('serverlessSearchEmptyConnectorsPromptCreateConnectorButton'); @@ -60,8 +71,8 @@ export function SvlSearchConnectorsPageProvider({ getService }: FtrProviderConte async expectConnectorIdToMatchUrl(connectorId: string) { expect(await browser.getCurrentUrl()).contain(`/app/connectors/${connectorId}`); }, - async getConnectorId() { - return await testSubjects.getVisibleText('serverlessSearchConnectorConnectorId'); + async getConnectorDetails() { + return await testSubjects.getVisibleText('serverlessSearchConnectorConnectorDetails'); }, }, connectorOverviewPage: { @@ -70,8 +81,11 @@ export function SvlSearchConnectorsPageProvider({ getService }: FtrProviderConte await testSubjects.setValue('serverlessSearchConnectorsTableSelect', option); }, async connectorNameExists(connectorName: string) { - const connectorsList = await this.getConnectorsList(); - return Boolean(connectorsList.find((name) => name === connectorName)); + await retry.tryForTime(10000, async () => { + const connectorsList = await this.getConnectorsList(); + const isFound = Boolean(connectorsList.find((name) => name === connectorName)); + expect(isFound).to.be(true); + }); }, async confirmDeleteConnectorModalComponentsExists() { await testSubjects.existOrFail('serverlessSearchDeleteConnectorModalFieldText'); diff --git a/x-pack/test_serverless/functional/test_suites/search/connectors/connectors_overview.ts b/x-pack/test_serverless/functional/test_suites/search/connectors/connectors_overview.ts index 95b35381a3d1e..7b014d6ad3e7a 100644 --- a/x-pack/test_serverless/functional/test_suites/search/connectors/connectors_overview.ts +++ b/x-pack/test_serverless/functional/test_suites/search/connectors/connectors_overview.ts @@ -18,26 +18,32 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { ]); const testSubjects = getService('testSubjects'); const browser = getService('browser'); - // FLAKY: https://github.com/elastic/kibana/issues/197019 - describe.skip('connectors', function () { + + describe('connectors', function () { before(async () => { + await pageObjects.svlSearchConnectorsPage.helpers.deleteAllConnectors(); await pageObjects.svlCommonPage.loginWithRole('developer'); - await pageObjects.svlCommonNavigation.sidenav.clickLink({ - deepLinkId: 'serverlessConnectors', - }); }); - it('Connector app is loaded and has no connectors', async () => { - await pageObjects.svlSearchConnectorsPage.connectorOverviewPage.expectConnectorOverviewPageComponentsToExist(); - }); - it('has embedded dev console', async () => { + it('has embedded console', async () => { + await pageObjects.common.navigateToApp('serverlessConnectors'); await testHasEmbeddedConsole(pageObjects); }); + + it('Connector app is loaded and has no connectors', async () => { + await pageObjects.common.navigateToApp('serverlessConnectors'); + await pageObjects.svlSearchConnectorsPage.connectorOverviewPage.expectConnectorOverviewPageComponentsToExist(); + }); + describe('create and configure connector', () => { it('create connector and confirm connector configuration page is loaded', async () => { await pageObjects.svlSearchConnectorsPage.connectorConfigurationPage.createConnector(); + await pageObjects.svlSearchConnectorsPage.connectorConfigurationPage.editType('zoom'); + const connectorDetails = + await pageObjects.svlSearchConnectorsPage.connectorConfigurationPage.getConnectorDetails(); + const connectorId = connectorDetails.match(/connector_id: (.*)/)?.[1]; await pageObjects.svlSearchConnectorsPage.connectorConfigurationPage.expectConnectorIdToMatchUrl( - await pageObjects.svlSearchConnectorsPage.connectorConfigurationPage.getConnectorId() + connectorId! ); }); it('edit description', async () => {