[8.11] [Security Solution] Adds serverless specific tests for pinned_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)](https://github.com/elastic/kibana/pull/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":"gloria.hornero@elastic.co"},"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 <gloria.hornero@elastic.co>
This commit is contained in:
Kibana Machine 2023-10-23 15:00:22 -04:00 committed by GitHub
parent 10016d7fb9
commit 09f6923e7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 1 deletions

View file

@ -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*');
});
@ -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');
});
});

View file

@ -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);
};