Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes flakiness #62406

Merged
merged 3 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 40 additions & 37 deletions x-pack/legacy/plugins/siem/cypress/integration/detections.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,47 +42,49 @@ describe('Detections', () => {
cy.get(NUMBER_OF_SIGNALS)
.invoke('text')
.then(numberOfSignals => {
cy.get(SHOWING_SIGNALS)
.invoke('text')
.should('eql', `Showing ${numberOfSignals} signals`);
cy.get(SHOWING_SIGNALS).should('have.text', `Showing ${numberOfSignals} signals`);

const numberOfSignalsToBeClosed = 3;
selectNumberOfSignals(numberOfSignalsToBeClosed);

cy.get(SELECTED_SIGNALS)
.invoke('text')
.should('eql', `Selected ${numberOfSignalsToBeClosed} signals`);
cy.get(SELECTED_SIGNALS).should(
'have.text',
`Selected ${numberOfSignalsToBeClosed} signals`
);

closeSignals();
waitForSignals();
cy.reload();
waitForSignals();

const expectedNumberOfSignalsAfterClosing = +numberOfSignals - numberOfSignalsToBeClosed;
cy.get(NUMBER_OF_SIGNALS)
.invoke('text')
.should('eq', expectedNumberOfSignalsAfterClosing.toString());
cy.get(SHOWING_SIGNALS)
.invoke('text')
.should('eql', `Showing ${expectedNumberOfSignalsAfterClosing.toString()} signals`);
cy.get(NUMBER_OF_SIGNALS).should(
'have.text',
expectedNumberOfSignalsAfterClosing.toString()
);

cy.get(SHOWING_SIGNALS).should(
'have.text',
`Showing ${expectedNumberOfSignalsAfterClosing.toString()} signals`
);

goToClosedSignals();
waitForSignals();

cy.get(NUMBER_OF_SIGNALS)
.invoke('text')
.should('eql', numberOfSignalsToBeClosed.toString());
cy.get(SHOWING_SIGNALS)
.invoke('text')
.should('eql', `Showing ${numberOfSignalsToBeClosed.toString()} signals`);
cy.get(NUMBER_OF_SIGNALS).should('have.text', numberOfSignalsToBeClosed.toString());
cy.get(SHOWING_SIGNALS).should(
'have.text',
`Showing ${numberOfSignalsToBeClosed.toString()} signals`
);
cy.get(SIGNALS).should('have.length', numberOfSignalsToBeClosed);

const numberOfSignalsToBeOpened = 1;
selectNumberOfSignals(numberOfSignalsToBeOpened);

cy.get(SELECTED_SIGNALS)
.invoke('text')
.should('eql', `Selected ${numberOfSignalsToBeOpened} signal`);
cy.get(SELECTED_SIGNALS).should(
'have.text',
`Selected ${numberOfSignalsToBeOpened} signal`
);

openSignals();
waitForSignals();
Expand All @@ -93,29 +95,30 @@ describe('Detections', () => {
waitForSignals();

const expectedNumberOfClosedSignalsAfterOpened = 2;
cy.get(NUMBER_OF_SIGNALS)
.invoke('text')
.should('eql', expectedNumberOfClosedSignalsAfterOpened.toString());
cy.get(SHOWING_SIGNALS)
.invoke('text')
.should(
'eql',
`Showing ${expectedNumberOfClosedSignalsAfterOpened.toString()} signals`
);
cy.get(NUMBER_OF_SIGNALS).should(
'have.text',
expectedNumberOfClosedSignalsAfterOpened.toString()
);
cy.get(SHOWING_SIGNALS).should(
'have.text',
`Showing ${expectedNumberOfClosedSignalsAfterOpened.toString()} signals`
);
cy.get(SIGNALS).should('have.length', expectedNumberOfClosedSignalsAfterOpened);

goToOpenedSignals();
waitForSignals();

const expectedNumberOfOpenedSignals =
+numberOfSignals - expectedNumberOfClosedSignalsAfterOpened;
cy.get(SHOWING_SIGNALS)
.invoke('text')
.should('eql', `Showing ${expectedNumberOfOpenedSignals.toString()} signals`);

cy.get('[data-test-subj="server-side-event-count"]')
.invoke('text')
.should('eql', expectedNumberOfOpenedSignals.toString());
cy.get(SHOWING_SIGNALS).should(
'have.text',
`Showing ${expectedNumberOfOpenedSignals.toString()} signals`
);

cy.get('[data-test-subj="server-side-event-count"]').should(
'have.text',
expectedNumberOfOpenedSignals.toString()
);
});
});

Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/siem/cypress/screens/detections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const LOADING_SIGNALS_PANEL = '[data-test-subj="loading-signals-panel"]';

export const MANAGE_SIGNAL_DETECTION_RULES_BTN = '[data-test-subj="manage-signal-detection-rules"]';

export const NUMBER_OF_SIGNALS = '[data-test-subj="server-side-event-count"]';
export const NUMBER_OF_SIGNALS = '[data-test-subj="server-side-event-count"] .euiBadge__text';

export const OPEN_CLOSE_SIGNAL_BTN = '[data-test-subj="update-signal-status-button"]';

Expand Down