Should make cypress less flake with two of our tests (#104033) (#104043)

## Summary

Should reduce flake in two of our Cypress tests.

* Removed skip on a test recently skipped
* Removes a wait() that doesn't seem to have been reducing flake added by a EUI team member
* Adds a `.click()` to give focus to a component in order to improve our chances of typing in the input box
* Adds some `.should('exists')` which will cause Cypress to ensure something exists and a better chance for click handlers to be added
* Adds a pipe as suggested by @yctercero in the flake test

### Checklist

- [x] [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

Co-authored-by: Frank Hassanabad <frank.hassanabad@elastic.co>
This commit is contained in:
Kibana Machine 2021-06-30 23:47:42 -04:00 committed by GitHub
parent 709fdf1f57
commit 03fddd678b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View file

@ -46,6 +46,7 @@ describe('Row renderers', () => {
loginAndWaitForPage(HOSTS_URL);
openTimelineUsingToggle();
populateTimeline();
cy.get(TIMELINE_SHOW_ROW_RENDERERS_GEAR).should('exist');
cy.get(TIMELINE_SHOW_ROW_RENDERERS_GEAR).first().click({ force: true });
});
@ -59,6 +60,7 @@ describe('Row renderers', () => {
});
it('Selected renderer can be disabled and enabled', () => {
cy.get(TIMELINE_ROW_RENDERERS_SEARCHBOX).should('exist');
cy.get(TIMELINE_ROW_RENDERERS_SEARCHBOX).type('flow');
cy.get(TIMELINE_ROW_RENDERERS_MODAL_ITEMS_CHECKBOX).first().uncheck();
@ -75,8 +77,11 @@ describe('Row renderers', () => {
});
});
it.skip('Selected renderer can be disabled with one click', () => {
cy.get(TIMELINE_ROW_RENDERERS_DISABLE_ALL_BTN).click({ force: true });
it('Selected renderer can be disabled with one click', () => {
cy.get(TIMELINE_ROW_RENDERERS_DISABLE_ALL_BTN).should('exist');
cy.get(TIMELINE_ROW_RENDERERS_DISABLE_ALL_BTN)
.pipe(($el) => $el.trigger('click'))
.should('not.be.visible');
cy.intercept('PATCH', '/api/timeline').as('updateTimeline');
cy.wait('@updateTimeline').its('response.statusCode').should('eq', 200);

View file

@ -74,7 +74,6 @@ describe('url state', () => {
waitForIpsTableToBeLoaded();
setEndDate(ABSOLUTE_DATE.newEndTimeTyped);
updateDates();
cy.wait(300);
let startDate: string;
let endDate: string;

View file

@ -21,7 +21,7 @@ export const setEndDate = (date: string) => {
cy.get(DATE_PICKER_ABSOLUTE_TAB).first().click({ force: true });
cy.get(DATE_PICKER_ABSOLUTE_INPUT).clear().type(date);
cy.get(DATE_PICKER_ABSOLUTE_INPUT).click().clear().type(date);
};
export const setStartDate = (date: string) => {
@ -29,7 +29,7 @@ export const setStartDate = (date: string) => {
cy.get(DATE_PICKER_ABSOLUTE_TAB).first().click({ force: true });
cy.get(DATE_PICKER_ABSOLUTE_INPUT).clear().type(date);
cy.get(DATE_PICKER_ABSOLUTE_INPUT).click().clear().type(date);
};
export const setTimelineEndDate = (date: string) => {