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
3 changes: 2 additions & 1 deletion tests/e2e/helpers/common.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as path from 'path';
import * as fs from 'fs';
import * as archiver from 'archiver';
import { ClientFunction, RequestMock, t } from 'testcafe';
import { Chance } from 'chance';
import { apiUrl, commonUrl } from './conf';
const archiver = require('archiver');

const chance = new Chance();

Expand Down Expand Up @@ -221,6 +221,7 @@ export class Common {
const parsedJson = JSON.parse(fs.readFileSync(path, 'utf-8'));
return parsedJson[property];
}

/**
* Create Zip archive from folder
* @param folderPath Path to folder to archive
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build:ui": "yarn --cwd ../../ build:ui",
"redis:last": "docker run --name redis-last-version -p 7777:6379 -d redislabs/redismod",
"start:app": "cross-env yarn start:api",
"test:chrome": "testcafe --compiler-options typescript.configPath=tsconfig.testcafe.json --cache --allow-insecure-localhost --ignore-certificate-errors --disable-multiple-windows --concurrency 1 chrome tests/ -r html:./report/report.html,spec -e -s takeOnFails=true,path=report/screenshots/,pathPattern=${OS}_${BROWSER}/${DATE}_${TIME}/${FIXTURE}_${TEST}_${FILE_INDEX}.png",
"test:chrome": "testcafe --compiler-options typescript.configPath=tsconfig.testcafe.json --cache --allow-insecure-localhost --disable-multiple-windows --concurrency 1 chrome tests/ -r html:./report/report.html,spec -e -s takeOnFails=true,path=report/screenshots/,pathPattern=${OS}_${BROWSER}/${DATE}_${TIME}/${FIXTURE}_${TEST}_${FILE_INDEX}.png",
"test:chrome:ci": "ts-node ./web.runner.ts",
"test": "yarn test:chrome",
"lint": "eslint . --ext .ts,.js,.tsx,.jsx",
Expand Down
21 changes: 16 additions & 5 deletions tests/e2e/pageObjects/browser-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,8 @@ export class BrowserPage extends InstancePage {
*/
async addJsonKeyOnTheSameLevel(jsonKey: string, jsonKeyValue: string): Promise<void> {
await t.click(this.addJsonObjectButton);
await t.typeText(this.jsonKeyInput, jsonKey, { replace: true, paste: true });
await t.typeText(this.jsonValueInput, jsonKeyValue, { replace: true, paste: true });
await t.typeText(this.jsonKeyInput, jsonKey, { paste: true });
await t.typeText(this.jsonValueInput, jsonKeyValue, { paste: true });
await t.click(this.applyButton);
}

Expand All @@ -854,8 +854,19 @@ export class BrowserPage extends InstancePage {
async addJsonKeyInsideStructure(jsonKey: string, jsonKeyValue: string): Promise<void> {
await t.click(this.expandJsonObject);
await t.click(this.addJsonFieldButton);
await t.typeText(this.jsonKeyInput, jsonKey, { replace: true, paste: true });
await t.typeText(this.jsonValueInput, jsonKeyValue, { replace: true, paste: true });
await t.typeText(this.jsonKeyInput, jsonKey, { paste: true });
await t.typeText(this.jsonValueInput, jsonKeyValue, { paste: true });
await t.click(this.applyButton);
}

/**
* Add json value inside the Json structure
* @param jsonKeyValue The value of the json key
*/
async addJsonValueInsideStructure(jsonKeyValue: string): Promise<void> {
await t.click(this.expandJsonObject);
await t.click(this.addJsonFieldButton);
await t.typeText(this.jsonValueInput, jsonKeyValue, { paste: true });
await t.click(this.applyButton);
}

Expand All @@ -868,7 +879,7 @@ export class BrowserPage extends InstancePage {
await t.click(this.expandJsonObject);
}
await t.click(this.editJsonObjectButton);
await t.typeText(this.jsonValueInput, jsonStructure, { replace: true, paste: true });
await t.typeText(this.jsonValueInput, jsonStructure, { paste: true });
await t.click(this.applyEditButton);
}

Expand Down
216 changes: 216 additions & 0 deletions tests/e2e/test-data/big-json/big-json.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
{
"_id": "666c56b9f4f88278244b6dc8",
"index": 0,
"guid": "1743c04d-b95a-4ab9-9e8c-51b0e9b7e009",
"isActive": true,
"balance": "$2,469.16",
"picture": "http://placehold.it/32x32",
"age": 32,
"eyeColor": "green",
"name": "Camille Sims",
"gender": "female",
"company": "ZBOO",
"email": "camillesims@zboo.com",
"phone": "+1 (942) 411-2857",
"address": "817 Graham Avenue, Ezel, South Carolina, 5845",
"about": "Ut mollit elit eu veniam non do ut in aliquip. Lorem culpa laborum non aliqua non eiusmod amet cupidatat sunt officia elit elit. Ut officia elit adipisicing labore ex deserunt. Amet sit excepteur quis ut adipisicing occaecat proident occaecat in minim.\r\n",
"registered": "2017-08-30T02:25:04 -02:00",
"latitude": 7.648678,
"longitude": 109.700128,
"tags": [
"sit",
"irure",
"nisi",
"ullamco",
"sint",
"consequat",
"do",
"ad",
"elit",
"deserunt",
"ipsum",
"nisi",
"pariatur",
"sit",
"non",
"ad",
"do",
"nulla",
"ad",
"irure",
"ipsum",
"incididunt",
"Lorem",
"enim",
"proident",
"veniam",
"in",
"reprehenderit",
"irure",
"pariatur",
"cupidatat",
"ipsum",
"sit",
"nisi",
"irure",
"ipsum",
"cillum",
"adipisicing",
"reprehenderit",
"occaecat",
"irure",
"irure",
"amet",
"reprehenderit",
"voluptate",
"veniam",
"cillum",
"incididunt",
"magna",
"laboris",
"nisi",
"duis",
"irure",
"do",
"amet",
"aliquip",
"commodo",
"nisi",
"pariatur",
"sunt",
"dolor",
"ut",
"ea",
"voluptate",
"laboris",
"pariatur",
"qui",
"duis",
"commodo",
"deserunt"
],
"friends": [
{
"id": 0,
"name": "Erna Lynch"
},
{
"id": 1,
"name": "Vicky Vega"
},
{
"id": 2,
"name": "Haley Meyer"
},
{
"id": 3,
"name": "Darlene Knight"
},
{
"id": 4,
"name": "Odonnell Cain"
},
{
"id": 5,
"name": "Hopper Sellers"
},
{
"id": 6,
"name": "Knapp Barry"
},
{
"id": 7,
"name": "Alvarado Clements"
},
{
"id": 8,
"name": "Wolfe Taylor"
},
{
"id": 9,
"name": "Janell Chambers"
},
{
"id": 10,
"name": "Merle Wood"
},
{
"id": 11,
"name": "Ellen Savage"
},
{
"id": 12,
"name": "Elliott Humphrey"
},
{
"id": 13,
"name": "Ayers Chase"
},
{
"id": 14,
"name": "Robbie Kirkland"
},
{
"id": 15,
"name": "Whitney Perkins"
},
{
"id": 16,
"name": "Marisa Lloyd"
},
{
"id": 17,
"name": "Helene Case"
},
{
"id": 18,
"name": "Berry Tyler"
},
{
"id": 19,
"name": "Frieda Cannon"
},
{
"id": 20,
"name": "Sonya Leon"
},
{
"id": 21,
"name": "Wilda Glass"
},
{
"id": 22,
"name": "Sims Kaufman"
},
{
"id": 23,
"name": "Ballard Preston"
},
{
"id": 24,
"name": "Carroll Clay"
},
{
"id": 25,
"name": "Medina Curry"
},
{
"id": 26,
"name": "Beatriz Herrera"
},
{
"id": 27,
"name": "Marianne Vargas"
},
{
"id": 28,
"name": "Galloway Stanton"
},
{
"id": 29,
"name": "Rhea Marshall"
}
],
"greeting": "Hello, Camille Sims! You have 10 unread messages.",
"favoriteFruit": "strawberry"
}
25 changes: 25 additions & 0 deletions tests/e2e/tests/web/smoke/browser/json-key.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as path from 'path';
import { rte } from '../../../../helpers/constants';
import { DatabaseHelper } from '../../../../helpers/database';
import { BrowserPage } from '../../../../pageObjects';
Expand All @@ -15,6 +16,7 @@ let keyName = Common.generateWord(10);
const keyTTL = '2147476121';
const value = '{"name":"xyz"}';
const jsonObjectValue = '{name:"xyz"}';
const jsonFilePath = path.join('..', '..', '..', '..', 'test-data', 'big-json', 'big-json.json');

fixture `JSON Key verification`
.meta({ type: 'smoke', rte: rte.standalone })
Expand Down Expand Up @@ -49,3 +51,26 @@ test('Verify that user can add key with value to any level of JSON structure', a
// Check the added key contains json object with added key
await t.expect(browserPage.jsonKeyValue.textContent).eql('{name:"xyz"key1:"value1"key2:{key2222:12345}}', 'The json object value not found');
});
test('Verify that user can add key with value to any level of JSON structure for big JSON object', async t => {
keyName = Common.generateWord(10);
// Add Json key with json object
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, [jsonFilePath]);
await t.click(browserPage.addKeyButton);
// Check the notification message
const notification = browserPage.Toast.toastHeader.textContent;
await t.expect(notification).contains('Key has been added', 'The notification not found');
// Add key with value on the same level
await browserPage.addJsonKeyOnTheSameLevel('"key1"', '"value1"');
// Check the added key contains json object with added key
await t.expect(browserPage.addJsonObjectButton.exists).ok('The add Json object button not found', { timeout: 10000 });
await t.expect(browserPage.jsonKeyValue.textContent).contains('"key1:"value1"}', 'The json object value not found');
// Add value inside the json array
await browserPage.addJsonValueInsideStructure('12345');
// Check the added key contains json object with added key
await t.expect(browserPage.jsonKeyValue.textContent).contains('"70:12345]', 'The json object value not found');
});