Skip to content

Commit 62474ee

Browse files
committed
adjust test helper
1 parent b27f366 commit 62474ee

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

x-pack/plugins/osquery/cypress/support/e2e.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ declare global {
3333
namespace Cypress {
3434
interface Chainable {
3535
getBySel(...args: Parameters<Cypress.Chainable['get']>): Chainable<JQuery<HTMLElement>>;
36+
findBySel(...args: Parameters<Cypress.Chainable['get']>): Chainable<JQuery<HTMLElement>>;
3637
getBySelContains(
3738
...args: Parameters<Cypress.Chainable['get']>
3839
): Chainable<JQuery<HTMLElement>>;
@@ -50,6 +51,10 @@ Cypress.Commands.add('getBySelContains', (selector, ...args) =>
5051
cy.get(`[data-test-subj^="${selector}"]`, ...args)
5152
);
5253

54+
Cypress.Commands.add('findBySel', (selector, ...args) =>
55+
cy.find(`[data-test-subj="${selector}"]`, ...args)
56+
);
57+
5358
Cypress.Commands.add(
5459
'clickOutside',
5560
() => cy.get('body').click(0, 0) // 0,0 here are the x and y coordinates

x-pack/plugins/osquery/cypress/tasks/live_query.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,7 @@ export const checkResults = () => {
4949
export const typeInECSFieldInput = (text: string, index = 0) =>
5050
cy.getBySel('ECS-field-input').eq(index).type(text);
5151
export const typeInOsqueryFieldInput = (text: string, index = 0) =>
52-
cy
53-
.react('OsqueryColumnFieldComponent')
54-
.eq(index)
55-
.within(() => {
56-
cy.getBySel('comboBoxInput').type(text);
57-
});
52+
cy.react('OsqueryColumnFieldComponent').eq(index).findBySel('comboBoxInput').type(text);
5853

5954
export const getOsqueryFieldTypes = (value: 'Osquery value' | 'Static value', index = 0) => {
6055
cy.getBySel(`osquery-result-type-select-${index}`).click();

0 commit comments

Comments
 (0)