Skip to content

Commit 9024939

Browse files
authored
Merge pull request #1208 from RedisInsight/e2e/feature/RI-3329_survey
[E2E] add e2e for user survey
2 parents 29ec8d5 + caff470 commit 9024939

File tree

5 files changed

+68
-14
lines changed

5 files changed

+68
-14
lines changed

tests/e2e/helpers/common.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {RequestMock, t} from 'testcafe';
1+
import { ClientFunction, RequestMock, t } from 'testcafe';
22
import { Chance } from 'chance';
33
import {apiUrl, commonUrl} from './conf';
44

@@ -48,7 +48,7 @@ export class Common {
4848
* Create array of keys and values for using in OSS Cluster
4949
* @param length The amount of array elements
5050
*/
51-
async createArrayWithKeyValueForOSSCluster(length: number): Promise<string[]> {
51+
async createArrayWithKeyValueForOSSCluster(length: number): Promise<string[]> {
5252
const arr: string[] = [];
5353
for(let i = 1; i <= length * 2; i++) {
5454
arr[i] = `{user1}:${chance.word({ length: 10 })}-key${i}`;
@@ -130,4 +130,13 @@ export class Common {
130130
async reloadPage(): Promise<void> {
131131
await t.eval(() => location.reload());
132132
}
133+
134+
/**
135+
* Check opened URL
136+
* @param expectedUrl Expected link that is compared with actual
137+
*/
138+
async checkURL(expectedUrl: string): Promise<void> {
139+
const getPageUrl = ClientFunction(() => window.location.href);
140+
await t.expect(getPageUrl()).eql(expectedUrl, 'Opened URL is not correct');
141+
}
133142
}

tests/e2e/pageObjects/browser-page.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export class BrowserPage {
9999
streamMessagesContainer = Selector('[data-testid=stream-messages-container]');
100100
//LINKS
101101
internalLinkToWorkbench = Selector('[data-testid=internal-workbench-link]');
102+
userSurveyLink = Selector('[data-testid=user-survey-link]');
102103
//OPTION ELEMENTS
103104
stringOption = Selector('#string');
104105
jsonOption = Selector('#ReJSON-RL');
@@ -597,7 +598,7 @@ export class BrowserPage {
597598
* Edit List key value from details
598599
* @param value The value of the key
599600
*/
600-
async editListKeyValue(value: string): Promise<void> {
601+
async editListKeyValue(value: string): Promise<void> {
601602
await t
602603
.click(this.editListButton)
603604
.typeText(this.listKeyElementEditorInput, value, { replace: true, paste: true })
@@ -613,7 +614,7 @@ export class BrowserPage {
613614
* Edit JSON key value from details
614615
* @param value The value of the key
615616
*/
616-
async editJsonKeyValue(value: string): Promise<void> {
617+
async editJsonKeyValue(value: string): Promise<void> {
617618
await t
618619
.click(this.jsonScalarValue)
619620
.typeText(this.inlineItemEditor, value, { replace: true, paste: true })
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
2+
import { env, rte } from '../../../helpers/constants';
3+
import { BrowserPage, SlowLogPage, MyRedisDatabasePage } from '../../../pageObjects';
4+
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
5+
import { Common } from '../../../helpers/common';
6+
import { deleteAllDatabasesApi } from '../../../helpers/api/api-database';
7+
8+
const browserPage = new BrowserPage();
9+
const slowLogPage = new SlowLogPage();
10+
const myRedisDatabasePage = new MyRedisDatabasePage();
11+
const common = new Common();
12+
const externalPageLink = 'https://www.surveymonkey.com/r/redisinsight';
13+
14+
fixture `User Survey`
15+
.meta({
16+
type: 'regression',
17+
rte: rte.standalone,
18+
env: env.web
19+
})
20+
.page(commonUrl)
21+
.beforeEach(async() => {
22+
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig, ossStandaloneConfig.databaseName);
23+
});
24+
test('Verify that user can use survey link', async t => {
25+
// Verify that user can see survey link on any page inside of DB
26+
// Browser page
27+
await t.click(browserPage.userSurveyLink);
28+
// Verify that when users click on RI survey, they are redirected to https://www.surveymonkey.com/r/redisinsight
29+
await common.checkURL(externalPageLink);
30+
await t.switchToParentWindow();
31+
// Workbench page
32+
await t.click(myRedisDatabasePage.workbenchButton);
33+
await t.expect(browserPage.userSurveyLink.visible).ok('Survey Link is not displayed');
34+
// Slow Log page
35+
await t.click(slowLogPage.slowLogPageButton);
36+
await t.expect(browserPage.userSurveyLink.visible).ok('Survey Link is not displayed');
37+
// PubSub page
38+
await t.click(myRedisDatabasePage.pubSubButton);
39+
await t.expect(browserPage.userSurveyLink.visible).ok('Survey Link is not displayed');
40+
// Verify that user cannot see survey link for list of databases page
41+
await t.click(myRedisDatabasePage.myRedisDBButton);
42+
await t.expect(browserPage.userSurveyLink.visible).notOk('Survey Link is visible');
43+
// Verify that user cannot see survey link for welcome page
44+
await deleteAllDatabasesApi();
45+
await common.reloadPage();
46+
await t.expect(browserPage.userSurveyLink.visible).notOk('Survey Link is visible');
47+
});

tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ClientFunction } from 'testcafe';
21
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
32
import { Common } from '../../../helpers/common';
43
import { CliPage } from '../../../pageObjects';
@@ -22,8 +21,6 @@ let commandsArgumentsToCheck: string[] = [];
2221
let externalPageLink = '';
2322
let externalPageLinks: string[] = [];
2423

25-
const getPageUrl = ClientFunction(() => window.location.href);
26-
2724
fixture `CLI Command helper`
2825
.meta({ type: 'regression' })
2926
.page(commonUrl)
@@ -104,7 +101,7 @@ test
104101
//Click on Read More link for selected command
105102
await t.click(cliPage.readMoreButton);
106103
//Check new opened window page with the correct URL
107-
await t.expect(getPageUrl()).eql(externalPageLink, 'The opened page');
104+
await common.checkURL(externalPageLink);
108105
await t.switchToParentWindow();
109106
});
110107
test
@@ -123,7 +120,7 @@ test
123120
//Click on Read More link for selected command
124121
await t.click(cliPage.readMoreButton);
125122
//Check new opened window page with the correct URL
126-
await t.expect(getPageUrl()).eql(externalPageLink, 'The opened page');
123+
await common.checkURL(externalPageLink);
127124
await t.switchToParentWindow();
128125
});
129126
test
@@ -142,7 +139,8 @@ test
142139
//Click on Read More link for selected command
143140
await t.click(cliPage.readMoreButton);
144141
//Check new opened window page with the correct URL
145-
await t.expect(getPageUrl()).eql(externalPageLink, 'The opened page');
142+
await common.checkURL(externalPageLink);
143+
// await t.expect(getPageUrl()).eql(externalPageLink, 'The opened page');
146144
await t.switchToParentWindow();
147145
});
148146
test
@@ -179,7 +177,7 @@ test
179177
//Click on Read More link for selected command
180178
await t.click(cliPage.readMoreButton);
181179
//Check new opened window page with the correct URL
182-
await t.expect(getPageUrl()).eql(externalPageLinks[i], 'The opened page');
180+
await common.checkURL(externalPageLinks[i]);
183181
//Close the window with external link to switch to the application window
184182
await t.closeWindow();
185183
i++;
@@ -202,7 +200,7 @@ test
202200
//Verify that user can use Read More link for Gears group in Command Helper (RedisGears module)
203201
await t.click(cliPage.readMoreButton);
204202
//Check new opened window page with the correct URL
205-
await t.expect(getPageUrl()).eql(externalPageLink, 'The opened page');
203+
await common.checkURL(externalPageLink);
206204
//Close the window with external link to switch to the application window
207205
await t.closeWindow();
208206
});
@@ -243,7 +241,7 @@ test
243241
//Verify that user can use Read More link for Bloom, Cuckoo, CMS, TDigest, TopK groups in Command Helper (RedisBloom module).
244242
await t.click(cliPage.readMoreButton);
245243
//Check new opened window page with the correct URL
246-
await t.expect(getPageUrl()).eql(externalPageLinks[i], 'The opened page');
244+
await common.checkURL(externalPageLinks[i]);
247245
//Close the window with external link to switch to the application window
248246
await t.closeWindow();
249247
i++;

tests/e2e/tests/regression/database/database-sorting.e2e.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { t } from 'testcafe';
21
import { acceptLicenseTerms } from '../../../helpers/database';
32
import {
43
discoverSentinelDatabaseApi,

0 commit comments

Comments
 (0)