@@ -6,7 +6,6 @@ import { MyRedisDatabasePage } from '../../../../pageObjects';
6
6
import { RdiPopoverOptions , RdiTemplatePipelineType , RedisOverviewPage } from '../../../../helpers/constants' ;
7
7
import { RdiInstancesListPage } from '../../../../pageObjects/rdi-instances-list-page' ;
8
8
import { DatabaseHelper } from '../../../../helpers' ;
9
- import { MonacoEditor } from '../../../../common-actions/monaco-editor' ;
10
9
11
10
const rdiInstancePage = new RdiInstancePage ( ) ;
12
11
const rdiApiRequests = new RdiApiRequests ( ) ;
@@ -98,7 +97,7 @@ test('Verify that user insert template for jobs', async() => {
98
97
await rdiInstancePage . setTemplateDropdownValue ( RdiTemplatePipelineType . WriteBehind ) ;
99
98
100
99
//verify uniq templates words - should be undated when templates are added
101
- const enteredText = await MonacoEditor . getTextFromMonaco ( ) ;
100
+ const enteredText = await rdiInstancePage . MonacoEditor . getTextFromMonaco ( ) ;
102
101
await t . expect ( enteredText ) . contains ( templateWords , 'template is incorrect' ) ;
103
102
104
103
await t . click ( rdiInstancePage . templateButton ) ;
@@ -109,17 +108,20 @@ test('Verify that user can change job config', async() => {
109
108
const textForMonaco = 'here should be a job' ;
110
109
111
110
await rdiInstancePage . PipelineManagementPanel . addJob ( jobName ) ;
112
- let text = await MonacoEditor . getTextFromMonaco ( ) ;
111
+ let text = await rdiInstancePage . MonacoEditor . getTextFromMonaco ( ) ;
113
112
await t . expect ( text ) . eql ( '' , 'monacoEditor for the job is not empty' ) ;
114
- await MonacoEditor . sendTextToMonaco ( rdiInstancePage . jobsInput , textForMonaco , false ) ;
115
- text = await MonacoEditor . getTextFromMonaco ( ) ;
113
+ await rdiInstancePage . MonacoEditor . sendTextToMonaco ( rdiInstancePage . jobsInput , textForMonaco , false ) ;
114
+ text = await rdiInstancePage . MonacoEditor . getTextFromMonaco ( ) ;
116
115
await t . expect ( text ) . eql ( textForMonaco , 'user can not enter a text' ) ;
117
116
} ) ;
117
+ // https://redislabs.atlassian.net/browse/RI-5770
118
118
test ( 'Verify that user can open an additional editor to work with SQL and JMESPath expressions' , async ( ) => {
119
119
const jobName = 'testJob' ;
120
120
const sqlText = 'SELECT test FROM test1' ;
121
- const JMESPathText = 'ba' ;
122
- const JMESPathAutoCompleteText = 'base64_decode' ;
121
+ const SQLiteText = 's' ;
122
+ const SQLiteAutoCompleteText = 'STRFTIME(format, time_value)' ;
123
+ const JMESPathText = 'r' ;
124
+ const JMESPathAutoCompleteText = 'regex_replace' ;
123
125
124
126
await rdiInstancePage . PipelineManagementPanel . addJob ( jobName ) ;
125
127
await rdiInstancePage . PipelineManagementPanel . openJobByName ( jobName ) ;
@@ -136,24 +138,37 @@ test('Verify that user can open an additional editor to work with SQL and JMESPa
136
138
await t . expect ( rdiInstancePage . dedicatedLanguageSelect . textContent ) . eql ( 'SQL' , 'SQL is not set by default' ) ;
137
139
138
140
// Verify that user can close the additional editor
139
- await MonacoEditor . sendTextToMonaco ( rdiInstancePage . draggableArea , sqlText , false ) ;
141
+ await rdiInstancePage . MonacoEditor . sendTextToMonaco ( rdiInstancePage . draggableArea , sqlText , false ) ;
140
142
await t . click ( rdiInstancePage . EditorButton . cancelBtn ) ;
141
143
await t . expect ( rdiInstancePage . draggableArea . exists ) . notOk ( 'SQL/JMESPath editor is displayed after closing' ) ;
142
- await t . expect ( await MonacoEditor . getTextFromMonaco ( ) ) . eql ( '' , 'Text from canceled SQL editor applied' ) ;
144
+ await t . expect ( await rdiInstancePage . MonacoEditor . getTextFromMonaco ( ) ) . eql ( '' , 'Text from canceled SQL editor applied' ) ;
143
145
144
146
await t . pressKey ( 'shift+space' ) ;
145
- await MonacoEditor . sendTextToMonaco ( rdiInstancePage . draggableArea , sqlText , false ) ;
147
+ await rdiInstancePage . MonacoEditor . sendTextToMonaco ( rdiInstancePage . draggableArea , sqlText , false ) ;
146
148
await t . click ( rdiInstancePage . EditorButton . applyBtn ) ;
147
- await t . expect ( await MonacoEditor . getTextFromMonaco ( ) ) . eql ( sqlText , 'Text from SQL editor not applied' ) ;
149
+ await t . expect ( await rdiInstancePage . MonacoEditor . getTextFromMonaco ( ) ) . eql ( sqlText , 'Text from SQL editor not applied' ) ;
148
150
149
151
//verify that autocomplete works for JMESPath
150
152
await t . hover ( rdiInstancePage . sqlEditorButton ) ;
151
153
await rdiInstancePage . verifyTooltipContainsText ( 'Open a dedicated SQL or JMESPath editor:' ) ;
152
154
await t . click ( rdiInstancePage . sqlEditorButton ) ;
153
155
await t . click ( rdiInstancePage . languageDropdown ) ;
154
156
await t . click ( rdiInstancePage . jmesPathOption ) ;
155
- await MonacoEditor . sendTextToMonaco ( rdiInstancePage . draggableArea , JMESPathText ) ;
157
+ // Start type characters and select command
158
+ await rdiInstancePage . MonacoEditor . sendTextToMonaco ( rdiInstancePage . draggableArea , JMESPathText ) ;
159
+ // Verify that the list with auto-suggestions is displayed
160
+ await t . expect ( rdiInstancePage . MonacoEditor . monacoSuggestion . count ) . eql ( 3 , 'Auto-suggestions are not displayed' ) ;
156
161
await t . pressKey ( 'tab' ) ;
157
162
await t . click ( rdiInstancePage . EditorButton . applyBtn ) ;
158
- await t . expect ( await MonacoEditor . getTextFromMonaco ( ) ) . contains ( JMESPathAutoCompleteText , 'Text from SQL editor not applied' ) ;
163
+ await t . expect ( await rdiInstancePage . MonacoEditor . getTextFromMonaco ( ) ) . contains ( JMESPathAutoCompleteText , 'Text from JMESPath editor not applied' ) ;
164
+
165
+ // Verify that autocomplete works for SQLite functions
166
+ await t . click ( rdiInstancePage . sqlEditorButton ) ;
167
+ // Start type characters and select command
168
+ await rdiInstancePage . MonacoEditor . sendTextToMonaco ( rdiInstancePage . draggableArea , SQLiteText ) ;
169
+ // Verify that the list with auto-suggestions is displayed
170
+ await t . expect ( rdiInstancePage . MonacoEditor . monacoSuggestion . count ) . eql ( 3 , 'Auto-suggestions are not displayed' ) ;
171
+ await t . pressKey ( 'tab' ) ;
172
+ await t . click ( rdiInstancePage . EditorButton . applyBtn ) ;
173
+ await t . expect ( await rdiInstancePage . MonacoEditor . getTextFromMonaco ( ) ) . contains ( SQLiteAutoCompleteText , 'Text from SQLite editor not applied' ) ;
159
174
} ) ;
0 commit comments