1
1
import { commonUrl , ossStandaloneRedisGears } from '../../../../helpers/conf' ;
2
+ import { ClientFunction } from 'testcafe' ;
2
3
import { ExploreTabs , rte } from '../../../../helpers/constants' ;
3
4
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database' ;
4
5
import { Common } from '../../../../helpers/common' ;
@@ -18,13 +19,14 @@ const { host, port, databaseName, databaseUsername = '', databasePassword = '' }
18
19
const username = 'alice&&' ;
19
20
const password = 'p1pp0@&' ;
20
21
21
- function generateLink ( params : Record < string , any > ) : string {
22
+ function generateLink ( params : Record < string , any > , connectType : string , url : string ) : string {
22
23
const params1 = Common . generateUrlTParams ( params ) ;
23
- const from = encodeURIComponent ( `${ redisConnect } ?${ params1 } ` ) ;
24
- return ( new URL ( `?from=${ from } ` , commonUrl ) ) . toString ( ) ;
24
+ const from = encodeURIComponent ( `${ connectType } ?${ params1 } ` ) ;
25
+ return ( new URL ( `?from=${ from } ` , url ) ) . toString ( ) ;
25
26
}
26
27
27
28
const redisConnect = 'redisinsight://databases/connect' ;
29
+ const redisOpen = 'redisinsight://open' ;
28
30
29
31
fixture `Add DB from SM`
30
32
. meta ( { type : 'critical_path' , rte : rte . none } )
42
44
databaseAlias : databaseName ,
43
45
redirect : 'workbench'
44
46
} ;
45
- await t . navigateTo ( generateLink ( connectUrlParams ) ) ;
47
+ await t . navigateTo ( generateLink ( connectUrlParams , redisConnect , commonUrl ) ) ;
46
48
await t . expect ( myRedisDatabasePage . AddRedisDatabase . disabledDatabaseInfo . nth ( 0 ) . getAttribute ( 'title' ) ) . contains ( host , 'Wrong host value' ) ;
47
49
await t . expect ( myRedisDatabasePage . AddRedisDatabase . disabledDatabaseInfo . nth ( 1 ) . getAttribute ( 'title' ) ) . contains ( port , 'Wrong port value' ) ;
48
50
await t . wait ( 5_000 ) ;
76
78
subscriptionType : 'fixed' ,
77
79
planMemoryLimit : '30' ,
78
80
memoryLimitMeasurementUnit : 'mb' ,
79
- free : 'true' ,
80
- onboarding : 'true'
81
+ free : 'true'
81
82
} ;
82
83
83
- await t . navigateTo ( generateLink ( connectUrlParams ) ) ;
84
+ const connectUrlParams2 = {
85
+ redirect : '/_' ,
86
+ onboarding : 'true' ,
87
+ copilot : 'false'
88
+ } ;
89
+
90
+ await t . navigateTo ( generateLink ( connectUrlParams , redisConnect , commonUrl ) ) ;
84
91
await t . wait ( 10_000 ) ;
85
92
await t . expect ( workbenchPage . submitCommandButton . exists ) . ok ( 'Redirection to Workbench is not correct' ) ;
86
93
const tab = await workbenchPage . InsightsPanel . setActiveTab ( ExploreTabs . Tutorials ) ;
87
94
await t . expect ( tab . preselectArea . textContent ) . contains ( 'INTRODUCTION' , 'the tutorial page is incorrect' ) ;
88
95
await t . expect ( tab . preselectArea . textContent ) . contains ( 'JSON' , 'the tutorial is incorrect' ) ;
89
96
90
- //Verify that the same db is not added
91
- await t . navigateTo ( generateLink ( connectUrlParams ) ) ;
97
+ const getPageUrl = ClientFunction ( ( ) => window . location . href ) ;
98
+ const url = await getPageUrl ( ) ;
99
+
100
+ await t . navigateTo ( generateLink ( connectUrlParams2 , redisOpen , url ) ) ;
92
101
await t . wait ( 10_000 ) ;
102
+ await t . expect ( workbenchPage . submitCommandButton . exists ) . ok ( 'Redirection to the same page is not correct' ) ;
93
103
await t . click ( workbenchPage . NavigationPanel . browserButton ) ;
94
104
await t . expect ( onboardingCardsDialog . showMeAroundButton . exists ) . ok ( 'onboarding is nor reset' ) ;
95
105
await t . click ( onboardingCardsDialog . skipTourButton ) ;
106
+
107
+ //Verify that the same db is not added
108
+ await t . navigateTo ( generateLink ( connectUrlParams , redisConnect , commonUrl ) ) ;
109
+ await t . wait ( 10_000 ) ;
96
110
await t . click ( workbenchPage . NavigationPanel . myRedisDBButton ) ;
97
111
await t . expect ( browserPage . notification . exists ) . notOk ( { timeout : 10000 } ) ;
98
112
await t . expect ( myRedisDatabasePage . dbNameList . child ( 'span' ) . withExactText ( databaseName ) . count ) . eql ( 2 , 'the same db is added twice' ) ;
99
-
100
113
} ) ;
0 commit comments