|
| 1 | +import * as path from 'path'; |
| 2 | +import { MyRedisDatabasePage, WelcomePage } from '../../../pageObjects'; |
| 3 | +import { rte, env } from '../../../helpers/constants'; |
| 4 | +import { DatabaseHelper } from '../../../helpers/database'; |
| 5 | +import { commonUrl } from '../../../helpers/conf'; |
| 6 | +import { DatabaseAPIRequests } from '../../../helpers/api/api-database'; |
| 7 | +import { deleteRowsFromTableInDB } from '../../../helpers/database-scripts'; |
| 8 | +import { modifyFeaturesConfigJson, refreshFeaturesTestData, updateControlNumber } from '../../../helpers/insights'; |
| 9 | + |
| 10 | +const myRedisDatabasePage = new MyRedisDatabasePage(); |
| 11 | +const databaseHelper = new DatabaseHelper(); |
| 12 | +const databaseAPIRequests = new DatabaseAPIRequests(); |
| 13 | +const welcomePage = new WelcomePage(); |
| 14 | + |
| 15 | +const featuresConfigTable = 'features_config'; |
| 16 | +const pathes = { |
| 17 | + defaultRemote: path.join('.', 'test-data', 'features-configs', 'insights-default-remote.json'), |
| 18 | + dockerConfig: path.join('.', 'test-data', 'features-configs', 'sso-docker-build.json'), |
| 19 | + electronConfig: path.join('.', 'test-data', 'features-configs', 'sso-electron-build.json') |
| 20 | +}; |
| 21 | + |
| 22 | +fixture `Cloud SSO` |
| 23 | + .meta({ type: 'regression', rte: rte.standalone }) |
| 24 | + .page(commonUrl) |
| 25 | + .beforeEach(async() => { |
| 26 | + await databaseAPIRequests.deleteAllDatabasesApi(); |
| 27 | + await refreshFeaturesTestData(); |
| 28 | + await databaseHelper.acceptLicenseTerms(); |
| 29 | + }) |
| 30 | + .afterEach(async() => { |
| 31 | + // Delete database |
| 32 | + await databaseAPIRequests.deleteAllDatabasesApi(); |
| 33 | + await refreshFeaturesTestData(); |
| 34 | + }); |
| 35 | +test |
| 36 | + .meta({ env: env.web })('Verify that user can not see the import Cloud databases on the Welcome screen for docker build', async t => { |
| 37 | + // Update remote config .json to config with buildType filter excluding current app build |
| 38 | + await modifyFeaturesConfigJson(pathes.dockerConfig); |
| 39 | + await updateControlNumber(48.2); |
| 40 | + await t.expect(welcomePage.importCloudDbBtn.exists).notOk('Import Cloud database button displayed for docker build'); |
| 41 | + |
| 42 | + // Verify that user can not see the import Cloud databases on the Auto-discovery flow for docker build |
| 43 | + await t.click(welcomePage.addDbAutoBtn); |
| 44 | + // Verify that when SSO flag disabled - Use Cloud API Keys displayed not as dropdown |
| 45 | + await t.expect(myRedisDatabasePage.AddRedisDatabase.useCloudAccount.exists).notOk('Use Cloud Account accordion displayed for docker build'); |
| 46 | + await t.expect(myRedisDatabasePage.AddRedisDatabase.useCloudKeys.exists).notOk('Use Cloud Keys accordion displayed for docker build'); |
| 47 | + }); |
| 48 | +test |
| 49 | + .meta({ env: env.desktop }) |
| 50 | + .before(async() => { |
| 51 | + await databaseAPIRequests.deleteAllDatabasesApi(); |
| 52 | + await databaseHelper.acceptLicenseTerms(); |
| 53 | + }) |
| 54 | + .after(async() => { |
| 55 | + await databaseAPIRequests.deleteAllDatabasesApi(); |
| 56 | + await myRedisDatabasePage.reloadPage(); |
| 57 | + // Update remote config .json to default |
| 58 | + await modifyFeaturesConfigJson(pathes.defaultRemote); |
| 59 | + // Clear features config table |
| 60 | + await deleteRowsFromTableInDB(featuresConfigTable); |
| 61 | + })('Verify that user can see SSO feature if it is enabled in feature config', async t => { |
| 62 | + // Update remote config .json to config with buildType filter excluding current app build |
| 63 | + await modifyFeaturesConfigJson(pathes.dockerConfig); |
| 64 | + await updateControlNumber(48.2); |
| 65 | + // Verify that user can't see SSO feature if it is disabled in feature config |
| 66 | + await t.expect(welcomePage.importCloudDbBtn.exists).notOk('Import Cloud database button displayed when SSO feature disabled'); |
| 67 | + |
| 68 | + // Update remote config .json to config with buildType filter including current app build |
| 69 | + await modifyFeaturesConfigJson(pathes.electronConfig); |
| 70 | + await updateControlNumber(48.2); |
| 71 | + await t.expect(welcomePage.importCloudDbBtn.exists).ok('Import Cloud database button not displayed when SSO feature enabled'); |
| 72 | + |
| 73 | + await t.click(welcomePage.addDbAutoBtn); |
| 74 | + // Verify that RE Cloud auto-discovery options Use Cloud Account and Use Cloud API Keys are displayed on Welcome screen |
| 75 | + await t.expect(myRedisDatabasePage.AddRedisDatabase.useCloudAccount.exists).ok('Use Cloud Account accordion not displayed when SSO feature enabled'); |
| 76 | + await t.expect(myRedisDatabasePage.AddRedisDatabase.useCloudKeys.exists).ok('Use Cloud Keys accordion not displayed when SSO feature enabled'); |
| 77 | + }); |
0 commit comments