diff --git a/tests/e2e/tests/web/critical-path/url-handling/url-handling.e2e.ts b/tests/e2e/tests/web/critical-path/url-handling/url-handling.e2e.ts index 55a1ee61be..c24b2cdfea 100644 --- a/tests/e2e/tests/web/critical-path/url-handling/url-handling.e2e.ts +++ b/tests/e2e/tests/web/critical-path/url-handling/url-handling.e2e.ts @@ -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'; @@ -18,13 +19,14 @@ const { host, port, databaseName, databaseUsername = '', databasePassword = '' } const username = 'alice&&'; const password = 'p1pp0@&'; -function generateLink(params: Record): string { +function generateLink(params: Record, 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 }) @@ -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); @@ -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'); - });