Skip to content

Commit

Permalink
[ML] Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 committed Sep 24, 2020
1 parent 3d99c0f commit 55574f9
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@ export const StepDetailsSummary: FC<StepDetailsExposedState> = React.memo((props
paddingSize="s"
>
<EuiFormRow
data-test-subj={'transformWizardAdvancedSettingsFrequencyLabel'}
label={i18n.translate('xpack.transform.stepDetailsSummary.frequencyLabel', {
defaultMessage: 'Frequency',
})}
>
<span>{transformFrequency}</span>
</EuiFormRow>
<EuiFormRow
data-test-subj={'transformWizardAdvancedSettingsMaxPageSearchSizeLabel'}
label={i18n.translate('xpack.transform.stepDetailsSummary.maxPageSearchSizeLabel', {
defaultMessage: 'Maximum page search size',
})}
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/ml/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('settings', function () {
this.tags(['quynh', 'skipFirefox']);
this.tags(['skipFirefox']);

loadTestFile(require.resolve('./calendar_creation'));
loadTestFile(require.resolve('./calendar_edit'));
Expand Down
15 changes: 14 additions & 1 deletion x-pack/test/functional/apps/transform/cloning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ function getTransformConfig(): TransformPivotConfig {
},
description:
'ecommerce batch transform with avg(products.base_price) grouped by terms(category.keyword)',
frequency: '3s',
settings: {
max_page_search_size: 250,
},
dest: { index: `user-ec_2_${date}` },
};
}
Expand Down Expand Up @@ -155,7 +159,7 @@ export default function ({ getService }: FtrProviderContext) {

await transform.testExecution.logTestStep('should input the transform description');
await transform.wizard.assertTransformDescriptionInputExists();
await transform.wizard.assertTransformDescriptionValue('');
await transform.wizard.assertTransformDescriptionValue(transformConfig.description!);
await transform.wizard.setTransformDescription(testData.transformDescription);

await transform.testExecution.logTestStep('should input the destination index');
Expand All @@ -173,6 +177,15 @@ export default function ({ getService }: FtrProviderContext) {
await transform.wizard.assertContinuousModeSwitchExists();
await transform.wizard.assertContinuousModeSwitchCheckState(false);

await transform.testExecution.logTestStep(
'should display the advanced settings and show pre-filled configuration'
);
await transform.wizard.openTransformAdvancedSettingsAccordion();
await transform.wizard.assertTransformFrequencyValue(transformConfig.frequency!);
await transform.wizard.assertTransformMaxPageSearchSizeValue(
transformConfig.settings!.max_page_search_size!
);

await transform.testExecution.logTestStep('should load the create step');
await transform.wizard.advanceToCreateStep();

Expand Down
47 changes: 47 additions & 0 deletions x-pack/test/functional/services/transform/wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,53 @@ export function TransformWizardProvider({ getService }: FtrProviderContext) {
);
},

async assertTransformAdvancedSettingsAccordionExists() {
await testSubjects.existOrFail('transformWizardAccordionAdvancedSettings');
},

// for now we expect this to be used only for opening the accordion
async openTransformAdvancedSettingsAccordion() {
await this.assertTransformAdvancedSettingsAccordionExists();
await testSubjects.click('transformWizardAccordionAdvancedSettings');
await this.assertTransformFrequencyInputExists();
await this.assertTransformMaxPageSearchSizeInputExists();
},

async assertTransformFrequencyInputExists() {
await testSubjects.existOrFail('transformFrequencyInput');
expect(await testSubjects.isDisplayed('transformFrequencyInput')).to.eql(
true,
`Expected 'Frequency' input to be displayed`
);
},

async assertTransformFrequencyValue(expectedValue: string) {
const actualValue = await testSubjects.getAttribute('transformFrequencyInput', 'value');
expect(actualValue).to.eql(
expectedValue,
`Transform frequency input text should be '${expectedValue}' (got '${actualValue}')`
);
},

async assertTransformMaxPageSearchSizeInputExists() {
await testSubjects.existOrFail('transformMaxPageSearchSizeInput');
expect(await testSubjects.isDisplayed('transformMaxPageSearchSizeInput')).to.eql(
true,
`Expected 'Maximum page search size' input to be displayed`
);
},

async assertTransformMaxPageSearchSizeValue(expectedValue: number) {
const actualValue = await testSubjects.getAttribute(
'transformMaxPageSearchSizeInput',
'value'
);
expect(actualValue).to.eql(
expectedValue,
`Transform maximum page search size input text should be '${expectedValue}' (got '${actualValue}')`
);
},

async assertCreateAndStartButtonExists() {
await testSubjects.existOrFail('transformWizardCreateAndStartButton');
expect(await testSubjects.isDisplayed('transformWizardCreateAndStartButton')).to.eql(
Expand Down

0 comments on commit 55574f9

Please sign in to comment.