mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
# Backport This will backport the following commits from `main` to `8.11`: - [[Security Solituon] Unskip search bar Serverless Cypress tests (#169347)](https://github.com/elastic/kibana/pull/169347) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Maxim Palenov","email":"maxim.palenov@elastic.co"},"sourceCommit":{"committedDate":"2023-10-25T09:24:32Z","message":"[Security Solituon] Unskip search bar Serverless Cypress tests (#169347)\n\n**Addreses:** https://github.com/elastic/kibana/issues/161540\r\n\r\n## Summary\r\n\r\nThis PR unskips `search_bar.cy.ts` Serverless Cypress tests.\r\n\r\n## Details\r\n\r\nBesides just unskipping `search_bar.cy.ts` this PR also makes sure the test isn't flaky by making `operator` required in `fillAddFilterForm()`. It turned out the test works only if the Cypress window is in focus when an operator isn't set. Such behavior can lead to test flakiness in CI. This way choosing an operator via keyboard is a safer option.\r\n\r\n## Flaky test runner\r\n\r\n`search_bar.cy.ts` [150 runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3614)","sha":"906987c2860b53b91d449bc164957857adddc06a","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","v8.11.0","v8.12.0"],"number":169347,"url":"https://github.com/elastic/kibana/pull/169347","mergeCommit":{"message":"[Security Solituon] Unskip search bar Serverless Cypress tests (#169347)\n\n**Addreses:** https://github.com/elastic/kibana/issues/161540\r\n\r\n## Summary\r\n\r\nThis PR unskips `search_bar.cy.ts` Serverless Cypress tests.\r\n\r\n## Details\r\n\r\nBesides just unskipping `search_bar.cy.ts` this PR also makes sure the test isn't flaky by making `operator` required in `fillAddFilterForm()`. It turned out the test works only if the Cypress window is in focus when an operator isn't set. Such behavior can lead to test flakiness in CI. This way choosing an operator via keyboard is a safer option.\r\n\r\n## Flaky test runner\r\n\r\n`search_bar.cy.ts` [150 runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3614)","sha":"906987c2860b53b91d449bc164957857adddc06a"}},"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/169347","number":169347,"mergeCommit":{"message":"[Security Solituon] Unskip search bar Serverless Cypress tests (#169347)\n\n**Addreses:** https://github.com/elastic/kibana/issues/161540\r\n\r\n## Summary\r\n\r\nThis PR unskips `search_bar.cy.ts` Serverless Cypress tests.\r\n\r\n## Details\r\n\r\nBesides just unskipping `search_bar.cy.ts` this PR also makes sure the test isn't flaky by making `operator` required in `fillAddFilterForm()`. It turned out the test works only if the Cypress window is in focus when an operator isn't set. Such behavior can lead to test flakiness in CI. This way choosing an operator via keyboard is a safer option.\r\n\r\n## Flaky test runner\r\n\r\n`search_bar.cy.ts` [150 runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3614)","sha":"906987c2860b53b91d449bc164957857adddc06a"}}]}] BACKPORT--> Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
This commit is contained in:
parent
028a9fd940
commit
86a86dda67
5 changed files with 9 additions and 14 deletions
|
@ -23,8 +23,7 @@ import { getHostIpFilter } from '../../objects/filter';
|
|||
import { hostsUrl } from '../../urls/navigation';
|
||||
import { waitForAllHostsToBeLoaded } from '../../tasks/hosts/all_hosts';
|
||||
|
||||
// FLAKY: https://github.com/elastic/kibana/issues/165637
|
||||
describe('SearchBar', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => {
|
||||
describe('SearchBar', { tags: ['@ess', '@serverless'] }, () => {
|
||||
beforeEach(() => {
|
||||
login();
|
||||
visit(hostsUrl('allHosts'));
|
||||
|
|
|
@ -360,6 +360,7 @@ describe(`Detections : Page Filters`, { tags: ['@ess', '@brokenInServerless'] },
|
|||
openAddFilterPopover();
|
||||
fillAddFilterForm({
|
||||
key: 'kibana.alert.workflow_status',
|
||||
operator: 'is',
|
||||
value: 'invalid',
|
||||
});
|
||||
waitForPageFilters();
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
|
||||
export interface SearchBarFilter {
|
||||
key: string;
|
||||
operator: 'is' | 'is not' | 'is one of' | 'is not one of' | 'exists' | 'does not exist';
|
||||
value?: string;
|
||||
operator?: 'is' | 'is not' | 'is one of' | 'is not one of' | 'exists' | 'does not exist';
|
||||
}
|
||||
|
||||
export const getHostIpFilter = (): SearchBarFilter => ({
|
||||
key: 'host.ip',
|
||||
operator: 'is',
|
||||
value: '1.1.1.1',
|
||||
});
|
||||
|
|
|
@ -26,9 +26,6 @@ export const ADD_FILTER_FORM_FIELD_OPTION = (value: string) =>
|
|||
export const ADD_FILTER_FORM_OPERATOR_FIELD =
|
||||
'[data-test-subj="filterOperatorList"] input[data-test-subj="comboBoxSearchInput"]';
|
||||
|
||||
export const ADD_FILTER_FORM_OPERATOR_OPTION_IS =
|
||||
'[data-test-subj="comboBoxOptionsList filterOperatorList-optionsList"] button[title="is"]';
|
||||
|
||||
export const ADD_FILTER_FORM_FILTER_VALUE_INPUT = '[data-test-subj="filterParams"] input';
|
||||
|
||||
export const ADD_FILTER_FORM_SAVE_BUTTON = '[data-test-subj="saveFilter"]';
|
||||
|
|
|
@ -13,7 +13,6 @@ import {
|
|||
GLOBAL_SEARCH_BAR_SUBMIT_BUTTON,
|
||||
ADD_FILTER_FORM_SAVE_BUTTON,
|
||||
ADD_FILTER_FORM_FIELD_INPUT,
|
||||
ADD_FILTER_FORM_OPERATOR_OPTION_IS,
|
||||
ADD_FILTER_FORM_OPERATOR_FIELD,
|
||||
ADD_FILTER_FORM_FILTER_VALUE_INPUT,
|
||||
GLOBAL_KQL_INPUT,
|
||||
|
@ -53,19 +52,17 @@ export const removeKqlFilter = () => {
|
|||
});
|
||||
};
|
||||
|
||||
export const fillAddFilterForm = ({ key, value, operator }: SearchBarFilter) => {
|
||||
export const fillAddFilterForm = ({ key, operator, value }: SearchBarFilter) => {
|
||||
cy.get(ADD_FILTER_FORM_FIELD_INPUT).should('exist');
|
||||
cy.get(ADD_FILTER_FORM_FIELD_INPUT).should('be.visible');
|
||||
cy.get(ADD_FILTER_FORM_FIELD_INPUT).type(`${key}{downarrow}{enter}`);
|
||||
if (!operator) {
|
||||
cy.get(ADD_FILTER_FORM_OPERATOR_FIELD).click();
|
||||
cy.get(ADD_FILTER_FORM_OPERATOR_OPTION_IS).click();
|
||||
} else {
|
||||
cy.get(ADD_FILTER_FORM_OPERATOR_FIELD).type(`${operator}{enter}`);
|
||||
}
|
||||
|
||||
cy.get(ADD_FILTER_FORM_OPERATOR_FIELD).type(`${operator}{downarrow}{enter}`);
|
||||
|
||||
if (value) {
|
||||
cy.get(ADD_FILTER_FORM_FILTER_VALUE_INPUT).type(value);
|
||||
}
|
||||
|
||||
cy.get(ADD_FILTER_FORM_SAVE_BUTTON).click();
|
||||
cy.get(ADD_FILTER_FORM_SAVE_BUTTON).should('not.exist');
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue