Skip to content

Commit 76c869f

Browse files
add verifcation
1 parent 1d91854 commit 76c869f

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

tests/e2e/tests/web/critical-path/url-handling/url-handling.e2e.ts

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { commonUrl, ossStandaloneRedisGears } from '../../../../helpers/conf';
2+
import { ClientFunction } from 'testcafe';
23
import { ExploreTabs, rte } from '../../../../helpers/constants';
34
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
45
import { Common } from '../../../../helpers/common';
@@ -18,13 +19,14 @@ const { host, port, databaseName, databaseUsername = '', databasePassword = '' }
1819
const username = 'alice&&';
1920
const password = 'p1pp0@&';
2021

21-
function generateLink(params: Record<string, any>): string {
22+
function generateLink(params: Record<string, any>, connectType: string, url: string ): string {
2223
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();
2526
}
2627

2728
const redisConnect = 'redisinsight://databases/connect';
29+
const redisOpen = 'redisinsight://open';
2830

2931
fixture `Add DB from SM`
3032
.meta({ type: 'critical_path', rte: rte.none })
@@ -42,7 +44,7 @@ test
4244
databaseAlias: databaseName,
4345
redirect: 'workbench'
4446
};
45-
await t.navigateTo(generateLink(connectUrlParams));
47+
await t.navigateTo(generateLink(connectUrlParams, redisConnect,commonUrl));
4648
await t.expect(myRedisDatabasePage.AddRedisDatabase.disabledDatabaseInfo.nth(0).getAttribute('title')).contains(host, 'Wrong host value');
4749
await t.expect(myRedisDatabasePage.AddRedisDatabase.disabledDatabaseInfo.nth(1).getAttribute('title')).contains(port, 'Wrong port value');
4850
await t.wait(5_000);
@@ -76,25 +78,36 @@ test
7678
subscriptionType: 'fixed',
7779
planMemoryLimit: '30',
7880
memoryLimitMeasurementUnit: 'mb',
79-
free: 'true',
80-
onboarding: 'true'
81+
free: 'true'
8182
};
8283

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));
8491
await t.wait(10_000);
8592
await t.expect(workbenchPage.submitCommandButton.exists).ok('Redirection to Workbench is not correct');
8693
const tab = await workbenchPage.InsightsPanel.setActiveTab(ExploreTabs.Tutorials);
8794
await t.expect(tab.preselectArea.textContent).contains('INTRODUCTION', 'the tutorial page is incorrect');
8895
await t.expect(tab.preselectArea.textContent).contains('JSON', 'the tutorial is incorrect');
8996

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));
92101
await t.wait(10_000);
102+
await t.expect(workbenchPage.submitCommandButton.exists).ok('Redirection to the same page is not correct');
93103
await t.click(workbenchPage.NavigationPanel.browserButton);
94104
await t.expect(onboardingCardsDialog.showMeAroundButton.exists).ok('onboarding is nor reset');
95105
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);
96110
await t.click(workbenchPage.NavigationPanel.myRedisDBButton);
97111
await t.expect(browserPage.notification.exists).notOk({ timeout: 10000 });
98112
await t.expect(myRedisDatabasePage.dbNameList.child('span').withExactText(databaseName).count).eql(2, 'the same db is added twice');
99-
100113
});

0 commit comments

Comments
 (0)