From a0cc891a4acd1250ad284d89b1be5c056ae06d54 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Tue, 3 Sep 2024 12:30:07 +0200 Subject: [PATCH] [APM] Update Cypress command to access super date picker (#191949) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 📓 Summary Given a change in the HTML structure of the SuperDatePicker component from EUI, the `selectAbsoluteTimeRange` was no longer capable of typing the passed date. Once the PR to update EUI was merged, it didn't go through the APM Cypress suite since those files where not touched, causing the false positive in the CI step. This change directly accesses the input field without relying on sibling elements. Co-authored-by: Marco Antonio Ghiani --- .../apm/ftr_e2e/cypress/support/commands.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 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 ba1d8659e916..58a2ad006c0a 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 @@ -88,18 +88,14 @@ Cypress.Commands.add('selectAbsoluteTimeRange', (start: string, end: string) => const format = 'MMM D, YYYY @ HH:mm:ss.SSS'; cy.getByTestSubj('superDatePickerstartDatePopoverButton').click(); - cy.contains('Start date') - .nextAll() - .find('[data-test-subj="superDatePickerAbsoluteDateInput"]') - .clear({ force: true }) + cy.getByTestSubj('superDatePickerAbsoluteDateInput').clear({ force: true }); + cy.getByTestSubj('superDatePickerAbsoluteDateInput') .type(moment(start).format(format), { force: true }) .type('{enter}'); cy.getByTestSubj('superDatePickerendDatePopoverButton').click(); - cy.contains('End date') - .nextAll() - .find('[data-test-subj="superDatePickerAbsoluteDateInput"]') - .clear({ force: true }) + cy.getByTestSubj('superDatePickerAbsoluteDateInput').clear({ force: true }); + cy.getByTestSubj('superDatePickerAbsoluteDateInput') .type(moment(end).format(format), { force: true }) .type('{enter}'); });