@@ -7,7 +7,7 @@ import { BASE_PATH, IM_PLUGIN_NAME } from "../../../utils/constants";
7
7
import sampleTransform from "../../../fixtures/plugins/index-management-dashboards-plugin/sample_transform" ;
8
8
9
9
const TRANSFORM_ID = "test_transform_id" ;
10
-
10
+ const TRANSFORM_ID_WILDCARD = "test_transform_wildard" ;
11
11
describe ( "Transforms" , ( ) => {
12
12
before ( ( ) => {
13
13
// Delete all indices
@@ -50,7 +50,7 @@ describe("Transforms", () => {
50
50
cy . contains ( "Create transform" , { timeout : 60000 } ) ;
51
51
} ) ;
52
52
53
- describe ( "can be created" , ( ) => {
53
+ describe ( "can be created with source index " , ( ) => {
54
54
it ( "successfully" , ( ) => {
55
55
// Confirm we loaded empty state
56
56
cy . contains ( "Transform jobs help you create a materialized view on top of existing data." ) ;
@@ -128,6 +128,96 @@ describe("Transforms", () => {
128
128
} ) ;
129
129
} ) ;
130
130
131
+ describe ( "can be created with source index wildcard" , ( ) => {
132
+ it ( "successfully" , ( ) => {
133
+ // Confirm we loaded empty state
134
+ // cy.contains("Transform jobs help you create a materialized view on top of existing data.");
135
+
136
+ // Route to create transform page
137
+ cy . contains ( "Create transform" ) . click ( { force : true } ) ;
138
+
139
+ // Type in transform ID
140
+ cy . get ( `input[placeholder="my-transformjob1"]` ) . type ( TRANSFORM_ID_WILDCARD , {
141
+ force : true ,
142
+ } ) ;
143
+
144
+ // Get description input box
145
+ cy . get ( `textarea[data-test-subj="description"]` ) . focus ( ) . type ( "some description" ) ;
146
+
147
+ // Enter source index
148
+ cy . get ( `div[data-test-subj="sourceIndexCombobox"]` )
149
+ . find ( `input[data-test-subj="comboBoxSearchInput"]` )
150
+ . focus ( )
151
+ . type ( "opensearch_dashboards_sample_data_ecommerce*{enter}" ) ;
152
+
153
+ cy . wait ( 5000 ) ;
154
+
155
+ // Enter target index
156
+ cy . get ( `div[data-test-subj="targetIndexCombobox"]` )
157
+ . find ( `input[data-test-subj="comboBoxSearchInput"]` )
158
+ . focus ( )
159
+ . type ( "test_transform{enter}" ) ;
160
+
161
+ cy . wait ( 2000 ) ;
162
+
163
+ // Click the next button
164
+ cy . get ( "button" ) . contains ( "Next" ) . click ( { force : true } ) ;
165
+
166
+ // Confirm that we got to step 2 of creation page
167
+ cy . contains ( "Select fields to transform" ) ;
168
+
169
+ cy . get ( `button[data-test-subj="category.keywordOptionsPopover"]` ) . click ( {
170
+ force : true ,
171
+ } ) ;
172
+
173
+ cy . contains ( "Group by terms" ) . click ( { force : true } ) ;
174
+
175
+ // Confirm group was added
176
+ cy . contains ( "category.keyword_terms" ) ;
177
+
178
+ // Add aggregable field
179
+ cy . contains ( "50 columns hidden" ) . click ( { force : true } ) ;
180
+ cy . contains ( "taxless_total_price" ) . click ( { force : true } ) ;
181
+ // Click out of the window
182
+ cy . contains ( "Select fields to transform" ) . click ( { force : true } ) ;
183
+
184
+ cy . get ( `button[data-test-subj="taxless_total_priceOptionsPopover"]` ) . click ( { force : true } ) ;
185
+
186
+ cy . contains ( "Aggregate by avg" ) . click ( { force : true } ) ;
187
+
188
+ // Confirm agg was added
189
+ cy . contains ( "avg_taxless_total_price" ) ;
190
+
191
+ // Click the next button
192
+ cy . get ( "button" ) . contains ( "Next" ) . click ( { force : true } ) ;
193
+
194
+ // Confirm that we got to step 3 of creation page
195
+ cy . contains ( "Job enabled by default" ) ;
196
+
197
+ // Click the next button
198
+ cy . get ( "button" ) . contains ( "Next" ) . click ( { force : true } ) ;
199
+
200
+ // Confirm that we got to step 4 of creation page
201
+ cy . contains ( "Review and create" ) ;
202
+
203
+ // Click the create button
204
+ cy . get ( "button" ) . contains ( "Create" ) . click ( { force : true } ) ;
205
+
206
+ cy . wait ( 2000 ) ;
207
+
208
+ // Verify that sample data is add by checking toast notification
209
+ cy . contains ( `Transform job "${ TRANSFORM_ID_WILDCARD } " successfully created.` ) ;
210
+ cy . location ( "hash" ) . should ( "contain" , "transforms" ) ;
211
+ cy . get ( `button[data-test-subj="transformLink_${ TRANSFORM_ID_WILDCARD } "]` ) ;
212
+
213
+ cy . request ( {
214
+ method : "DELETE" ,
215
+ url : `${ Cypress . env ( "openSearchUrl" ) } /_plugins/_transform/${ TRANSFORM_ID_WILDCARD } ` ,
216
+ failOnStatusCode : false ,
217
+ } ) ;
218
+ } ) ;
219
+ } ) ;
220
+
131
221
describe ( "can be edited" , ( ) => {
132
222
beforeEach ( ( ) => {
133
223
cy . createTransform ( TRANSFORM_ID , sampleTransform ) ;
@@ -208,9 +298,6 @@ describe("Transforms", () => {
208
298
209
299
// Confirm we got deleted toaster
210
300
cy . contains ( `"${ TRANSFORM_ID } " successfully deleted` ) ;
211
-
212
- // Confirm showing empty loading state
213
- cy . contains ( "Transform jobs help you create a materialized view on top of existing data." ) ;
214
301
} ) ;
215
302
} ) ;
216
303
@@ -226,10 +313,7 @@ describe("Transforms", () => {
226
313
227
314
// Intercept different transform requests endpoints to wait before clicking disable and enable buttons
228
315
cy . intercept ( `/api/ism/transforms/${ TRANSFORM_ID } ` ) . as ( "getTransform" ) ;
229
- cy . intercept ( `/api/ism/transforms/${ TRANSFORM_ID } /_stop` ) . as (
230
- "stopTransform"
231
- ) ;
232
-
316
+ cy . intercept ( `/api/ism/transforms/${ TRANSFORM_ID } /_stop` ) . as ( "stopTransform" ) ;
233
317
234
318
// Click into transform job details page
235
319
cy . get ( `[data-test-subj="transformLink_${ TRANSFORM_ID } "]` ) . click ( {
@@ -248,9 +332,7 @@ describe("Transforms", () => {
248
332
cy . get ( `[data-test-subj="actionButton"]` ) . click ( { force : true } ) ;
249
333
250
334
// Click Disable button
251
- cy . get ( `[data-test-subj="disableButton"]` )
252
- . should ( "not.be.disabled" )
253
- . click ( ) ;
335
+ cy . get ( `[data-test-subj="disableButton"]` ) . should ( "not.be.disabled" ) . click ( ) ;
254
336
255
337
cy . wait ( "@stopTransform" ) ;
256
338
cy . wait ( "@getTransform" ) ;
@@ -265,9 +347,7 @@ describe("Transforms", () => {
265
347
cy . get ( `[data-test-subj="actionButton"]` ) . click ( { force : true } ) ;
266
348
267
349
// Click Enable button
268
- cy . get ( `[data-test-subj="enableButton"]` )
269
- . should ( "not.be.disabled" )
270
- . click ( { force : true } ) ;
350
+ cy . get ( `[data-test-subj="enableButton"]` ) . should ( "not.be.disabled" ) . click ( { force : true } ) ;
271
351
272
352
// Confirm we get toaster saying transform job is enabled
273
353
cy . contains ( `"${ TRANSFORM_ID } " is enabled` ) ;
0 commit comments