Skip to content

Commit

Permalink
[8.11] [Security Solution] Adds serverless specific tests for `pinned…
Browse files Browse the repository at this point in the history
…_filters` functionality (#169472) (#169561)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Security Solution] Adds serverless specific tests for
`pinned_filters` functionality
(#169472)](#169472)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Gloria
Hornero","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-10-23T17:47:17Z","message":"[Security
Solution] Adds serverless specific tests for `pinned_filters`
functionality
(#169472)","sha":"14e636608bab799494a93f8cba53cae2316e649b","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat
Hunting","Team: SecuritySolution","Team:Threat
Hunting:Explore","v8.11.0","v8.12.0"],"number":169472,"url":"https://github.com/elastic/kibana/pull/169472","mergeCommit":{"message":"[Security
Solution] Adds serverless specific tests for `pinned_filters`
functionality
(#169472)","sha":"14e636608bab799494a93f8cba53cae2316e649b"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/169472","number":169472,"mergeCommit":{"message":"[Security
Solution] Adds serverless specific tests for `pinned_filters`
functionality
(#169472)","sha":"14e636608bab799494a93f8cba53cae2316e649b"}}]}]
BACKPORT-->

Co-authored-by: Gloria Hornero <[email protected]>
  • Loading branch information
kibanamachine and MadameSheema authored Oct 23, 2023
1 parent 10016d7 commit 09f6923
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ import {
} from '../../../tasks/kibana_navigation';
import { ALERTS_PAGE } from '../../../screens/kibana_navigation';
import { postDataView } from '../../../tasks/common';
import { navigateToAlertsPageInServerless } from '../../../tasks/serverless/navigation';

describe('pinned filters', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => {
describe('ESS - pinned filters', { tags: ['@ess'] }, () => {
before(() => {
postDataView('audit*');
});
Expand Down Expand Up @@ -52,3 +53,31 @@ describe('pinned filters', { tags: ['@ess', '@serverless', '@brokenInServerless'
cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM).should('not.exist');
});
});

describe('SERVERLESS - pinned filters', { tags: ['@serverless'] }, () => {
before(() => {
postDataView('audit*');
});

beforeEach(() => {
login();
});

it('show pinned filters on security', () => {
visit(DISCOVER_WITH_PINNED_FILTER_URL);

cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM).find(GLOBAL_SEARCH_BAR_PINNED_FILTER).should('exist');
navigateToAlertsPageInServerless();

cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM).should('have.text', 'host.name: test-host');
});

it('does not show discover filters on security', () => {
visit(DISCOVER_WITH_FILTER_URL);
cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM).should('exist');

navigateToAlertsPageInServerless();

cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM).should('not.exist');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

const serverlessLocator = {
alerts: '[data-test-subj="solutionSideNavItemLink-alerts"]',
};

const navigateTo = (page: string) => {
cy.get(page).click();
};

export const navigateToAlertsPageInServerless = () => {
navigateTo(serverlessLocator.alerts);
};

0 comments on commit 09f6923

Please sign in to comment.