Skip to content

Commit

Permalink
[APM] Update Cypress command to access super date picker (elastic#191949
Browse files Browse the repository at this point in the history
)

## 📓 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 <[email protected]>
  • Loading branch information
tonyghiani and Marco Antonio Ghiani authored Sep 3, 2024
1 parent 1a92a4b commit a0cc891
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}');
});
Expand Down

0 comments on commit a0cc891

Please sign in to comment.