Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/e2e/pageObjects/browser-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export class BrowserPage {
listKeyElementEditorInput = Selector('[data-testid=element-value-editor]');
stringKeyValueInput = Selector('[data-testid=string-value]');
jsonKeyValueInput = Selector('[data-mode-id=json]');
jsonUploadInput = Selector('[data-testid=upload-input-file]');
setMemberInput = Selector('[data-testid=member-name]');
zsetMemberScoreInput = Selector('[data-testid=member-score]');
filterByPatterSearchInput = Selector('[data-testid=search-key]');
Expand Down
32 changes: 32 additions & 0 deletions tests/e2e/test-data/upload-json/sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"product": "Live JSON generator",
"version": 3.1,
"releaseDate": "2014-06-25T00:00:00.000Z",
"demo": true,
"person": {
"id": 12345,
"name": "John Doe",
"phones": {
"home": "800-123-4567",
"mobile": "877-123-1234"
},
"email": [
"jd@example.com",
"jd@example.org"
],
"dateOfBirth": "1980-01-02T00:00:00.000Z",
"registered": true,
"emergencyContacts": [
{
"name": "Jane Doe",
"phone": "888-555-1212",
"relationship": "spouse"
},
{
"name": "Justin Doe",
"phone": "877-123-1212",
"relationship": "parent"
}
]
}
}
45 changes: 45 additions & 0 deletions tests/e2e/tests/regression/browser/upload-json-key.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import * as path from 'path';
import { rte } from '../../../helpers/constants';
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
import {BrowserPage, CliPage} from '../../../pageObjects';
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
import {Common} from '../../../helpers/common';

const browserPage = new BrowserPage();
const common = new Common();
const cliPage = new CliPage();

const filePath = path.join('..', '..', '..', 'test-data', 'upload-json', 'sample.json');
const jsonValues = ['Live JSON generator', '3.1', '"2014-06-25T00:00:00.000Z"', 'true'];
const keyName = common.generateWord(10);

fixture `Upload json file`
.meta({
type: 'regression',
rte: rte.standalone
})
.page(commonUrl)
.beforeEach(async() => {
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig, ossStandaloneConfig.databaseName);
})
.afterEach(async() => {
await cliPage.sendCommandInCli(`DEL ${keyName}`);
await deleteStandaloneDatabaseApi(ossStandaloneConfig);
});
// https://redislabs.atlassian.net/browse/RI-4061
test('Verify that user can insert a JSON from .json file on the form to add a JSON key', async t => {
await t.click(browserPage.plusAddKeyButton);
await t.click(browserPage.keyTypeDropDown);
await t.click(browserPage.jsonOption);
await t.click(browserPage.addKeyNameInput);
await t.typeText(browserPage.addKeyNameInput, keyName, { replace: true, paste: true });
await t.setFilesToUpload(browserPage.jsonUploadInput, [filePath]);
await t.click(browserPage.addKeyButton);
const notification = await browserPage.getMessageText();
await t.expect(notification).contains('Key has been added', 'The key added notification not found');
// Verify that user can see the JSON value populated from the file when the insert is successful.
for (const el of jsonValues) {
await t.expect(browserPage.jsonScalarValue.withText(el).exists).ok(`${el} is not visible, JSON value not correct`);
}
});