-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Transforms: Serverless functional tests for transform list. (#16…
…9612) Adds basic functional tests for serverless for the transform list. Since transforms are available in all project types, this adds the tests to `common` so they are run in all three project types. - Navigates to the empty transform list and asserts the page. - Checks `transform` is available as a search feature.
- Loading branch information
Showing
5 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...est_serverless/functional/test_suites/common/management/transforms/search_bar_features.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
} | ||
}); | ||
}); | ||
} |
48 changes: 48 additions & 0 deletions
48
x-pack/test_serverless/functional/test_suites/common/management/transforms/transform_list.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); | ||
}; |