|
| 1 | +import { commonUrl, ossStandaloneRedisGears } from '../../../../helpers/conf'; |
| 2 | +import { rte } from '../../../../helpers/constants'; |
| 3 | +import { DatabaseAPIRequests } from '../../../../helpers/api/api-database'; |
| 4 | +import { Common } from '../../../../helpers/common'; |
| 5 | +import { MyRedisDatabasePage } from '../../../../pageObjects'; |
| 6 | +import { DatabaseHelper } from '../../../../helpers/database'; |
| 7 | +import { BrowserActions } from '../../../../common-actions/browser-actions'; |
| 8 | + |
| 9 | +const myRedisDatabasePage = new MyRedisDatabasePage(); |
| 10 | +const browserActions = new BrowserActions(); |
| 11 | + |
| 12 | +const databaseAPIRequests = new DatabaseAPIRequests(); |
| 13 | +const databaseHelper = new DatabaseHelper(); |
| 14 | + |
| 15 | +let { host, port, databaseName, databaseUsername = '', databasePassword = '' } = ossStandaloneRedisGears; |
| 16 | + |
| 17 | +function generateLink(params: Record<string, any>): string { |
| 18 | + const params1 = Common.generateUrlTParams(params); |
| 19 | + const from = encodeURIComponent(`${redisConnect}?${params1}`); |
| 20 | + return (new URL(`?from=${from}`, commonUrl)).toString(); |
| 21 | +} |
| 22 | + |
| 23 | +const redisConnect = 'redisinsight://databases/connect'; |
| 24 | + |
| 25 | +fixture `Add DB from SM` |
| 26 | + .meta({ type: 'critical_path', rte: rte.none }) |
| 27 | + .afterEach(async() => { |
| 28 | + // Delete all existing connections |
| 29 | + await databaseAPIRequests.deleteAllDatabasesApi(); |
| 30 | + }) |
| 31 | + .beforeEach(async() => { |
| 32 | + await databaseHelper.acceptLicenseTerms(); |
| 33 | + }); |
| 34 | +test |
| 35 | + .page(commonUrl)('Tls dropdown', async t => { |
| 36 | + const connectUrlParams = { |
| 37 | + redisUrl: `redis://${databaseUsername}:${databasePassword}@${host}:${port}`, |
| 38 | + databaseAlias: databaseName, |
| 39 | + redirect: 'workbench', |
| 40 | + requiredCaCert: 'true', |
| 41 | + requiredClientCert: 'true' |
| 42 | + }; |
| 43 | + |
| 44 | + const tooltipText = [ |
| 45 | + 'CA Certificate Name', |
| 46 | + 'CA certificate', |
| 47 | + 'Client Certificate Name', |
| 48 | + 'Client Certificate', |
| 49 | + 'Private Key' |
| 50 | + ]; |
| 51 | + |
| 52 | + await t.navigateTo(generateLink(connectUrlParams)); |
| 53 | + await t.expect(myRedisDatabasePage.AddRedisDatabase.caCertField.textContent).contains('Add new CA certificate', 'add CA certificate is not shown'); |
| 54 | + await t.expect(myRedisDatabasePage.AddRedisDatabase.clientCertField.textContent).contains('Add new certificate', 'add client certificate is not shown'); |
| 55 | + await t.hover(myRedisDatabasePage.AddRedisDatabase.addRedisDatabaseButton); |
| 56 | + |
| 57 | + for (const text of tooltipText) { |
| 58 | + await browserActions.verifyTooltipContainsText(text, true); |
| 59 | + } |
| 60 | + |
| 61 | + // Verify that user can see the Test Connection button enabled/disabled with the same rules as the button to add/apply the changes |
| 62 | + await t.hover(myRedisDatabasePage.AddRedisDatabase.testConnectionBtn); |
| 63 | + for (const text of tooltipText) { |
| 64 | + await browserActions.verifyTooltipContainsText(text, true); |
| 65 | + } |
| 66 | + }); |
0 commit comments