|
| 1 | +import * as path from 'path'; |
| 2 | +import { rte } from '../../../helpers/constants'; |
| 3 | +import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database'; |
| 4 | +import {BrowserPage, CliPage} from '../../../pageObjects'; |
| 5 | +import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf'; |
| 6 | +import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database'; |
| 7 | +import {Common} from '../../../helpers/common'; |
| 8 | + |
| 9 | +const browserPage = new BrowserPage(); |
| 10 | +const common = new Common(); |
| 11 | +const cliPage = new CliPage(); |
| 12 | + |
| 13 | +const filePath = path.join('..', '..', '..', 'test-data', 'upload-json', 'sample.json'); |
| 14 | +const jsonValues = ['Live JSON generator', '3.1', '"2014-06-25T00:00:00.000Z"', 'true']; |
| 15 | +const keyName = common.generateWord(10); |
| 16 | + |
| 17 | +fixture `Upload json file` |
| 18 | + .meta({ |
| 19 | + type: 'regression', |
| 20 | + rte: rte.standalone |
| 21 | + }) |
| 22 | + .page(commonUrl) |
| 23 | + .beforeEach(async() => { |
| 24 | + await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig, ossStandaloneConfig.databaseName); |
| 25 | + }) |
| 26 | + .afterEach(async() => { |
| 27 | + await cliPage.sendCommandInCli(`DEL ${keyName}`); |
| 28 | + await deleteStandaloneDatabaseApi(ossStandaloneConfig); |
| 29 | + }); |
| 30 | +// https://redislabs.atlassian.net/browse/RI-4061 |
| 31 | +test('Verify that user can insert a JSON from .json file on the form to add a JSON key', async t => { |
| 32 | + await t.click(browserPage.plusAddKeyButton); |
| 33 | + await t.click(browserPage.keyTypeDropDown); |
| 34 | + await t.click(browserPage.jsonOption); |
| 35 | + await t.click(browserPage.addKeyNameInput); |
| 36 | + await t.typeText(browserPage.addKeyNameInput, keyName, { replace: true, paste: true }); |
| 37 | + await t.setFilesToUpload(browserPage.jsonUploadInput, [filePath]); |
| 38 | + await t.click(browserPage.addKeyButton); |
| 39 | + const notification = await browserPage.getMessageText(); |
| 40 | + await t.expect(notification).contains('Key has been added', 'The key added notification not found'); |
| 41 | + // Verify that user can see the JSON value populated from the file when the insert is successful. |
| 42 | + for (const el of jsonValues) { |
| 43 | + await t.expect(browserPage.jsonScalarValue.withText(el).exists).ok(`${el} is not visible, JSON value not correct`); |
| 44 | + } |
| 45 | +}); |
0 commit comments