forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Transforms: Add functional tests for UI permissions (elastic#106693
) * [ML] Transforms: Add functional tests for UI permissions * [ML] Fix for edit flyout action * [ML] Stabilize tests that open the actions menu
- Loading branch information
1 parent
d796576
commit 09bb1a1
Showing
13 changed files
with
480 additions
and
74 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
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
187 changes: 187 additions & 0 deletions
187
x-pack/test/functional/apps/transform/permissions/full_transform_access.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,187 @@ | ||
/* | ||
* 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 { getPivotTransformConfig } from '../index'; | ||
|
||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
|
||
export default function ({ getService }: FtrProviderContext) { | ||
const esArchiver = getService('esArchiver'); | ||
const transform = getService('transform'); | ||
|
||
describe('for user with full transform access', function () { | ||
describe('with no data loaded', function () { | ||
before(async () => { | ||
await transform.securityUI.loginAsTransformPowerUser(); | ||
}); | ||
|
||
after(async () => { | ||
await transform.securityUI.logout(); | ||
}); | ||
|
||
it('should display elements in the Transform list page correctly', async () => { | ||
await transform.testExecution.logTestStep('should load the Transform list page'); | ||
await transform.navigation.navigateTo(); | ||
await transform.management.assertTransformListPageExists(); | ||
|
||
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 an enabled "Create first transform" button' | ||
); | ||
await transform.management.assertCreateFirstTransformButtonExists(); | ||
await transform.management.assertCreateFirstTransformButtonEnabled(true); | ||
}); | ||
}); | ||
|
||
describe('with data loaded', function () { | ||
const PREFIX = 'permissions_full_access'; | ||
const transformConfigWithPivot = getPivotTransformConfig(PREFIX, false); | ||
|
||
before(async () => { | ||
await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ecommerce'); | ||
await transform.testResources.createIndexPatternIfNeeded('ft_ecommerce', 'order_date'); | ||
|
||
await transform.api.createAndRunTransform( | ||
transformConfigWithPivot.id, | ||
transformConfigWithPivot | ||
); | ||
|
||
await transform.testResources.setKibanaTimeZoneToUTC(); | ||
await transform.securityUI.loginAsTransformPowerUser(); | ||
}); | ||
|
||
after(async () => { | ||
await transform.testResources.deleteIndexPatternByTitle( | ||
transformConfigWithPivot.dest.index | ||
); | ||
await transform.api.deleteIndices(transformConfigWithPivot.dest.index); | ||
await transform.api.cleanTransformIndices(); | ||
}); | ||
|
||
it('should display elements in the Transform list page correctly', async () => { | ||
await transform.testExecution.logTestStep('should load the Transform list page'); | ||
await transform.navigation.navigateTo(); | ||
await transform.management.assertTransformListPageExists(); | ||
|
||
await transform.testExecution.logTestStep('should display the stats bar'); | ||
await transform.management.assertTransformStatsBarExists(); | ||
|
||
await transform.testExecution.logTestStep('should display the transforms table'); | ||
await transform.management.assertTransformsTableExists(); | ||
|
||
await transform.testExecution.logTestStep( | ||
'should display an enabled "Create a transform" button' | ||
); | ||
await transform.management.assertCreateNewTransformButtonExists(); | ||
await transform.management.assertCreateNewTransformButtonEnabled(true); | ||
|
||
await transform.testExecution.logTestStep( | ||
'should display the expected transform in the transform list' | ||
); | ||
await transform.table.refreshTransformList(); | ||
await transform.table.filterWithSearchString(transformConfigWithPivot.id, 1); | ||
|
||
await transform.testExecution.logTestStep('should show the actions popover'); | ||
await transform.table.assertTransformRowActionsButtonEnabled( | ||
transformConfigWithPivot.id, | ||
true | ||
); | ||
await transform.table.assertTransformRowActions(transformConfigWithPivot.id, false); | ||
|
||
await transform.testExecution.logTestStep('should have the edit action enabled'); | ||
await transform.table.assertTransformRowActionEnabled( | ||
transformConfigWithPivot.id, | ||
'Edit', | ||
true | ||
); | ||
|
||
await transform.testExecution.logTestStep('should have the clone action enabled'); | ||
await transform.table.assertTransformRowActionEnabled( | ||
transformConfigWithPivot.id, | ||
'Clone', | ||
true | ||
); | ||
await transform.testExecution.logTestStep('should have the delete action enabled'); | ||
await transform.table.assertTransformRowActionEnabled( | ||
transformConfigWithPivot.id, | ||
'Delete', | ||
true | ||
); | ||
await transform.testExecution.logTestStep('should have the Discover action disabled'); | ||
await transform.table.assertTransformRowActionEnabled( | ||
transformConfigWithPivot.id, | ||
'Discover', | ||
false | ||
); | ||
await transform.testExecution.logTestStep('should have the start action disabled'); | ||
await transform.table.assertTransformRowActionEnabled( | ||
transformConfigWithPivot.id, | ||
'Start', | ||
false | ||
); | ||
|
||
await transform.testExecution.logTestStep('should show content in the expanded table row'); | ||
await transform.table.assertTransformExpandedRow(); | ||
}); | ||
|
||
it('should display controls in the edit flyout correctly', async () => { | ||
await transform.testExecution.logTestStep('should show the edit flyout'); | ||
await transform.table.clickTransformRowAction(transformConfigWithPivot.id, 'Edit'); | ||
await transform.editFlyout.assertTransformEditFlyoutExists(); | ||
|
||
await transform.testExecution.logTestStep('should have the description input enabled'); | ||
await transform.editFlyout.assertTransformEditFlyoutInputEnabled('Description', true); | ||
|
||
await transform.testExecution.logTestStep('should have the frequency input enabled'); | ||
await transform.editFlyout.assertTransformEditFlyoutInputEnabled('Frequency', true); | ||
|
||
await transform.testExecution.logTestStep('should have the destination inputs enabled'); | ||
await transform.editFlyout.openTransformEditAccordionDestinationSettings(); | ||
await transform.editFlyout.assertTransformEditFlyoutInputEnabled('DestinationIndex', true); | ||
await transform.editFlyout.assertTransformEditFlyoutInputEnabled( | ||
'DestinationPipeline', | ||
true | ||
); | ||
|
||
await transform.testExecution.logTestStep( | ||
'should have the retention policy inputs enabled' | ||
); | ||
await transform.editFlyout.openTransformEditAccordionRetentionPolicySettings(); | ||
await transform.editFlyout.assertTransformEditFlyoutInputEnabled( | ||
'RetentionPolicyField', | ||
true | ||
); | ||
await transform.editFlyout.assertTransformEditFlyoutInputEnabled( | ||
'RetentionPolicyMaxAge', | ||
true | ||
); | ||
|
||
await transform.testExecution.logTestStep( | ||
'should have the advanced settings inputs enabled' | ||
); | ||
await transform.editFlyout.openTransformEditAccordionAdvancedSettings(); | ||
await transform.editFlyout.assertTransformEditFlyoutInputEnabled('DocsPerSecond', true); | ||
await transform.editFlyout.assertTransformEditFlyoutInputEnabled('MaxPageSearchSize', true); | ||
|
||
await transform.testExecution.logTestStep( | ||
'should have the update button enabled after making an edit' | ||
); | ||
await transform.editFlyout.assertTransformEditFlyoutInputExists('Frequency'); | ||
await transform.editFlyout.setTransformEditFlyoutInputValue('Frequency', '10m'); | ||
await transform.editFlyout.assertUpdateTransformButtonExists(); | ||
await transform.editFlyout.assertUpdateTransformButtonEnabled(true); | ||
}); | ||
}); | ||
}); | ||
} |
15 changes: 15 additions & 0 deletions
15
x-pack/test/functional/apps/transform/permissions/index.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,15 @@ | ||
/* | ||
* 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('permissions', function () { | ||
loadTestFile(require.resolve('./full_transform_access')); | ||
loadTestFile(require.resolve('./read_transform_access')); | ||
}); | ||
} |
Oops, something went wrong.