Skip to content

Commit

Permalink
[Grok Debugger] Add functional serverless tests (elastic#172545)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabarasaba authored Dec 5, 2023
1 parent 55aca66 commit 727fb13
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* 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.
*/

import expect from '@kbn/expect';

import { FtrProviderContext } from '../../../ftr_provider_context';

export default ({ getPageObjects, getService }: FtrProviderContext) => {
const PageObjects = getPageObjects(['common', 'grokDebugger']);
const browser = getService('browser');
const security = getService('security');
const testSubjects = getService('testSubjects');
const retry = getService('retry');

describe('Grok Debugger', function () {
before(async () => {
// Increase window height to ensure "Simulate" button is shown above the
// fold. Otherwise it can't be clicked by the browser driver.
await browser.setWindowSize(1600, 1000);
await security.testUser.setRoles(['global_devtools_read', 'ingest_pipelines_user']);
await PageObjects.common.navigateToApp('dev_tools', { hash: '/grokdebugger' });
await retry.waitFor('Grok Debugger Header to be visible', async () => {
return testSubjects.isDisplayed('grokDebuggerContainer');
});
});

after(async () => {
await security.testUser.restoreDefaults();
});

it('Loads the app', async () => {
await retry.waitForWithTimeout('Grok Debugger to be visible', 15000, async () => {
return await (await PageObjects.grokDebugger.simulateButton()).isDisplayed();
});
});

it('Accept and parse input with built-in grok pattern', async () => {
const eventInput = 'SegerCommaBob';
const patternInput = '%{USERNAME:u}';
const response = await PageObjects.grokDebugger.executeGrokSimulation(
eventInput,
patternInput,
null
);
expect(response).to.eql({ u: 'SegerCommaBob' });
});
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* 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.
*/

import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('Serverless Common UI - Grok debugger', function () {
loadTestFile(require.resolve('./grok_debugger'));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('../../common/management'),
require.resolve('../../common/platform_security'),
require.resolve('../../common/reporting'),
require.resolve('../../common/grok_debugger'),
],
junit: {
reportName: 'Serverless Observability Functional Tests - Common Group 1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
require.resolve('../../common/management'),
require.resolve('../../common/platform_security'),
require.resolve('../../common/reporting'),
require.resolve('../../common/grok_debugger'),
],
junit: {
reportName: 'Serverless Security Functional Tests - Common Group 1',
Expand Down

0 comments on commit 727fb13

Please sign in to comment.