1
1
import { t } from 'testcafe' ;
2
+ import { Chance } from 'chance' ;
2
3
import {
3
4
addNewREClusterDatabase ,
4
5
addOSSClusterDatabase ,
@@ -20,6 +21,8 @@ import { Telemetry } from '../../../helpers/telemetry';
20
21
const browserPage = new BrowserPage ( ) ;
21
22
const myRedisDatabasePage = new MyRedisDatabasePage ( ) ;
22
23
const telemetry = new Telemetry ( ) ;
24
+ const chance = new Chance ( ) ;
25
+
23
26
const logger = telemetry . createLogger ( ) ;
24
27
const telemetryEvent = 'CONFIG_DATABASES_OPEN_DATABASE' ;
25
28
const expectedProperties = [
@@ -33,6 +36,7 @@ const expectedProperties = [
33
36
'RedisTimeSeries' ,
34
37
'customModules'
35
38
] ;
39
+ let databaseName = `test_standalone-${ chance . string ( { length : 10 } ) } ` ;
36
40
37
41
fixture `Add database`
38
42
. meta ( { type : 'smoke' } )
44
48
. meta ( { rte : rte . standalone } )
45
49
. requestHooks ( logger )
46
50
. after ( async ( ) => {
47
- await deleteDatabase ( ossStandaloneConfig . databaseName ) ;
51
+ await deleteDatabase ( databaseName ) ;
48
52
} ) ( 'Verify that user can add Standalone Database' , async ( ) => {
49
53
const connectionTimeout = '20' ;
54
+ databaseName = `test_standalone-${ chance . string ( { length : 10 } ) } ` ;
50
55
51
56
// Fill the add database form
52
57
await myRedisDatabasePage . AddRedisDatabase . addDatabaseButton . with ( { visibilityCheck : true , timeout : 10000 } ) ( ) ;
56
61
await t
57
62
. typeText ( myRedisDatabasePage . AddRedisDatabase . hostInput , ossStandaloneConfig . host , { replace : true , paste : true } )
58
63
. typeText ( myRedisDatabasePage . AddRedisDatabase . portInput , ossStandaloneConfig . port , { replace : true , paste : true } )
59
- . typeText ( myRedisDatabasePage . AddRedisDatabase . databaseAliasInput , ossStandaloneConfig . databaseName , { replace : true , paste : true } )
64
+ . typeText ( myRedisDatabasePage . AddRedisDatabase . databaseAliasInput , databaseName , { replace : true , paste : true } )
60
65
// Verify that user can customize the connection timeout for the manual flow
61
66
. typeText ( myRedisDatabasePage . AddRedisDatabase . timeoutInput , connectionTimeout , { replace : true , paste : true } ) ;
62
67
await t
63
68
. click ( myRedisDatabasePage . AddRedisDatabase . addRedisDatabaseButton )
64
69
// Wait for database to be exist
65
- . expect ( myRedisDatabasePage . dbNameList . withExactText ( ossStandaloneConfig . databaseName ) . exists ) . ok ( 'The database not displayed' , { timeout : 10000 } )
70
+ . expect ( myRedisDatabasePage . dbNameList . withExactText ( databaseName ) . exists ) . ok ( 'The database not displayed' , { timeout : 10000 } )
66
71
// Close message
67
72
. click ( myRedisDatabasePage . Toast . toastCloseButton ) ;
68
73
69
74
// Verify that user can see an indicator of databases that are added manually and not opened yet
70
- await myRedisDatabasePage . verifyDatabaseStatusIsVisible ( ossStandaloneConfig . databaseName ) ;
71
- await myRedisDatabasePage . clickOnDBByName ( ossStandaloneConfig . databaseName ) ;
75
+ await myRedisDatabasePage . verifyDatabaseStatusIsVisible ( databaseName ) ;
76
+ await myRedisDatabasePage . clickOnDBByName ( databaseName ) ;
72
77
73
78
// Verify that telemetry event 'CONFIG_DATABASES_OPEN_DATABASE' sent and has all expected properties
74
79
await telemetry . verifyEventHasProperties ( telemetryEvent , expectedProperties , logger ) ;
75
80
76
81
await t . click ( browserPage . OverviewPanel . myRedisDbIcon ) ;
77
82
// Verify that user can't see an indicator of databases that were opened
78
- await myRedisDatabasePage . verifyDatabaseStatusIsNotVisible ( ossStandaloneConfig . databaseName ) ;
83
+ await myRedisDatabasePage . verifyDatabaseStatusIsNotVisible ( databaseName ) ;
79
84
80
85
// Verify that connection timeout value saved
81
- await myRedisDatabasePage . clickOnEditDBByName ( ossStandaloneConfig . databaseName ) ;
86
+ await myRedisDatabasePage . clickOnEditDBByName ( databaseName ) ;
82
87
await t . expect ( myRedisDatabasePage . AddRedisDatabase . timeoutInput . value ) . eql ( connectionTimeout , 'Connection timeout is not customized' ) ;
83
88
} ) ;
84
89
test
0 commit comments