mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Painless Lab] Add basic functional smoke tests for both serverless and stateful (#172679)
This commit is contained in:
parent
f5c78b966b
commit
7ea0b232ab
8 changed files with 159 additions and 0 deletions
|
@ -307,6 +307,7 @@ enabled:
|
|||
- x-pack/test/functional/apps/ml/stack_management_jobs/config.ts
|
||||
- x-pack/test/functional/apps/monitoring/config.ts
|
||||
- x-pack/test/functional/apps/observability_log_explorer/config.ts
|
||||
- x-pack/test/functional/apps/painless_lab/config.ts
|
||||
- x-pack/test/functional/apps/remote_clusters/config.ts
|
||||
- x-pack/test/functional/apps/reporting_management/config.ts
|
||||
- x-pack/test/functional/apps/rollup_job/config.ts
|
||||
|
|
17
x-pack/test/functional/apps/painless_lab/config.ts
Normal file
17
x-pack/test/functional/apps/painless_lab/config.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* 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 { FtrConfigProviderContext } from '@kbn/test';
|
||||
|
||||
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
||||
const functionalConfig = await readConfigFile(require.resolve('../../config.base.js'));
|
||||
|
||||
return {
|
||||
...functionalConfig.getAll(),
|
||||
testFiles: [require.resolve('.')],
|
||||
};
|
||||
}
|
14
x-pack/test/functional/apps/painless_lab/index.ts
Normal file
14
x-pack/test/functional/apps/painless_lab/index.ts
Normal file
|
@ -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 ({ loadTestFile }: FtrProviderContext) => {
|
||||
describe('Painless lab app', function () {
|
||||
loadTestFile(require.resolve('./painless_lab'));
|
||||
});
|
||||
};
|
53
x-pack/test/functional/apps/painless_lab/painless_lab.ts
Normal file
53
x-pack/test/functional/apps/painless_lab/painless_lab.ts
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* 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';
|
||||
|
||||
const TEST_SCRIPT_RESULT = 45;
|
||||
const TEST_SCRIPT = `
|
||||
int total = 0;
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
total += i;
|
||||
}
|
||||
|
||||
return total;
|
||||
`.trim();
|
||||
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const retry = getService('retry');
|
||||
const PageObjects = getPageObjects(['common', 'console', 'header']);
|
||||
const testSubjects = getService('testSubjects');
|
||||
const monacoEditor = getService('monacoEditor');
|
||||
|
||||
describe('Painless lab', function describeIndexTests() {
|
||||
before(async () => {
|
||||
await PageObjects.common.navigateToApp('dev_tools', { hash: '/painless_lab' });
|
||||
await retry.waitFor('Wait for editor to be visible', async () => {
|
||||
return testSubjects.isDisplayed('painless_lab');
|
||||
});
|
||||
});
|
||||
|
||||
it('should show the editor and preview panels', async () => {
|
||||
const editor = await testSubjects.find('kibanaCodeEditor');
|
||||
const preview = await testSubjects.find('painlessTabs');
|
||||
|
||||
expect(await editor.isDisplayed()).to.be(true);
|
||||
expect(await preview.isDisplayed()).to.be(true);
|
||||
});
|
||||
|
||||
it('executes the script and shows the right result', async () => {
|
||||
await monacoEditor.setCodeEditorValue(TEST_SCRIPT);
|
||||
|
||||
await retry.try(async () => {
|
||||
const result = await testSubjects.find('painlessTabs');
|
||||
expect(await result.getVisibleText()).to.contain(TEST_SCRIPT_RESULT.toString());
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
|
@ -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 - Painless lab', function () {
|
||||
loadTestFile(require.resolve('./painless_lab'));
|
||||
});
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* 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';
|
||||
|
||||
const TEST_SCRIPT_RESULT = 45;
|
||||
const TEST_SCRIPT = `
|
||||
int total = 0;
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
total += i;
|
||||
}
|
||||
|
||||
return total;
|
||||
`.trim();
|
||||
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const retry = getService('retry');
|
||||
const PageObjects = getPageObjects(['common', 'console', 'header', 'svlCommonPage']);
|
||||
const testSubjects = getService('testSubjects');
|
||||
const monacoEditor = getService('monacoEditor');
|
||||
|
||||
describe('Painless lab', function describeIndexTests() {
|
||||
before(async () => {
|
||||
await PageObjects.svlCommonPage.login();
|
||||
await PageObjects.common.navigateToApp('dev_tools', { hash: '/painless_lab' });
|
||||
await retry.waitFor('Wait for editor to be visible', async () => {
|
||||
return testSubjects.isDisplayed('painless_lab');
|
||||
});
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await PageObjects.svlCommonPage.forceLogout();
|
||||
});
|
||||
|
||||
it('should show the editor and preview panels', async () => {
|
||||
const editor = await testSubjects.find('kibanaCodeEditor');
|
||||
const preview = await testSubjects.find('painlessTabs');
|
||||
|
||||
expect(await editor.isDisplayed()).to.be(true);
|
||||
expect(await preview.isDisplayed()).to.be(true);
|
||||
});
|
||||
|
||||
it('executes the script and shows the right result', async () => {
|
||||
await monacoEditor.setCodeEditorValue(TEST_SCRIPT);
|
||||
|
||||
await retry.try(async () => {
|
||||
const result = await testSubjects.find('painlessTabs');
|
||||
expect(await result.getVisibleText()).to.contain(TEST_SCRIPT_RESULT.toString());
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
|
@ -19,6 +19,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|||
require.resolve('../../common/reporting'),
|
||||
require.resolve('../../common/grok_debugger'),
|
||||
require.resolve('../../common/console'),
|
||||
require.resolve('../../common/painless_lab'),
|
||||
],
|
||||
junit: {
|
||||
reportName: 'Serverless Observability Functional Tests - Common Group 1',
|
||||
|
|
|
@ -19,6 +19,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|||
require.resolve('../../common/reporting'),
|
||||
require.resolve('../../common/grok_debugger'),
|
||||
require.resolve('../../common/console'),
|
||||
require.resolve('../../common/painless_lab'),
|
||||
],
|
||||
junit: {
|
||||
reportName: 'Serverless Security Functional Tests - Common Group 1',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue