1
+ import * as path from 'path' ;
1
2
import { ClientFunction , t } from 'testcafe' ;
2
3
import * as yaml from 'js-yaml' ;
3
- import * as path from 'path' ;
4
4
import { RdiInstancePage } from '../../../../pageObjects/rdi-instance-page' ;
5
5
import { AddNewRdiParameters , RdiApiRequests } from '../../../../helpers/api/api-rdi' ;
6
6
import { cloudDatabaseConfig , commonUrl } from '../../../../helpers/conf' ;
@@ -15,24 +15,25 @@ import {
15
15
} from '../../../../helpers/constants' ;
16
16
import { DatabaseHelper } from '../../../../helpers' ;
17
17
import { goBackHistory } from '../../../../helpers/utils' ;
18
-
18
+ import { DatabaseAPIRequests } from '../../../../helpers/api/api-database' ;
19
19
20
20
const myRedisDatabasePage = new MyRedisDatabasePage ( ) ;
21
21
const rdiInstancePage = new RdiInstancePage ( ) ;
22
22
const rdiInstancesListPage = new RdiInstancesListPage ( ) ;
23
23
const rdiApiRequests = new RdiApiRequests ( ) ;
24
24
const databaseHelper = new DatabaseHelper ( ) ;
25
+ const databaseAPIRequests = new DatabaseAPIRequests ( ) ;
25
26
26
27
const rdiInstance : AddNewRdiParameters = {
27
28
name : 'testInstance' ,
28
- url : 'https://54.175.165.214 ' ,
29
+ url : 'https://11.111.111.111 ' ,
29
30
username : 'username' ,
30
31
password : 'v3rY$tronGPa33w0Rd3ECDb'
31
32
} ;
32
33
33
34
const getPageUrl = ClientFunction ( ( ) => window . location . href ) ;
34
35
35
- const filePath = path . join ( '..' , '..' , '..' , '..' , 'test-data' , 'rdi' , 'RDI_pipelineConfig .zip' ) ;
36
+ const filePath = path . join ( '..' , '..' , '..' , '..' , 'test-data' , 'rdi' , 'RDI_pipelineConfigurations .zip' ) ;
36
37
37
38
//skip the tests until rdi integration is added
38
39
fixture `Pipeline`
@@ -47,16 +48,18 @@ fixture `Pipeline`
47
48
await rdiApiRequests . deleteAllRdiApi ( ) ;
48
49
} ) ;
49
50
50
- test . only ( 'Verify that user can test connection' , async ( ) => {
51
+ test . after ( async ( ) => {
52
+ // Delete databases
53
+ await databaseAPIRequests . deleteAllDatabasesApi ( ) ;
54
+ } ) ( 'Verify that user can test connection' , async ( ) => {
51
55
await myRedisDatabasePage . setActivePage ( RedisOverviewPage . DataBase ) ;
52
56
await databaseHelper . autodiscoverRECloudDatabase (
53
- //cloudDatabaseConfig.accessKey,
54
- //cloudDatabaseConfig.secretKey
55
- 'A4wddpkno553qruhpsd670y8axe94warws3gbjbw896iyjf6dfl' ,
56
- 'S3xf5aiipy32nc9q7dyg8v4yhvf7x18i34euwilbcgrz02yjro5'
57
+ cloudDatabaseConfig . accessKey ,
58
+ cloudDatabaseConfig . secretKey
57
59
) ;
58
60
const [ host , port ] = ( await myRedisDatabasePage . hostPort . textContent ) . split ( ':' ) ;
59
- //const password = cloudDatabaseConfig.databasePassword;
61
+ const password = cloudDatabaseConfig . databasePassword ;
62
+ const errorText = 'Failed to connect to RDI database. Please verify host and port information.' ;
60
63
61
64
const configData = {
62
65
sources : {
@@ -80,21 +83,21 @@ test.only('Verify that user can test connection', async() => {
80
83
type : 'redis' ,
81
84
host,
82
85
port,
83
- password : 'dd4oImrbinrNs1LXzKCtsnKjzLxZeaA2'
86
+ password : password
84
87
}
85
88
}
86
89
} ;
87
90
const config = yaml . dump ( configData , { indent : 2 } ) ;
88
-
89
- //fs.writeFileSync('config.yaml', yamlString, 'utf8');
90
91
console . log ( JSON . stringify ( config ) ) ;
92
+
91
93
await myRedisDatabasePage . setActivePage ( RedisOverviewPage . Rdi ) ;
92
94
await rdiInstancesListPage . clickRdiByName ( rdiInstance . name ) ;
93
95
await rdiInstancePage . selectStartPipelineOption ( RdiPopoverOptions . Pipeline ) ;
94
96
await t . click ( rdiInstancePage . templateCancelButton ) ;
95
97
96
98
await t . click ( rdiInstancePage . configurationInput ) ;
97
99
const lines = config . split ( '\n' ) ;
100
+ // the verable shows the level of object depth for input by line in monaco
98
101
const maxLevelDepth = 3 ;
99
102
const targetName = 'target' ;
100
103
@@ -108,11 +111,14 @@ test.only('Verify that user can test connection', async() => {
108
111
await rdiInstancePage . RdiHeader . uploadPipeline ( filePath ) ;
109
112
await t . click ( rdiInstancePage . okUploadPipelineBtn ) ;
110
113
await t . click ( rdiInstancePage . textConnectionBtn ) ;
114
+ await rdiInstancePage . TestConnectionPanel . expandOrCollapseSection ( TextConnectionSection . Failed , true ) ;
115
+
116
+ await t . expect ( await rdiInstancePage . TestConnectionPanel . resultText . textContent ) . eql ( errorText ) ;
111
117
112
118
} ) ;
113
119
test ( 'Verify that link on configuration is valid' , async ( ) => {
114
120
115
- const link = 'https://docs. redis.com/ latest/rdi/quickstart/ ' ;
121
+ const link = 'https://redis.io/docs/ latest/integrate/redis-data-integration/ingest/data-pipelines/data-pipelines/?utm_source=redisinsight&utm_medium=rdi&utm_campaign=config_file ' ;
116
122
// Verify the link
117
123
await myRedisDatabasePage . setActivePage ( RedisOverviewPage . Rdi ) ;
118
124
await rdiInstancesListPage . clickRdiByName ( rdiInstance . name ) ;
@@ -123,15 +129,14 @@ test('Verify that link on configuration is valid', async() => {
123
129
await goBackHistory ( ) ;
124
130
} ) ;
125
131
126
- test ( 'Verify that user can insert template' , async ( ) => {
132
+ test . only ( 'Verify that user can insert template' , async ( ) => {
127
133
const disabledAttribute = 'isDisabled' ;
128
- const defaultValue = 'Ingest ' ;
129
- const templateWords = 'type: redis ' ;
134
+ const defaultValue = 'ingest ' ;
135
+ const templateWords = 'type: mysql ' ;
130
136
// should be empty config
131
137
await myRedisDatabasePage . setActivePage ( RedisOverviewPage . Rdi ) ;
132
138
await rdiInstancesListPage . clickRdiByName ( rdiInstance . name ) ;
133
- await t . click ( rdiInstancePage . PipelineManagementPanel . configurationTab ) ;
134
- await rdiInstancePage . selectStartPipelineOption ( RdiPopoverOptions . File ) ;
139
+ await rdiInstancePage . selectStartPipelineOption ( RdiPopoverOptions . Pipeline ) ;
135
140
await t . expect ( rdiInstancePage . templateApplyButton . visible ) . ok ( 'the template popover is not expanded' ) ;
136
141
const buttonClass = rdiInstancePage . templateApplyButton . getAttribute ( 'class' ) ;
137
142
await t . expect ( buttonClass ) . notContains ( disabledAttribute , 'Apply button is disabled' ) ;
@@ -143,12 +148,10 @@ test('Verify that user can insert template', async() => {
143
148
await t . expect ( rdiInstancePage . pipelineDropdown . textContent ) . eql ( defaultValue , 'the default value is set incorrectly' ) ;
144
149
await rdiInstancePage . setTemplateDropdownValue ( RdiTemplatePipelineType . Ingest , RdiTemplateDatabaseType . MySql ) ;
145
150
146
- //verify uniq templates words - should be undated when templates are added
147
151
const enteredText = await rdiInstancePage . MonacoEditor . getTextFromMonaco ( ) ;
148
152
await t . expect ( enteredText ) . contains ( templateWords , 'template is incorrect' ) ;
149
153
150
154
await t . click ( rdiInstancePage . templateButton ) ;
151
155
await t . expect ( buttonClass ) . contains ( disabledAttribute , 'Apply button is active' ) ;
152
- await t . expect ( rdiInstancePage . pipelineDropdown . textContent ) . eql ( 'Ingest' , 'the value is set incorrectly' ) ;
153
- await t . expect ( rdiInstancePage . databaseDropdown . textContent ) . eql ( 'MySQL' , 'the default value is set incorrectly' ) ;
156
+ await t . expect ( rdiInstancePage . pipelineDropdown . textContent ) . eql ( defaultValue , 'the value is set incorrectly' ) ;
154
157
} ) ;
0 commit comments