1
- import { BrowserPage , MemoryEfficiencyPage , MyRedisDatabasePage , SettingsPage , WorkbenchPage } from '../../../pageObjects' ;
2
- import { RecommendationIds , rte , env } from '../../../helpers/constants' ;
1
+ import * as path from 'path' ;
2
+ import { BrowserPage , MemoryEfficiencyPage , MyRedisDatabasePage , WorkbenchPage } from '../../../pageObjects' ;
3
+ import { RecommendationIds , rte } from '../../../helpers/constants' ;
3
4
import { acceptLicenseTerms , acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database' ;
4
5
import { commonUrl , ossStandaloneConfig , ossStandaloneV5Config } from '../../../helpers/conf' ;
5
6
import {
@@ -10,6 +11,7 @@ import {
10
11
import { Common } from '../../../helpers/common' ;
11
12
import { Telemetry } from '../../../helpers/telemetry' ;
12
13
import { RecommendationsActions } from '../../../common-actions/recommendations-actions' ;
14
+ import { modifyFeaturesConfigJson , refreshFeaturesTestData , updateControlNumber } from '../../../helpers/insights' ;
13
15
14
16
const myRedisDatabasePage = new MyRedisDatabasePage ( ) ;
15
17
const browserPage = new BrowserPage ( ) ;
@@ -33,36 +35,45 @@ const expectedProperties = [
33
35
'provider' ,
34
36
'vote'
35
37
] ;
38
+ const featuresConfig = path . join ( '.' , 'test-data' , 'features-configs' , 'insights-analytics-filter-off.json' ) ;
36
39
const redisVersionRecom = RecommendationIds . redisVersion ;
37
40
const redisTimeSeriesRecom = RecommendationIds . optimizeTimeSeries ;
38
41
const searchVisualizationRecom = RecommendationIds . searchVisualization ;
39
42
const setPasswordRecom = RecommendationIds . setPassword ;
40
43
41
- fixture `Live Recommendations`
44
+ fixture `Live Recommendations`
42
45
. meta ( { type : 'regression' , rte : rte . standalone } )
43
46
. page ( commonUrl )
44
- . beforeEach ( async ( ) => {
47
+ . beforeEach ( async ( ) => {
45
48
await acceptLicenseTermsAndAddDatabaseApi ( ossStandaloneConfig , ossStandaloneConfig . databaseName ) ;
49
+ await refreshFeaturesTestData ( ) ;
50
+ await modifyFeaturesConfigJson ( featuresConfig ) ;
51
+ await updateControlNumber ( 47.2 ) ;
46
52
} )
47
- . afterEach ( async ( ) => {
53
+ . afterEach ( async ( ) => {
48
54
// Delete database
49
55
await deleteStandaloneDatabaseApi ( ossStandaloneConfig ) ;
56
+ await refreshFeaturesTestData ( ) ;
50
57
} ) ;
51
58
test
52
- . before ( async ( ) => {
59
+ . before ( async ( ) => {
53
60
// Add new databases using API
54
61
await acceptLicenseTerms ( ) ;
55
62
await addNewStandaloneDatabasesApi ( databasesForAdding ) ;
56
63
// Reload Page
57
64
await myRedisDatabasePage . reloadPage ( ) ;
58
65
await myRedisDatabasePage . clickOnDBByName ( databasesForAdding [ 1 ] . databaseName ) ;
66
+ await refreshFeaturesTestData ( ) ;
67
+ await modifyFeaturesConfigJson ( featuresConfig ) ;
68
+ await updateControlNumber ( 47.2 ) ;
59
69
} )
60
- . after ( async ( ) => {
70
+ . after ( async ( ) => {
61
71
// Clear and delete database
62
72
await browserPage . InsightsPanel . toggleInsightsPanel ( false ) ;
63
73
await browserPage . OverviewPanel . changeDbIndex ( 0 ) ;
64
74
await browserPage . deleteKeyByName ( keyName ) ;
65
75
await deleteStandaloneDatabasesApi ( databasesForAdding ) ;
76
+ await refreshFeaturesTestData ( ) ;
66
77
} ) ( 'Verify Insights panel Recommendations displaying' , async t => {
67
78
await browserPage . InsightsPanel . toggleInsightsPanel ( true ) ;
68
79
// Verify that "Welcome to recommendations" panel displayed when there are no recommendations
@@ -92,10 +103,14 @@ test
92
103
} ) ;
93
104
test
94
105
. requestHooks ( logger )
95
- . before ( async ( ) => {
106
+ . before ( async ( ) => {
96
107
await acceptLicenseTermsAndAddDatabaseApi ( ossStandaloneV5Config , ossStandaloneV5Config . databaseName ) ;
97
- } ) . after ( async ( ) => {
108
+ await refreshFeaturesTestData ( ) ;
109
+ await modifyFeaturesConfigJson ( featuresConfig ) ;
110
+ await updateControlNumber ( 47.2 ) ;
111
+ } ) . after ( async ( ) => {
98
112
await deleteStandaloneDatabaseApi ( ossStandaloneV5Config ) ;
113
+ await refreshFeaturesTestData ( ) ;
99
114
} ) ( 'Verify that user can upvote recommendations' , async ( ) => {
100
115
const notUsefulVoteOption = 'not useful' ;
101
116
const usefulVoteOption = 'useful' ;
@@ -165,10 +180,14 @@ test('Verify that user can snooze recommendation', async t => {
165
180
await t . expect ( await browserPage . InsightsPanel . getRecommendationByName ( searchVisualizationRecom ) . visible ) . ok ( 'recommendation is not displayed again' ) ;
166
181
} ) ;
167
182
test
168
- . before ( async ( ) => {
183
+ . before ( async ( ) => {
169
184
await acceptLicenseTermsAndAddDatabaseApi ( ossStandaloneV5Config , ossStandaloneV5Config . databaseName ) ;
170
- } ) . after ( async ( ) => {
185
+ await refreshFeaturesTestData ( ) ;
186
+ await modifyFeaturesConfigJson ( featuresConfig ) ;
187
+ await updateControlNumber ( 47.2 ) ;
188
+ } ) . after ( async ( ) => {
171
189
await deleteStandaloneDatabaseApi ( ossStandaloneV5Config ) ;
190
+ await refreshFeaturesTestData ( ) ;
172
191
} ) ( 'Verify that recommendations from database analysis are displayed in Insight panel above live recommendations' , async t => {
173
192
const redisVersionRecomSelector = browserPage . InsightsPanel . getRecommendationByName ( redisVersionRecom ) ;
174
193
@@ -205,9 +224,12 @@ test('Verify that if user clicks on the Analyze button and link, the pop up with
205
224
} ) ;
206
225
//https://redislabs.atlassian.net/browse/RI-4493
207
226
test
208
- . after ( async ( ) => {
227
+ . after ( async ( ) => {
209
228
await browserPage . deleteKeyByName ( keyName ) ;
210
229
await deleteStandaloneDatabasesApi ( databasesForAdding ) ;
230
+ await refreshFeaturesTestData ( ) ;
231
+ await modifyFeaturesConfigJson ( featuresConfig ) ;
232
+ await updateControlNumber ( 47.2 ) ;
211
233
} ) ( 'Verify that key name is displayed for Insights and DA recommendations' , async t => {
212
234
const cliCommand = `JSON.SET ${ keyName } $ '{ "model": "Hyperion", "brand": "Velorim"}'` ;
213
235
await browserPage . Cli . sendCommandInCli ( cliCommand ) ;
0 commit comments