Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Transforms: Serverless functional tests for transform list. #169612

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions x-pack/test_serverless/functional/config.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export function createTestConfig(options: CreateTestConfigOptions) {
indexManagement: {
pathname: '/app/management/data/index_management',
},
transform: {
pathname: '/app/management/data/transform',
},
connectors: {
pathname: '/app/management/insightsAndAlerting/triggersActionsConnectors/',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const deploymentAgnosticFunctionalServices = _.pick(functionalServices, [
'snapshots',
'supertest',
'testSubjects',
'transform',
'toasts',
'uptime',
'usageCollection',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export default ({ loadTestFile }: FtrProviderContext) => {
loadTestFile(require.resolve('./index_management/index_templates'));
loadTestFile(require.resolve('./index_management/indices'));
loadTestFile(require.resolve('./index_management/create_enrich_policy'));
loadTestFile(require.resolve('./transforms/search_bar_features'));
loadTestFile(require.resolve('./transforms/transform_list'));
loadTestFile(require.resolve('./advanced_settings'));
loadTestFile(require.resolve('./data_view_mgmt'));
loadTestFile(require.resolve('./disabled_uis'));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* 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 type { FtrProviderContext } from '../../../../ftr_provider_context';

export default function ({ getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['svlCommonPage', 'svlCommonNavigation']);

const allLabels = [{ search: 'transform', label: 'Data / Transforms', expected: true }];
const expectedLabels = allLabels.filter((l) => l.expected);
const notExpectedLabels = allLabels.filter((l) => !l.expected);

describe('Search bar features', () => {
before(async () => {
await PageObjects.svlCommonPage.login();
});

after(async () => {
await PageObjects.svlCommonPage.forceLogout();
});

describe('list features', () => {
if (expectedLabels.length > 0) {
it('has the correct features enabled', async () => {
await PageObjects.svlCommonNavigation.search.showSearch();

for (const expectedLabel of expectedLabels) {
await PageObjects.svlCommonNavigation.search.searchFor(expectedLabel.search);
const [result] = await PageObjects.svlCommonNavigation.search.getDisplayedResults();
const label = result?.label;
expect(label).to.eql(
expectedLabel.label,
`First result should be ${expectedLabel.label} (got matching items '${label}')`
);
}

await PageObjects.svlCommonNavigation.search.hideSearch();
});
}

if (notExpectedLabels.length > 0) {
it('has the correct features disabled', async () => {
await PageObjects.svlCommonNavigation.search.showSearch();

for (const notExpectedLabel of notExpectedLabels) {
await PageObjects.svlCommonNavigation.search.searchFor(notExpectedLabel.search);
const [result] = await PageObjects.svlCommonNavigation.search.getDisplayedResults();
const label = result?.label;
expect(label).to.not.eql(
notExpectedLabel.label,
`First result should not be ${notExpectedLabel.label} (got matching items '${label}')`
);
}

await PageObjects.svlCommonNavigation.search.hideSearch();
});
}
});
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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(['svlCommonPage', 'common', 'header']);
const browser = getService('browser');
const security = getService('security');
const transform = getService('transform');

describe('Transform List', function () {
before(async () => {
await security.testUser.setRoles(['transform_user']);
await pageObjects.svlCommonPage.login();

// For this test to work, make sure there are no pre-existing transform present.
// For example, solutions might set up transforms automatically.
await transform.api.cleanTransformIndices();
});

it('renders the transform list', async () => {
await transform.testExecution.logTestStep('should load the Transform list page');
await transform.navigation.navigateTo();
await transform.management.assertTransformListPageExists();

const url = await browser.getCurrentUrl();
expect(url).to.contain(`/transform`);

await transform.testExecution.logTestStep('should display the stats bar');
await transform.management.assertTransformStatsBarExists();

await transform.testExecution.logTestStep('should display the "No transforms found" message');
await transform.management.assertNoTransformsFoundMessageExists();

await transform.testExecution.logTestStep(
'should display a disabled "Create first transform" button'
);
await transform.management.assertCreateFirstTransformButtonExists();
await transform.management.assertCreateFirstTransformButtonEnabled(true);
});
});
};