From 970dcdedfca598d07f0d107492336be956912254 Mon Sep 17 00:00:00 2001 From: Caue Marcondes Date: Thu, 21 Nov 2024 11:15:06 +0000 Subject: [PATCH 01/11] [APM] Fix inventory plugin link --- .../service_inventory/service_inventory.cy.ts | 75 +++++++------------ .../public/hooks/use_inventory_router.ts | 2 +- .../entity_inventory_locator.ts | 4 +- 3 files changed, 30 insertions(+), 51 deletions(-) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts index 6198ba8c5d05f..2a5ad81aba652 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts @@ -54,72 +54,42 @@ describe('Service inventory', () => { cy.visitKibana(serviceInventoryHref); }); - it('has no detectable a11y violations on load', () => { - cy.contains('h1', 'Services'); + it('renders correctly', () => { // set skipFailures to true to not fail the test when there are accessibility failures checkA11y({ skipFailures: true }); - }); - - it('has a list of services', () => { - cy.contains('opbeans-node'); - cy.contains('opbeans-java'); - cy.contains('opbeans-rum'); - }); - - it('has a list of environments', () => { - cy.get('td:contains(production)').should('have.length', 3); - }); - - it('when clicking on a service it loads the service overview for that service', () => { - cy.contains('opbeans-node').click({ force: true }); - cy.url().should('include', '/apm/services/opbeans-node/overview'); - cy.contains('h1', 'opbeans-node'); - }); - }); - - describe('Calls APIs', () => { - beforeEach(() => { cy.intercept('GET', '/internal/apm/services?*').as('servicesRequest'); cy.intercept('POST', '/internal/apm/services/detailed_statistics?*').as( 'detailedStatisticsRequest' ); + cy.intercept('GET', '/internal/apm/suggestions?*').as('environmentSuggestionsRequest'); + cy.wait('@environmentSuggestionsRequest'); + cy.wait(mainAliasNames); - cy.loginAsViewerUser(); - cy.visitKibana(serviceInventoryHref); - }); + // It checks page title + cy.contains('h1', 'Services'); - it('with the correct environment when changing the environment', () => { - cy.wait(mainAliasNames); + // It checks inventory table + cy.contains('opbeans-node'); + cy.contains('opbeans-java'); + cy.contains('opbeans-rum'); + cy.get('td:contains(production)').should('have.length', 3); + // It changes environment to production cy.getByTestSubj('environmentFilter').type('{selectall}production'); - cy.contains('button', 'production').click(); - cy.expectAPIsToHaveBeenCalledWith({ apisIntercepted: mainAliasNames, value: 'environment=production', }); - }); - it('when selecting a different time range and clicking the update button', () => { - cy.wait(mainAliasNames); - - cy.selectAbsoluteTimeRange( - moment(timeRange.rangeFrom).subtract(5, 'm').toISOString(), - moment(timeRange.rangeTo).subtract(5, 'm').toISOString() - ); + // It changes date range + const from = moment(timeRange.rangeFrom).subtract(5, 'm').toISOString(); + const to = moment(timeRange.rangeTo).subtract(5, 'm').toISOString(); + cy.selectAbsoluteTimeRange(from, to); cy.contains('Update').click(); cy.wait(mainAliasNames); - }); - }); - - describe('Table search', () => { - beforeEach(() => { - cy.loginAsEditorUser(); - }); - it('Uses the fast filter to search for services', () => { - cy.visitKibana(serviceInventoryHref); + // It filter table content with Fast filter cy.get('[data-test-subj="tableSearchInput"]').should('exist'); cy.contains('opbeans-node'); cy.contains('opbeans-java'); @@ -132,12 +102,21 @@ describe('Service inventory', () => { cy.contains('opbeans-node'); cy.contains('opbeans-java'); cy.contains('opbeans-rum'); + + // It navigates to service overview page + cy.get('[data-test-subj="serviceLink_nodejs"]').click(); + cy.url().should('include', '/apm/services/opbeans-node/overview'); + cy.contains('h1', 'opbeans-node'); + cy.go('back'); + + // It navigates to Inventory plugin. + cy.contains('Try our new Inventory').click(); + cy.url().should('include', '/inventory'); }); }); describe('Check detailed statistics API with multiple services', () => { before(() => { - // clean previous data created synthtrace.clean(); const { rangeFrom, rangeTo } = timeRange; synthtrace.index( diff --git a/x-pack/plugins/observability_solution/inventory/public/hooks/use_inventory_router.ts b/x-pack/plugins/observability_solution/inventory/public/hooks/use_inventory_router.ts index a917daf576ded..34aaf0b319d95 100644 --- a/x-pack/plugins/observability_solution/inventory/public/hooks/use_inventory_router.ts +++ b/x-pack/plugins/observability_solution/inventory/public/hooks/use_inventory_router.ts @@ -47,7 +47,7 @@ export function useInventoryRouter(): StatefulInventoryRouter { navigateToApp('inventory', { path: next, replace: true }); }, link: (path, ...args) => { - return http.basePath.prepend('/app/observability/inventory' + link(path, ...args)); + return http.basePath.prepend('/app/inventory' + link(path, ...args)); }, }), [navigateToApp, http.basePath] diff --git a/x-pack/plugins/observability_solution/observability_shared/common/locators/entity_inventory/entity_inventory_locator.ts b/x-pack/plugins/observability_solution/observability_shared/common/locators/entity_inventory/entity_inventory_locator.ts index deb820b0d5e0a..29045de48e143 100644 --- a/x-pack/plugins/observability_solution/observability_shared/common/locators/entity_inventory/entity_inventory_locator.ts +++ b/x-pack/plugins/observability_solution/observability_shared/common/locators/entity_inventory/entity_inventory_locator.ts @@ -16,8 +16,8 @@ export class EntitiesInventoryLocatorDefinition implements LocatorDefinition { return { - app: 'observability', - path: `/inventory`, + app: 'inventory', + path: `/`, state: {}, }; }; From e5ca1096c275a968d1f7090fec31fe6a4a6811ec Mon Sep 17 00:00:00 2001 From: Caue Marcondes Date: Thu, 21 Nov 2024 13:11:52 +0000 Subject: [PATCH 02/11] test --- .../cypress/e2e/service_inventory/service_inventory.cy.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts index 2a5ad81aba652..799ec4e954cec 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts @@ -109,6 +109,9 @@ describe('Service inventory', () => { cy.contains('h1', 'opbeans-node'); cy.go('back'); + cy.url().should('include', '/apm/services'); + cy.wait(mainAliasNames); + // It navigates to Inventory plugin. cy.contains('Try our new Inventory').click(); cy.url().should('include', '/inventory'); From 1c80d76899de53b5fb9d504c1b1b710dbd3da8af Mon Sep 17 00:00:00 2001 From: Caue Marcondes Date: Thu, 21 Nov 2024 15:09:19 +0000 Subject: [PATCH 03/11] test 2 --- .../cypress/e2e/service_inventory/service_inventory.cy.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts index 799ec4e954cec..afaf604947654 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts @@ -109,11 +109,10 @@ describe('Service inventory', () => { cy.contains('h1', 'opbeans-node'); cy.go('back'); - cy.url().should('include', '/apm/services'); - cy.wait(mainAliasNames); + cy.contains('h1', 'Services'); // It navigates to Inventory plugin. - cy.contains('Try our new Inventory').click(); + cy.get('[data-test-subj="apmEntitiesInventoryCalloutLink"]').click(); cy.url().should('include', '/inventory'); }); }); From a7c3dc6d014a351673bedc99b32929a82b51e0b1 Mon Sep 17 00:00:00 2001 From: Caue Marcondes Date: Fri, 22 Nov 2024 08:51:40 +0000 Subject: [PATCH 04/11] test --- .../e2e/service_inventory/service_inventory.cy.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts index afaf604947654..e69ff9ac7ecc1 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts @@ -104,12 +104,12 @@ describe('Service inventory', () => { cy.contains('opbeans-rum'); // It navigates to service overview page - cy.get('[data-test-subj="serviceLink_nodejs"]').click(); - cy.url().should('include', '/apm/services/opbeans-node/overview'); - cy.contains('h1', 'opbeans-node'); - cy.go('back'); + // cy.get('[data-test-subj="serviceLink_nodejs"]').click(); + // cy.url().should('include', '/apm/services/opbeans-node/overview'); + // cy.contains('h1', 'opbeans-node'); + // cy.go('back'); - cy.contains('h1', 'Services'); + // cy.contains('h1', 'Services'); // It navigates to Inventory plugin. cy.get('[data-test-subj="apmEntitiesInventoryCalloutLink"]').click(); From 6c9d46d136237050e530e3787aea8383ff647af0 Mon Sep 17 00:00:00 2001 From: Caue Marcondes Date: Fri, 22 Nov 2024 10:27:48 +0000 Subject: [PATCH 05/11] reverting --- .../service_inventory/service_inventory.cy.ts | 82 ++++++++++++------- 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts index e69ff9ac7ecc1..92f072b9c1768 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts @@ -54,42 +54,77 @@ describe('Service inventory', () => { cy.visitKibana(serviceInventoryHref); }); - it('renders correctly', () => { + it('has no detectable a11y violations on load', () => { + cy.contains('h1', 'Services'); // set skipFailures to true to not fail the test when there are accessibility failures checkA11y({ skipFailures: true }); + }); + + it('has a list of services', () => { + cy.contains('opbeans-node'); + cy.contains('opbeans-java'); + cy.contains('opbeans-rum'); + }); + + it('has a list of environments', () => { + cy.get('td:contains(production)').should('have.length', 3); + }); + + it('when clicking on a service it loads the service overview for that service', () => { + cy.contains('opbeans-node').click({ force: true }); + cy.url().should('include', '/apm/services/opbeans-node/overview'); + cy.contains('h1', 'opbeans-node'); + }); + + it('opens the inventory plugin', () => { + cy.get('[data-test-subj="apmEntitiesInventoryCalloutLink"]').click(); + cy.url().should('include', '/inventory'); + }); + }); + + describe('Calls APIs', () => { + beforeEach(() => { cy.intercept('GET', '/internal/apm/services?*').as('servicesRequest'); cy.intercept('POST', '/internal/apm/services/detailed_statistics?*').as( 'detailedStatisticsRequest' ); - cy.intercept('GET', '/internal/apm/suggestions?*').as('environmentSuggestionsRequest'); - cy.wait('@environmentSuggestionsRequest'); - cy.wait(mainAliasNames); - // It checks page title - cy.contains('h1', 'Services'); + cy.loginAsViewerUser(); + cy.visitKibana(serviceInventoryHref); + }); - // It checks inventory table - cy.contains('opbeans-node'); - cy.contains('opbeans-java'); - cy.contains('opbeans-rum'); - cy.get('td:contains(production)').should('have.length', 3); + it('with the correct environment when changing the environment', () => { + cy.wait(mainAliasNames); - // It changes environment to production cy.getByTestSubj('environmentFilter').type('{selectall}production'); + cy.contains('button', 'production').click(); + cy.expectAPIsToHaveBeenCalledWith({ apisIntercepted: mainAliasNames, value: 'environment=production', }); + }); - // It changes date range - const from = moment(timeRange.rangeFrom).subtract(5, 'm').toISOString(); - const to = moment(timeRange.rangeTo).subtract(5, 'm').toISOString(); - cy.selectAbsoluteTimeRange(from, to); + it('when selecting a different time range and clicking the update button', () => { + cy.wait(mainAliasNames); + + cy.selectAbsoluteTimeRange( + moment(timeRange.rangeFrom).subtract(5, 'm').toISOString(), + moment(timeRange.rangeTo).subtract(5, 'm').toISOString() + ); cy.contains('Update').click(); cy.wait(mainAliasNames); + }); + }); + + describe('Table search', () => { + beforeEach(() => { + cy.loginAsEditorUser(); + }); - // It filter table content with Fast filter + it('Uses the fast filter to search for services', () => { + cy.visitKibana(serviceInventoryHref); cy.get('[data-test-subj="tableSearchInput"]').should('exist'); cy.contains('opbeans-node'); cy.contains('opbeans-java'); @@ -102,23 +137,12 @@ describe('Service inventory', () => { cy.contains('opbeans-node'); cy.contains('opbeans-java'); cy.contains('opbeans-rum'); - - // It navigates to service overview page - // cy.get('[data-test-subj="serviceLink_nodejs"]').click(); - // cy.url().should('include', '/apm/services/opbeans-node/overview'); - // cy.contains('h1', 'opbeans-node'); - // cy.go('back'); - - // cy.contains('h1', 'Services'); - - // It navigates to Inventory plugin. - cy.get('[data-test-subj="apmEntitiesInventoryCalloutLink"]').click(); - cy.url().should('include', '/inventory'); }); }); describe('Check detailed statistics API with multiple services', () => { before(() => { + // clean previous data created synthtrace.clean(); const { rangeFrom, rangeTo } = timeRange; synthtrace.index( From c3ed90f1ddb8a1e41fa46ef81bb704682bbeccef Mon Sep 17 00:00:00 2001 From: Caue Marcondes Date: Mon, 25 Nov 2024 12:40:20 +0000 Subject: [PATCH 06/11] fixing tests --- .../e2e/service_inventory/service_inventory.cy.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts index 92f072b9c1768..18342a6b458ca 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts @@ -23,10 +23,12 @@ const serviceInventoryHref = url.format({ const mainApiRequestsToIntercept = [ { + method: 'GET', endpoint: '/internal/apm/services?*', aliasName: 'servicesRequest', }, { + method: 'POST', endpoint: '/internal/apm/services/detailed_statistics?*', aliasName: 'detailedStatisticsRequest', }, @@ -50,6 +52,9 @@ describe('Service inventory', () => { describe('When navigating to the service inventory', () => { beforeEach(() => { + mainApiRequestsToIntercept.forEach(({ aliasName, endpoint, method }) => + cy.intercept(method, endpoint).as(aliasName) + ); cy.loginAsViewerUser(); cy.visitKibana(serviceInventoryHref); }); @@ -77,6 +82,8 @@ describe('Service inventory', () => { }); it('opens the inventory plugin', () => { + cy.wait(mainAliasNames); + cy.contains('h1', 'Services'); cy.get('[data-test-subj="apmEntitiesInventoryCalloutLink"]').click(); cy.url().should('include', '/inventory'); }); @@ -84,9 +91,8 @@ describe('Service inventory', () => { describe('Calls APIs', () => { beforeEach(() => { - cy.intercept('GET', '/internal/apm/services?*').as('servicesRequest'); - cy.intercept('POST', '/internal/apm/services/detailed_statistics?*').as( - 'detailedStatisticsRequest' + mainApiRequestsToIntercept.forEach(({ aliasName, endpoint, method }) => + cy.intercept(method, endpoint).as(aliasName) ); cy.loginAsViewerUser(); From 9d6604de70c25a9cb13e05016fb5d392b903efc5 Mon Sep 17 00:00:00 2001 From: Caue Marcondes Date: Mon, 25 Nov 2024 16:31:35 +0000 Subject: [PATCH 07/11] trying again --- .../cypress/e2e/service_inventory/service_inventory.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts index 18342a6b458ca..2d1e62eae9246 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts @@ -84,7 +84,7 @@ describe('Service inventory', () => { it('opens the inventory plugin', () => { cy.wait(mainAliasNames); cy.contains('h1', 'Services'); - cy.get('[data-test-subj="apmEntitiesInventoryCalloutLink"]').click(); + cy.contains('Try our new Inventory!').click(); cy.url().should('include', '/inventory'); }); }); From 2f5f75491e97842a7ab40a73a20dc2587d5955b7 Mon Sep 17 00:00:00 2001 From: Caue Marcondes Date: Tue, 26 Nov 2024 10:42:15 +0000 Subject: [PATCH 08/11] another time --- .../e2e/service_inventory/service_inventory.cy.ts | 4 +++- .../apm/ftr_e2e/cypress/support/commands.ts | 10 ++++++++-- .../apm/ftr_e2e/cypress/support/types.d.ts | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts index 2d1e62eae9246..7f69f007c3bc1 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts @@ -56,7 +56,9 @@ describe('Service inventory', () => { cy.intercept(method, endpoint).as(aliasName) ); cy.loginAsViewerUser(); - cy.visitKibana(serviceInventoryHref); + cy.visitKibana(serviceInventoryHref, { + localStorageOptions: [['apm.dismissedEntitiesInventoryCallout', 'false']], + }); }); it('has no detectable a11y violations on load', () => { diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/support/commands.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/support/commands.ts index d9c0ef08590ce..abc52b8c6d6d2 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/support/commands.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/support/commands.ts @@ -87,8 +87,14 @@ Cypress.Commands.add('changeTimeRange', (value: string) => { cy.contains(value).click(); }); -Cypress.Commands.add('visitKibana', (url: string) => { - cy.visit(url); +Cypress.Commands.add('visitKibana', (url, options) => { + cy.visit(url, { + onBeforeLoad(win) { + if (options?.localStorageOptions && options.localStorageOptions.length > 0) { + options.localStorageOptions.forEach(([key, value]) => win.localStorage.setItem(key, value)); + } + }, + }); cy.getByTestSubj('kbnLoadingMessage').should('exist'); cy.getByTestSubj('kbnLoadingMessage').should('not.exist', { timeout: 50000, diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/support/types.d.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/support/types.d.ts index 2c5a4ae35f311..f2d138bf46385 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/support/types.d.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/support/types.d.ts @@ -19,7 +19,7 @@ declare namespace Cypress { password: string; }): Cypress.Chainable>; changeTimeRange(value: string): void; - visitKibana(url: string): void; + visitKibana(url: string, options?: { localStorageOptions?: Array<[string, string]> }): void; selectAbsoluteTimeRange(start: string, end: string): void; expectAPIsToHaveBeenCalledWith(params: { apisIntercepted: string[]; value: string }): void; updateAdvancedSettings(settings: Record): void; From 07e6c60b922b8008ea48fcf35d24b2d293107e86 Mon Sep 17 00:00:00 2001 From: Caue Marcondes Date: Tue, 26 Nov 2024 14:57:57 +0000 Subject: [PATCH 09/11] adding cypress session --- .../apm/ftr_e2e/cypress/support/commands.ts | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/support/commands.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/support/commands.ts index abc52b8c6d6d2..68d6bb08c9282 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/support/commands.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/support/commands.ts @@ -55,26 +55,32 @@ Cypress.Commands.add('loginAsApmReadPrivilegesWithWriteSettingsUser', () => { Cypress.Commands.add( 'loginAs', ({ username, password }: { username: string; password: string }) => { - // cy.session(username, () => { - const kibanaUrl = Cypress.env('KIBANA_URL'); - cy.log(`Logging in as ${username} on ${kibanaUrl}`); - cy.visit('/'); - cy.request({ - log: true, - method: 'POST', - url: `${kibanaUrl}/internal/security/login`, - body: { - providerType: 'basic', - providerName: 'basic', - currentURL: `${kibanaUrl}/login`, - params: { username, password }, - }, - headers: { - 'kbn-xsrf': 'e2e_test', + cy.session( + username, + () => { + const kibanaUrl = Cypress.env('KIBANA_URL'); + cy.log(`Logging in as ${username} on ${kibanaUrl}`); + cy.visit('/'); + cy.request({ + log: true, + method: 'POST', + url: `${kibanaUrl}/internal/security/login`, + body: { + providerType: 'basic', + providerName: 'basic', + currentURL: `${kibanaUrl}/login`, + params: { username, password }, + }, + headers: { + 'kbn-xsrf': 'e2e_test', + }, + }); + cy.visit('/'); }, - // }); - }); - cy.visit('/'); + { + cacheAcrossSpecs: true, + } + ); } ); From 216d3a6c07165878346070c7f7e8014476f7a284 Mon Sep 17 00:00:00 2001 From: Caue Marcondes Date: Tue, 26 Nov 2024 15:01:40 +0000 Subject: [PATCH 10/11] round 3 --- .../e2e/service_inventory/service_inventory.cy.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts index 7f69f007c3bc1..8f107d8c9ba11 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts @@ -61,6 +61,13 @@ describe('Service inventory', () => { }); }); + it('opens the inventory plugin', () => { + cy.wait(mainAliasNames); + cy.contains('h1', 'Services'); + cy.contains('Try our new Inventory!').click(); + cy.url().should('include', '/inventory'); + }); + it('has no detectable a11y violations on load', () => { cy.contains('h1', 'Services'); // set skipFailures to true to not fail the test when there are accessibility failures @@ -82,13 +89,6 @@ describe('Service inventory', () => { cy.url().should('include', '/apm/services/opbeans-node/overview'); cy.contains('h1', 'opbeans-node'); }); - - it('opens the inventory plugin', () => { - cy.wait(mainAliasNames); - cy.contains('h1', 'Services'); - cy.contains('Try our new Inventory!').click(); - cy.url().should('include', '/inventory'); - }); }); describe('Calls APIs', () => { From 901cfcbc275f2de03ceb61996ed602cfec2faed2 Mon Sep 17 00:00:00 2001 From: Caue Marcondes Date: Tue, 26 Nov 2024 16:40:44 +0000 Subject: [PATCH 11/11] fail --- .../cypress/e2e/service_inventory/service_inventory.cy.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts index 8f107d8c9ba11..6a0e8b9cfe356 100644 --- a/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts +++ b/x-pack/plugins/observability_solution/apm/ftr_e2e/cypress/e2e/service_inventory/service_inventory.cy.ts @@ -61,13 +61,6 @@ describe('Service inventory', () => { }); }); - it('opens the inventory plugin', () => { - cy.wait(mainAliasNames); - cy.contains('h1', 'Services'); - cy.contains('Try our new Inventory!').click(); - cy.url().should('include', '/inventory'); - }); - it('has no detectable a11y violations on load', () => { cy.contains('h1', 'Services'); // set skipFailures to true to not fail the test when there are accessibility failures