Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions tests/e2e/tests/web/critical-path/url-handling/url-handling.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { commonUrl, ossStandaloneRedisGears } from '../../../../helpers/conf';
import { ClientFunction } from 'testcafe';
import { ExploreTabs, rte } from '../../../../helpers/constants';
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
import { Common } from '../../../../helpers/common';
Expand All @@ -18,13 +19,14 @@ const { host, port, databaseName, databaseUsername = '', databasePassword = '' }
const username = 'alice&&';
const password = 'p1pp0@&';

function generateLink(params: Record<string, any>): string {
function generateLink(params: Record<string, any>, connectType: string, url: string ): string {
const params1 = Common.generateUrlTParams(params);
const from = encodeURIComponent(`${redisConnect}?${params1}`);
return (new URL(`?from=${from}`, commonUrl)).toString();
const from = encodeURIComponent(`${connectType}?${params1}`);
return (new URL(`?from=${from}`, url)).toString();
}

const redisConnect = 'redisinsight://databases/connect';
const redisOpen = 'redisinsight://open';

fixture `Add DB from SM`
.meta({ type: 'critical_path', rte: rte.none })
Expand All @@ -42,7 +44,7 @@ test
databaseAlias: databaseName,
redirect: 'workbench'
};
await t.navigateTo(generateLink(connectUrlParams));
await t.navigateTo(generateLink(connectUrlParams, redisConnect,commonUrl));
await t.expect(myRedisDatabasePage.AddRedisDatabase.disabledDatabaseInfo.nth(0).getAttribute('title')).contains(host, 'Wrong host value');
await t.expect(myRedisDatabasePage.AddRedisDatabase.disabledDatabaseInfo.nth(1).getAttribute('title')).contains(port, 'Wrong port value');
await t.wait(5_000);
Expand Down Expand Up @@ -76,25 +78,36 @@ test
subscriptionType: 'fixed',
planMemoryLimit: '30',
memoryLimitMeasurementUnit: 'mb',
free: 'true',
onboarding: 'true'
free: 'true'
};

await t.navigateTo(generateLink(connectUrlParams));
const connectUrlParams2 = {
redirect: '/_',
onboarding: 'true',
copilot: 'false'
};

await t.navigateTo(generateLink(connectUrlParams, redisConnect,commonUrl));
await t.wait(10_000);
await t.expect(workbenchPage.submitCommandButton.exists).ok('Redirection to Workbench is not correct');
const tab = await workbenchPage.InsightsPanel.setActiveTab(ExploreTabs.Tutorials);
await t.expect(tab.preselectArea.textContent).contains('INTRODUCTION', 'the tutorial page is incorrect');
await t.expect(tab.preselectArea.textContent).contains('JSON', 'the tutorial is incorrect');

//Verify that the same db is not added
await t.navigateTo(generateLink(connectUrlParams));
const getPageUrl = ClientFunction(() => window.location.href);
const url = await getPageUrl();

await t.navigateTo(generateLink(connectUrlParams2, redisOpen, url));
await t.wait(10_000);
await t.expect(workbenchPage.submitCommandButton.exists).ok('Redirection to the same page is not correct');
await t.click(workbenchPage.NavigationPanel.browserButton);
await t.expect(onboardingCardsDialog.showMeAroundButton.exists).ok('onboarding is nor reset');
await t.click(onboardingCardsDialog.skipTourButton);

//Verify that the same db is not added
await t.navigateTo(generateLink(connectUrlParams, redisConnect,commonUrl));
await t.wait(10_000);
await t.click(workbenchPage.NavigationPanel.myRedisDBButton);
await t.expect(browserPage.notification.exists).notOk({ timeout: 10000 });
await t.expect(myRedisDatabasePage.dbNameList.child('span').withExactText(databaseName).count).eql(2, 'the same db is added twice');

});
Loading