|
1 | 1 | import * as path from 'path';
|
2 | 2 | import { rte } from '../../../helpers/constants';
|
3 | 3 | import { BrowserPage, MyRedisDatabasePage } from '../../../pageObjects';
|
4 |
| -import { commonUrl } from '../../../helpers/conf'; |
| 4 | +import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf'; |
5 | 5 | import { DatabaseHelper } from '../../../helpers/database';
|
6 | 6 | import { DatabaseAPIRequests } from '../../../helpers/api/api-database';
|
7 | 7 | import { DatabasesActions } from '../../../common-actions/databases-actions';
|
@@ -90,41 +90,47 @@ fixture `Import databases`
|
90 | 90 | // Delete all existing connections
|
91 | 91 | await databaseAPIRequests.deleteAllDatabasesApi();
|
92 | 92 | });
|
93 |
| -test('Connection import modal window', async t => { |
94 |
| - const tooltipText = 'Import Database Connections'; |
95 |
| - const defaultText = 'Select or drag and drop a file'; |
96 |
| - const parseFailedMsg = 'Failed to add database connections'; |
97 |
| - const parseFailedMsg2 = `Unable to parse ${fileNames.racompassInvalidJson}`; |
| 93 | +test |
| 94 | + .before(async() => { |
| 95 | + await databaseAPIRequests.deleteAllDatabasesApi(); |
| 96 | + await databaseHelper.acceptLicenseTerms(); |
| 97 | + await databaseAPIRequests.addNewStandaloneDatabaseApi(ossStandaloneConfig); |
| 98 | + await myRedisDatabasePage.reloadPage(); |
| 99 | + })('Connection import modal window', async t => { |
| 100 | + const tooltipText = 'Import Database Connections'; |
| 101 | + const defaultText = 'Select or drag and drop a file'; |
| 102 | + const parseFailedMsg = 'Failed to add database connections'; |
| 103 | + const parseFailedMsg2 = `Unable to parse ${fileNames.racompassInvalidJson}`; |
98 | 104 |
|
99 |
| - // Verify that user can see the “Import Database Connections” tooltip |
100 |
| - await t.expect(myRedisDatabasePage.importDatabasesBtn.visible).ok('The import databases button not displayed'); |
101 |
| - await t.hover(myRedisDatabasePage.importDatabasesBtn); |
102 |
| - await t.expect(browserPage.tooltip.innerText).contains(tooltipText, 'The tooltip message not displayed/correct'); |
| 105 | + // Verify that user can see the “Import Database Connections” tooltip |
| 106 | + await t.expect(myRedisDatabasePage.importDatabasesBtn.visible).ok('The import databases button not displayed'); |
| 107 | + await t.hover(myRedisDatabasePage.importDatabasesBtn); |
| 108 | + await t.expect(browserPage.tooltip.innerText).contains(tooltipText, 'The tooltip message not displayed/correct'); |
103 | 109 |
|
104 |
| - // Verify that Import dialogue is not closed when clicking any area outside the box |
105 |
| - await t.click(myRedisDatabasePage.importDatabasesBtn); |
106 |
| - await t.expect(myRedisDatabasePage.importDbDialog.exists).ok('Import Database Connections dialog not opened'); |
107 |
| - await t.click(myRedisDatabasePage.NavigationPanel.myRedisDBButton); |
108 |
| - await t.expect(myRedisDatabasePage.importDbDialog.exists).ok('Import Database Connections dialog not displayed'); |
| 110 | + // Verify that Import dialogue is not closed when clicking any area outside the box |
| 111 | + await t.click(myRedisDatabasePage.importDatabasesBtn); |
| 112 | + await t.expect(myRedisDatabasePage.importDbDialog.exists).ok('Import Database Connections dialog not opened'); |
| 113 | + await t.click(myRedisDatabasePage.NavigationPanel.myRedisDBButton); |
| 114 | + await t.expect(myRedisDatabasePage.importDbDialog.exists).ok('Import Database Connections dialog not displayed'); |
109 | 115 |
|
110 |
| - // Verify that user see the message when parse error appears |
111 |
| - await t |
112 |
| - .setFilesToUpload(myRedisDatabasePage.importDatabaseInput, [filePathes.racompassInvalidJsonPath]) |
113 |
| - .click(myRedisDatabasePage.submitImportBtn) |
114 |
| - .expect(myRedisDatabasePage.failedImportMessage.exists).ok('Failed to add database message not displayed') |
115 |
| - .expect(myRedisDatabasePage.failedImportMessage.textContent).contains(parseFailedMsg) |
116 |
| - .expect(myRedisDatabasePage.failedImportMessage.textContent).contains(parseFailedMsg2); |
| 116 | + // Verify that user see the message when parse error appears |
| 117 | + await t |
| 118 | + .setFilesToUpload(myRedisDatabasePage.importDatabaseInput, [filePathes.racompassInvalidJsonPath]) |
| 119 | + .click(myRedisDatabasePage.submitImportBtn) |
| 120 | + .expect(myRedisDatabasePage.failedImportMessage.exists).ok('Failed to add database message not displayed') |
| 121 | + .expect(myRedisDatabasePage.failedImportMessage.textContent).contains(parseFailedMsg) |
| 122 | + .expect(myRedisDatabasePage.failedImportMessage.textContent).contains(parseFailedMsg2); |
117 | 123 |
|
118 |
| - // Verify that user can remove file from import input |
119 |
| - await t.click(myRedisDatabasePage.closeDialogBtn); |
120 |
| - await t.click(myRedisDatabasePage.importDatabasesBtn); |
121 |
| - await t.setFilesToUpload(myRedisDatabasePage.importDatabaseInput, [rdmData.path]); |
122 |
| - // update after resolving testcafe Native Automation mode limitations |
123 |
| - // await t.expect(myRedisDatabasePage.importDbDialog.textContent).contains(fileNames.rdmFullJson, 'Filename not displayed in import input'); |
124 |
| - // Click on remove button |
125 |
| - await t.click(myRedisDatabasePage.removeImportedFileBtn); |
126 |
| - await t.expect(myRedisDatabasePage.importDbDialog.textContent).contains(defaultText, 'File not removed from import input'); |
127 |
| -}); |
| 124 | + // Verify that user can remove file from import input |
| 125 | + await t.click(myRedisDatabasePage.closeDialogBtn); |
| 126 | + await t.click(myRedisDatabasePage.importDatabasesBtn); |
| 127 | + await t.setFilesToUpload(myRedisDatabasePage.importDatabaseInput, [rdmData.path]); |
| 128 | + // update after resolving testcafe Native Automation mode limitations |
| 129 | + // await t.expect(myRedisDatabasePage.importDbDialog.textContent).contains(fileNames.rdmFullJson, 'Filename not displayed in import input'); |
| 130 | + // Click on remove button |
| 131 | + await t.click(myRedisDatabasePage.removeImportedFileBtn); |
| 132 | + await t.expect(myRedisDatabasePage.importDbDialog.textContent).contains(defaultText, 'File not removed from import input'); |
| 133 | + }); |
128 | 134 | test('Connection import from JSON', async t => {
|
129 | 135 | // Verify that user can import database with mandatory/optional fields
|
130 | 136 | await databasesActions.importDatabase(rdmData);
|
|
0 commit comments