|
1 | 1 | import { BrowserPage } from '../../../../pageObjects';
|
2 |
| -import { commonUrl, ossStandaloneBigConfig } from '../../../../helpers/conf'; |
| 2 | +import { commonUrl, ossStandaloneBigConfig, ossStandaloneV8Config } from '../../../../helpers/conf'; |
3 | 3 | import { rte } from '../../../../helpers/constants';
|
4 | 4 | import { DatabaseHelper } from '../../../../helpers/database';
|
5 | 5 | import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
|
6 | 6 | import { BrowserActions } from '../../../../common-actions/browser-actions';
|
| 7 | +import { APIKeyRequests } from '../../../../helpers/api/api-keys'; |
| 8 | +import { HashKeyParameters } from '../../../../pageObjects/browser-page'; |
7 | 9 |
|
8 | 10 | const browserPage = new BrowserPage();
|
9 | 11 | const browserActions = new BrowserActions();
|
10 | 12 | const databaseHelper = new DatabaseHelper();
|
11 | 13 | const databaseAPIRequests = new DatabaseAPIRequests();
|
| 14 | +const apiKeyRequests = new APIKeyRequests(); |
| 15 | + |
| 16 | +let keyNames: string[]; |
12 | 17 |
|
13 | 18 | fixture `Delimiter tests`
|
14 | 19 | .meta({ type: 'critical_path', rte: rte.standalone })
|
15 | 20 | .page(commonUrl)
|
16 |
| - .beforeEach(async() => { |
| 21 | + .beforeEach(async () => { |
17 | 22 | await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneBigConfig);
|
18 | 23 | })
|
19 |
| - .afterEach(async() => { |
| 24 | + .afterEach(async () => { |
20 | 25 | await databaseAPIRequests.deleteStandaloneDatabaseApi(ossStandaloneBigConfig);
|
21 | 26 | });
|
22 | 27 | test('Verify that user can see that input is not saved when the Cancel button is clicked', async t => {
|
23 | 28 | // Switch to tree view
|
24 | 29 | await t.click(browserPage.treeViewButton);
|
25 | 30 | await t.click(browserPage.TreeView.treeViewSettingsBtn);
|
26 | 31 | // Check the default delimiter value
|
27 |
| - await t.expect(browserPage.TreeView.treeViewDelimiterInput.value).eql(':', 'Default delimiter not applied'); |
| 32 | + await t.expect(browserPage.TreeView.FiltersDialog.getDelimiterBadgeByTitle(':').exists).eql(true, 'Default delimiter not applied'); |
28 | 33 | // Apply new value to the field
|
29 |
| - await t.typeText(browserPage.TreeView.treeViewDelimiterInput, 'test', { replace: true }); |
| 34 | + await browserPage.TreeView.FiltersDialog.removeDelimiterItem(':'); |
| 35 | + await browserPage.TreeView.FiltersDialog.addDelimiterItem('test'); |
30 | 36 | // Click on Cancel button
|
31 |
| - await t.click(browserPage.TreeView.treeViewDelimiterValueCancel); |
| 37 | + await t.click(browserPage.TreeView.FiltersDialog.treeViewDelimiterValueCancel); |
32 | 38 | // Check the previous delimiter value
|
33 | 39 | await t.click(browserPage.TreeView.treeViewSettingsBtn);
|
34 |
| - await t.expect(browserPage.TreeView.treeViewDelimiterInput.value).eql(':', 'Previous delimiter not applied'); |
35 |
| - await t.click(browserPage.TreeView.treeViewDelimiterValueCancel); |
| 40 | + await t.expect(browserPage.TreeView.FiltersDialog.getDelimiterBadgeByTitle(':').exists).eql(true, 'Previous delimiter not applied'); |
| 41 | + await t.expect(browserPage.TreeView.FiltersDialog.getDelimiterBadgeByTitle('test').exists).eql(false, 'Previous delimiter not applied'); |
| 42 | + await t.click(browserPage.TreeView.FiltersDialog.treeViewDelimiterValueCancel); |
36 | 43 |
|
37 | 44 | // Change delimiter
|
38 | 45 | await browserPage.TreeView.changeDelimiterInTreeView('-');
|
39 | 46 | // Verify that when user changes the delimiter and clicks on Save button delimiter is applied
|
40 |
| - await browserActions.checkTreeViewFoldersStructure([['device_us', 'west'], ['mobile_eu', 'central'], ['mobile_us', 'east'], ['user_us', 'west'], ['device_eu', 'central'], ['user_eu', 'central']], '-'); |
| 47 | + await browserActions.checkTreeViewFoldersStructure([['device_us', 'west'], ['mobile_eu', 'central'], ['mobile_us', 'east'], ['user_us', 'west'], ['device_eu', 'central'], ['user_eu', 'central']], ['-']); |
41 | 48 | });
|
| 49 | +test |
| 50 | + .before(async () => { |
| 51 | + await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneV8Config); |
| 52 | + keyNames = [ |
| 53 | + `device:common-dev`, |
| 54 | + `device:common-stage`, |
| 55 | + `device:common1-stage`, |
| 56 | + `mobile:common-dev`, |
| 57 | + `mobile:common-stage` |
| 58 | + ]; |
| 59 | + for (const keyName of keyNames) { |
| 60 | + let hashKeyParameters: HashKeyParameters = { |
| 61 | + keyName: keyName, |
| 62 | + fields: [ |
| 63 | + { |
| 64 | + field: 'field', |
| 65 | + value: 'value', |
| 66 | + }, |
| 67 | + ], |
| 68 | + } |
| 69 | + await apiKeyRequests.addHashKeyApi( |
| 70 | + hashKeyParameters, |
| 71 | + ossStandaloneV8Config, |
| 72 | + ) |
| 73 | + } |
| 74 | + await browserPage.reloadPage(); |
| 75 | + }) |
| 76 | + .after(async () => { |
| 77 | + for (const keyName of keyNames) { |
| 78 | + await apiKeyRequests.deleteKeyByNameApi(keyName, ossStandaloneV8Config.databaseName); |
| 79 | + } |
| 80 | + await databaseAPIRequests.deleteStandaloneDatabaseApi(ossStandaloneV8Config); |
| 81 | + })('Verify that user can set multiple delimiters in the tree view', async t => { |
| 82 | + // Switch to tree view |
| 83 | + await t.click(browserPage.treeViewButton); |
| 84 | + // Verify folders ordering with default delimiter |
| 85 | + await browserActions.checkTreeViewFoldersStructure([['device'], ['mobile']], [':']); |
| 86 | + await t.click(browserPage.TreeView.treeViewSettingsBtn); |
| 87 | + // Apply new value to the field |
| 88 | + await browserPage.TreeView.FiltersDialog.addDelimiterItem('-'); |
| 89 | + await t.click(browserPage.TreeView.FiltersDialog.treeViewDelimiterValueSave); |
| 90 | + // Verify that when user changes the delimiter and clicks on Save button delimiter is applied |
| 91 | + await browserActions.checkTreeViewFoldersStructure([['device', 'common'], ['device', 'common1'], ['mobile', 'common']], [':', '-']); |
| 92 | + |
| 93 | + // Verify that namespace names tooltip contains valid names and delimiter |
| 94 | + await t.click(browserActions.getNodeSelector('device')); |
| 95 | + await t.hover(browserActions.getNodeSelector('device:|-common:|-')); |
| 96 | + await browserActions.verifyTooltipContainsText('device:common-stage-*', true); |
| 97 | + }); |
0 commit comments