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

[Security solution] Fix flakey Hover Actions test #173114

Closed
wants to merge 9 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,21 @@ import { GLOBAL_SEARCH_BAR_FILTER_ITEM } from '../../../screens/search_bar';
import { DATA_PROVIDERS } from '../../../screens/timeline';

import { login } from '../../../tasks/login';
import { visit } from '../../../tasks/navigation';
import { visitWithTimeRange } from '../../../tasks/navigation';
import { NETWORK_URL } from '../../../urls/navigation';
import {
clickOnAddToTimeline,
clickOnCopyValue,
clickOnFilterIn,
clickOnFilterOut,
clickOnShowTopN,
mouseoverOnToOverflowItem,
openHoverActions,
withHoverActionsReady,
} from '../../../tasks/network/flows';
import { openTimelineUsingToggle } from '../../../tasks/security_main';

const testDomain = 'myTest';

// tracked by https:/elastic/kibana/issues/161874
describe.skip('Hover actions', { tags: ['@ess', '@serverless'] }, () => {
describe('Hover actions', { tags: ['@ess', '@serverless'] }, () => {
const onBeforeLoadCallback = (win: Cypress.AUTWindow) => {
// avoid cypress being held by windows prompt and timeout
cy.stub(win, 'prompt').returns(true);
Expand All @@ -42,9 +40,8 @@ describe.skip('Hover actions', { tags: ['@ess', '@serverless'] }, () => {

beforeEach(() => {
login();
visit(NETWORK_URL, { visitOptions: { onBeforeLoad: onBeforeLoadCallback } });
openHoverActions();
mouseoverOnToOverflowItem();
visitWithTimeRange(NETWORK_URL, { visitOptions: { onBeforeLoad: onBeforeLoadCallback } });
withHoverActionsReady();
});

it('Adds global filter - filter in', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ import {

import { login } from '../../../tasks/login';
import { visitWithTimeRange } from '../../../tasks/navigation';
import { mouseoverOnToOverflowItem, openHoverActions } from '../../../tasks/network/flows';
import { withHoverActionsReady } from '../../../tasks/network/flows';

import { NETWORK_URL } from '../../../urls/navigation';

const testDomainOne = 'myTest';
const testDomainTwo = 'myTest2';

// FLAKY: https:/elastic/kibana/issues/165692
// Tracked by https:/elastic/security-team/issues/7696
describe.skip('Overflow items', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => {
describe('Overflow items', { tags: ['@ess', '@serverless'] }, () => {
context('Network stats and tables', () => {
before(() => {
cy.task('esArchiverLoad', { archiveName: 'network' });
Expand All @@ -41,8 +39,7 @@ describe.skip('Overflow items', { tags: ['@ess', '@serverless', '@brokenInServer
cy.get(SHOW_TOP_FIELD).should('not.exist');
cy.get(COPY).should('not.exist');

openHoverActions();
mouseoverOnToOverflowItem();
withHoverActionsReady();
});

after(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { recurse } from 'cypress-recurse';
import {
ADD_TO_TIMELINE,
COPY,
Expand Down Expand Up @@ -50,3 +51,23 @@ export const clickOnCopyValue = () => {
cy.get(COPY).first().focus();
cy.focused().click(); // eslint-disable-line cypress/unsafe-to-chain-command
};

export function withHoverActionsReady() {
const actionsButtonInPortal = '[data-euiportal="true"] button[data-test-subj*="cellActions"]';
recurse(
() => {
openHoverActions();
mouseoverOnToOverflowItem();
return cy.get('body').then(($body) => {
return $body.find(actionsButtonInPortal);
});
},
// Check if actions portal element is visible
($el) => {
return $el.length > 0;
},
{
delay: 500,
}
);
}