Skip to content

Commit 1b9653d

Browse files
committed
Add create transform test
1 parent 2ecaa2a commit 1b9653d

File tree

3 files changed

+248
-0
lines changed

3 files changed

+248
-0
lines changed
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
import expect from '@kbn/expect';
7+
8+
import { FtrProviderContext } from '../../ftr_provider_context';
9+
10+
interface GroupByEntry {
11+
identifier: string;
12+
label: string;
13+
intervalLabel?: string;
14+
}
15+
16+
export default function({ getService }: FtrProviderContext) {
17+
// const esArchiver = getService('esArchiver');
18+
const transform = getService('transform');
19+
20+
describe('creation', function() {
21+
this.tags(['smoke']);
22+
// before(async () => {
23+
// await esArchiver.load('ml/ecommerce');
24+
// });
25+
26+
// after(async () => {
27+
// await esArchiver.unload('ml/ecommerce');
28+
// await transform.api.cleanTransformIndices();
29+
// });
30+
31+
const testDataList = [
32+
{
33+
suiteTitle: 'batch transform with terms+date_histogram groups and avg agg',
34+
source: 'kibana_sample_data_ecommerce',
35+
groupByEntries: [
36+
{
37+
identifier: 'terms(category.keyword)',
38+
label: 'category.keyword',
39+
} as GroupByEntry,
40+
{
41+
identifier: 'date_histogram(order_date)',
42+
label: 'order_date',
43+
intervalLabel: '1m',
44+
} as GroupByEntry,
45+
],
46+
aggregationEntries: [
47+
{
48+
identifier: 'avg(products.base_price)',
49+
label: 'products.base_price.avg',
50+
},
51+
],
52+
transformId: `ec_1_${Date.now()}`,
53+
transformDescription:
54+
'ecommerce batch transform with groups terms(category.keyword) + date_histogram(order_date) 1m and aggregation avg(products.base_price)',
55+
get destinationIndex(): string {
56+
return `dest_${this.transformId}`;
57+
},
58+
expected: {
59+
row: {
60+
status: 'stopped',
61+
mode: 'batch',
62+
progress: '100',
63+
},
64+
},
65+
},
66+
];
67+
68+
for (const testData of testDataList) {
69+
describe(`${testData.suiteTitle}`, function() {
70+
// after(async () => {
71+
// await transform.api.deleteIndices(testData.destinationIndex);
72+
// });
73+
74+
it('loads the home page', async () => {
75+
await transform.navigation.navigateTo();
76+
await transform.management.assertTransformListPageExists();
77+
});
78+
79+
it('displays the stats bar', async () => {
80+
await transform.management.assertTransformStatsBarExists();
81+
});
82+
83+
it('loads the source selection modal', async () => {
84+
await transform.management.startTransformCreation();
85+
});
86+
87+
it('selects the source data', async () => {
88+
await transform.sourceSelection.selectSource(testData.source);
89+
});
90+
91+
it('displays the define pivot step', async () => {
92+
await transform.wizard.assertDefineStepActive();
93+
});
94+
95+
it('loads the source index preview', async () => {
96+
await transform.wizard.assertSourceIndexPreviewLoaded();
97+
});
98+
99+
it('displays an empty pivot preview', async () => {
100+
await transform.wizard.assertPivotPreviewEmpty();
101+
});
102+
103+
it('displays the query input', async () => {
104+
await transform.wizard.assertQueryInputExists();
105+
await transform.wizard.assertQueryValue('');
106+
});
107+
108+
it('displays the advanced query editor switch', async () => {
109+
await transform.wizard.assertAdvancedQueryEditorSwitchExists();
110+
await transform.wizard.assertAdvancedQueryEditorSwitchCheckState(false);
111+
});
112+
113+
it('adds the group by entries', async () => {
114+
for (const [index, entry] of testData.groupByEntries.entries()) {
115+
await transform.wizard.assertGroupByInputExists();
116+
await transform.wizard.assertGroupByInputValue([]);
117+
await transform.wizard.addGroupByEntry(
118+
index,
119+
entry.identifier,
120+
entry.label,
121+
entry.intervalLabel
122+
);
123+
}
124+
});
125+
126+
it('adds the aggregation entries', async () => {
127+
for (const [index, agg] of testData.aggregationEntries.entries()) {
128+
await transform.wizard.assertAggregationInputExists();
129+
await transform.wizard.assertAggregationInputValue([]);
130+
await transform.wizard.addAggregationEntry(index, agg.identifier, agg.label);
131+
}
132+
});
133+
134+
it('displays the advanced pivot editor switch', async () => {
135+
await transform.wizard.assertAdvancedPivotEditorSwitchExists();
136+
await transform.wizard.assertAdvancedPivotEditorSwitchCheckState(false);
137+
});
138+
139+
it('loads the pivot preview', async () => {
140+
await transform.wizard.assertPivotPreviewLoaded();
141+
});
142+
143+
it('loads the details step', async () => {
144+
await transform.wizard.advanceToDetailsStep();
145+
});
146+
147+
it('inputs the transform id', async () => {
148+
await transform.wizard.assertTransformIdInputExists();
149+
await transform.wizard.assertTransformIdValue('');
150+
await transform.wizard.setTransformId(testData.transformId);
151+
});
152+
153+
it('inputs the transform description', async () => {
154+
await transform.wizard.assertTransformDescriptionInputExists();
155+
await transform.wizard.assertTransformDescriptionValue('');
156+
await transform.wizard.setTransformDescription(testData.transformDescription);
157+
});
158+
159+
it('inputs the destination index', async () => {
160+
await transform.wizard.assertDestinationIndexInputExists();
161+
await transform.wizard.assertDestinationIndexValue('');
162+
await transform.wizard.setDestinationIndex(testData.destinationIndex);
163+
});
164+
165+
it('displays the create index pattern switch', async () => {
166+
await transform.wizard.assertCreateIndexPatternSwitchExists();
167+
await transform.wizard.assertCreateIndexPatternSwitchCheckState(true);
168+
});
169+
170+
it('displays the continuous mode switch', async () => {
171+
await transform.wizard.assertContinuousModeSwitchExists();
172+
await transform.wizard.assertContinuousModeSwitchCheckState(false);
173+
});
174+
175+
it('loads the create step', async () => {
176+
await transform.wizard.advanceToCreateStep();
177+
});
178+
179+
it('displays the create and start button', async () => {
180+
await transform.wizard.assertCreateAndStartButtonExists();
181+
});
182+
183+
it('displays the create button', async () => {
184+
await transform.wizard.assertCreateButtonExists();
185+
});
186+
187+
it('displays the copy to clipboard button', async () => {
188+
await transform.wizard.assertCreateAndStartButtonExists();
189+
});
190+
191+
it('creates the transform', async () => {
192+
await transform.wizard.createTransform();
193+
});
194+
195+
it('starts the transform and finishes processing', async () => {
196+
await transform.wizard.startTransform();
197+
await transform.wizard.waitForProgressBarComplete();
198+
});
199+
200+
it('returns to the management page', async () => {
201+
await transform.wizard.returnToManagement();
202+
});
203+
204+
it('displays the transforms table', async () => {
205+
await transform.management.assertTransformsTableExists();
206+
});
207+
208+
it('displays the created transform in the transform list', async () => {
209+
await transform.table.refreshTransformList();
210+
await transform.table.filterWithSearchString(testData.transformId);
211+
const rows = await transform.table.parseTransformTable();
212+
expect(rows.filter(row => row.id === testData.transformId)).to.have.length(1);
213+
});
214+
215+
it('job creation displays details for the created job in the job list', async () => {
216+
await transform.table.assertTransformRowFields(testData.transformId, {
217+
id: testData.transformId,
218+
description: testData.transformDescription,
219+
sourceIndex: testData.source,
220+
destinationIndex: testData.destinationIndex,
221+
status: testData.expected.row.status,
222+
mode: testData.expected.row.mode,
223+
progress: testData.expected.row.progress,
224+
});
225+
});
226+
});
227+
}
228+
});
229+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
import { FtrProviderContext } from '../../ftr_provider_context';
7+
8+
export default function({ loadTestFile }: FtrProviderContext) {
9+
describe('transform', function() {
10+
this.tags(['ciGroup9', 'transform']);
11+
12+
loadTestFile(require.resolve('./creation'));
13+
});
14+
}

x-pack/test/functional/config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export default async function ({ readConfigFile }) {
5555
resolve(__dirname, './apps/snapshot_restore'),
5656
resolve(__dirname, './apps/cross_cluster_replication'),
5757
resolve(__dirname, './apps/remote_clusters'),
58+
resolve(__dirname, './apps/transform'),
5859
// This license_management file must be last because it is destructive.
5960
resolve(__dirname, './apps/license_management'),
6061
],
@@ -192,6 +193,10 @@ export default async function ({ readConfigFile }) {
192193
pathname: '/app/kibana',
193194
hash: '/management/elasticsearch/watcher/watches/',
194195
},
196+
transform: {
197+
pathname: '/app/kibana/',
198+
hash: '/management/elasticsearch/transform'
199+
}
195200
},
196201

197202
// choose where esArchiver should load archives from

0 commit comments

Comments
 (0)