Skip to content

Commit e61f5e3

Browse files
Merge pull request #477 from RedisInsight/feature/e2e-automatically-update
e2e - automatically update
2 parents 386cb38 + c992529 commit e61f5e3

File tree

4 files changed

+129
-14
lines changed

4 files changed

+129
-14
lines changed

tests/e2e/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"lint": "eslint . --ext .ts,.js,.tsx,.jsx",
1919
"test:desktop:ci": "ts-node ./desktop.runner.ts",
2020
"test:desktop:ci:win": "ts-node ./desktop.runner.win.ts",
21-
"test:desktop": "testcafe electron tests/ --browser-init-timeout 180000 -e -r html:./report/desktop-report.html,spec -q attemptLimit=3,successThreshold=1"
21+
"test:desktop": "testcafe electron tests/ --browser-init-timeout 180000 -e -r html:./report/desktop-report.html,spec"
2222
},
2323
"keywords": [],
2424
"author": "",
@@ -27,11 +27,13 @@
2727
},
2828
"devDependencies": {
2929
"@types/chance": "1.1.3",
30+
"@types/edit-json-file": "1.7.0",
3031
"@typescript-eslint/eslint-plugin": "4.28.2",
3132
"@typescript-eslint/parser": "4.28.2",
3233
"chance": "1.1.8",
3334
"cross-env": "^7.0.3",
3435
"dotenv-cli": "^5.0.0",
36+
"edit-json-file": "1.7.0",
3537
"eslint": "7.32.0",
3638
"eslint-plugin-import": "2.24.2",
3739
"testcafe": "1.14.2",

tests/e2e/pageObjects/my-redis-databases-page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class MyRedisDatabasePage {
2323
editAliasButton = Selector('[data-testid=edit-alias-btn]');
2424
applyButton = Selector('[data-testid=apply-btn]');
2525
submitChangesButton = Selector('[data-testid=btn-submit]');
26+
promoButton = Selector('[data-testid=promo-btn]');
2627
//CHECKBOXES
2728
selectAllCheckbox = Selector('[data-test-subj=checkboxSelectAll]');
2829
//ICONS
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { acceptLicenseTerms } from '../../../helpers/database';
2+
import { MyRedisDatabasePage } from '../../../pageObjects';
3+
import { commonUrl } from '../../../helpers/conf';
4+
import { rte, env } from '../../../helpers/constants';
5+
import { Chance } from 'chance';
6+
import { join } from 'path';
7+
import * as os from 'os';
8+
import * as editJsonFile from 'edit-json-file';
9+
10+
const myRedisDatabasePage = new MyRedisDatabasePage();
11+
const chance = new Chance();
12+
13+
const workingDirectory = process.env.APP_FOLDER_ABSOLUTE_PATH
14+
|| (join(os.homedir(), process.env.APP_FOLDER_NAME || '.redisinsight-v2'));
15+
const buildPath = `${workingDirectory}/content/build.json`;
16+
const createRedisPath = `${workingDirectory}/content/create-redis.json`;
17+
const buildFilePath = editJsonFile(buildPath);
18+
const createRedisFilePath = editJsonFile(createRedisPath);
19+
const timestampBeforeUpdate = buildFilePath.get("timestamp");
20+
const timestampForEdit = timestampBeforeUpdate - 1;
21+
const cloudValueForEdit = chance.word({ length: 10 });
22+
23+
//Edit json file values
24+
createRedisFilePath.set('cloud.title', cloudValueForEdit);
25+
createRedisFilePath.set('cloud.description', cloudValueForEdit);
26+
createRedisFilePath.save();
27+
buildFilePath.set('timestamp', timestampForEdit);
28+
buildFilePath.save();
29+
30+
fixture `Automatically update information`
31+
.meta({type: 'critical_path'})
32+
.page(commonUrl)
33+
.beforeEach(async () => {
34+
await acceptLicenseTerms();
35+
})
36+
test
37+
.meta({ rte: rte.standalone, env: env.desktop })
38+
('Verify that user has the ability to update "Create free database" button without changing the app', async t => {
39+
//Create new file paths due to cacheability
40+
const buildFilePathNew = editJsonFile(buildPath);
41+
const createRedisFilePathNew = editJsonFile(createRedisPath);
42+
//Check the promo button after the opening of app
43+
await t.expect(myRedisDatabasePage.promoButton.textContent).notContains(cloudValueForEdit, 'Promo button text is updated');
44+
//Get the values from build.json and create-redis.json files
45+
const timestampAfterUpdate = await buildFilePathNew.get('timestamp');
46+
const cloudTitle = await createRedisFilePathNew.get('cloud.title');
47+
const cloudDescription = await createRedisFilePathNew.get('cloud.description');
48+
//Check the json files are automatically updated
49+
await t.expect(timestampAfterUpdate).notEql(timestampForEdit, 'The timestamp in the build.json file is automatically updated');
50+
await t.expect(cloudTitle).notEql(cloudValueForEdit, 'The cloud title in the create-redis.json file is automatically updated');
51+
await t.expect(cloudDescription).notEql(cloudValueForEdit, 'The cloud description in the create-redis.json file is automatically updated');
52+
});

tests/e2e/yarn.lock

Lines changed: 73 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,14 @@
11001100
resolved "https://registry.yarnpkg.com/@types/chance/-/chance-1.1.3.tgz#d19fe9391288d60fdccd87632bfc9ab2b4523fea"
11011101
integrity sha512-X6c6ghhe4/sQh4XzcZWSFaTAUOda38GQHmq9BUanYkOE/EO7ZrkazwKmtsj3xzTjkLWmwULE++23g3d3CCWaWw==
11021102

1103+
1104+
version "1.7.0"
1105+
resolved "https://registry.yarnpkg.com/@types/edit-json-file/-/edit-json-file-1.7.0.tgz#c3ab99b33ca8f018d412b2b6a1e3c7bf1a05f732"
1106+
integrity sha512-yZrbGD4Qp92s6xU80MWBdz9vJE8k8EbO+gLWYb4W1UL9WYVUMOtUr5zvKlKgbcc2veYmFLO9dPnYA9Mxul0lOw==
1107+
dependencies:
1108+
"@types/node" "*"
1109+
"@types/set-value" "*"
1110+
11031111
"@types/error-stack-parser@^1.3.18":
11041112
version "1.3.18"
11051113
resolved "https://registry.yarnpkg.com/@types/error-stack-parser/-/error-stack-parser-1.3.18.tgz#e01c9f8c85ca83b610320c62258b0c9026ade0f7"
@@ -1148,6 +1156,11 @@
11481156
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.13.tgz#e743bae112bd779ac9650f907197dd2caa7f0364"
11491157
integrity sha512-1x8W5OpxPq+T85OUsHRP6BqXeosKmeXRtjoF39STcdf/UWLqUsoehstZKOi0CunhVqHG17AyZgpj20eRVooK6A==
11501158

1159+
"@types/set-value@*":
1160+
version "4.0.1"
1161+
resolved "https://registry.yarnpkg.com/@types/set-value/-/set-value-4.0.1.tgz#7caf185556a67c2d9051080931853047423c93bd"
1162+
integrity sha512-mP/CLy6pdrhsDVrz1+Yp5Ly6Tcel2IAEejhyI5NxY6WnBUdWN+AAfGa0HHsdgCdsPWWcd/4D5J2X2TrRYcYRag==
1163+
11511164
"@typescript-eslint/[email protected]":
11521165
version "4.28.2"
11531166
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.2.tgz#7a8320f00141666813d0ae43b49ee8244f7cf92a"
@@ -2061,6 +2074,24 @@ easy-stack@^1.0.1:
20612074
resolved "https://registry.yarnpkg.com/easy-stack/-/easy-stack-1.0.1.tgz#8afe4264626988cabb11f3c704ccd0c835411066"
20622075
integrity sha512-wK2sCs4feiiJeFXn3zvY0p41mdU5VUgbgs1rNsc/y5ngFUijdWd+iIN8eoyuZHKB8xN6BL4PdWmzqFmxNg6V2w==
20632076

2077+
2078+
version "1.0.11"
2079+
resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf"
2080+
integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==
2081+
dependencies:
2082+
safe-buffer "^5.0.1"
2083+
2084+
2085+
version "1.7.0"
2086+
resolved "https://registry.yarnpkg.com/edit-json-file/-/edit-json-file-1.7.0.tgz#b0bfb626169890568c2668369a8e5202f5c49150"
2087+
integrity sha512-eIkLJ9i4ija7b2TbaLHy3scyjWFLzwM2Wa6kHbV4ppVLcCqn7FzqnO1vmCG3dLrkd+teWE3mvACfv166mO0VZg==
2088+
dependencies:
2089+
find-value "^1.0.12"
2090+
iterate-object "^1.3.4"
2091+
r-json "^1.2.10"
2092+
set-value "^4.1.0"
2093+
w-json "^1.3.10"
2094+
20642095
electron-to-chromium@^1.3.723:
20652096
version "1.3.743"
20662097
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.743.tgz#fcec24d6d647cb84fd796b42caa1b4039a180894"
@@ -2533,6 +2564,11 @@ find-up@^3.0.0:
25332564
dependencies:
25342565
locate-path "^3.0.0"
25352566

2567+
find-value@^1.0.12:
2568+
version "1.0.12"
2569+
resolved "https://registry.yarnpkg.com/find-value/-/find-value-1.0.12.tgz#68b6cec84e5b2d51272965e0bf09b26c9159c26e"
2570+
integrity sha512-OCpo8LTk8eZ2sdDCwbU2Lc3ivYsdM6yod6jP2jHcNEFcjPhkgH0+POzTIol7xx1LZgtbI5rkO5jqxsG5MWtPjQ==
2571+
25362572
flat-cache@^3.0.4:
25372573
version "3.0.4"
25382574
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11"
@@ -3144,13 +3180,18 @@ is-path-inside@^3.0.1:
31443180
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283"
31453181
integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==
31463182

3147-
is-plain-object@^2.0.3, is-plain-object@^2.0.4:
3183+
is-plain-object@^2.0.4:
31483184
version "2.0.4"
31493185
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677"
31503186
integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==
31513187
dependencies:
31523188
isobject "^3.0.1"
31533189

3190+
is-primitive@^3.0.1:
3191+
version "3.0.1"
3192+
resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-3.0.1.tgz#98c4db1abff185485a657fc2905052b940524d05"
3193+
integrity sha512-GljRxhWvlCNRfZyORiH77FwdFwGcMO620o37EOYC0ORWdq+WYNVqW0w2Juzew4M+L81l6/QS3t5gkkihyRqv9w==
3194+
31543195
is-regex@^1.1.4:
31553196
version "1.1.4"
31563197
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958"
@@ -3217,10 +3258,16 @@ isexe@^2.0.0:
32173258
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
32183259
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
32193260

3220-
isobject@^2.0.0:
3221-
version "2.1.0"
3222-
resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89"
3223-
integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=
3261+
isobject@^3.0.1:
3262+
version "3.0.1"
3263+
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
3264+
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
3265+
3266+
isomorphic-fetch@^3.0.0:
3267+
version "3.0.0"
3268+
resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4"
3269+
integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==
3270+
32243271
dependencies:
32253272
isarray "1.0.0"
32263273

@@ -3229,6 +3276,11 @@ isobject@^3.0.0, isobject@^3.0.1:
32293276
resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
32303277
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=
32313278

3279+
iterate-object@^1.3.4:
3280+
version "1.3.4"
3281+
resolved "https://registry.yarnpkg.com/iterate-object/-/iterate-object-1.3.4.tgz#fa50b1d9e58e340a7dd6b4c98c8a5e182e790096"
3282+
integrity sha512-4dG1D1x/7g8PwHS9aK6QV5V94+ZvyP4+d19qDv43EzImmrndysIl4prmJ1hWWIGCqrZHyaHBm6BSEWHOLnpoNw==
3283+
32323284
32333285
version "1.0.7"
32343286
resolved "https://registry.yarnpkg.com/js-message/-/js-message-1.0.7.tgz#fbddd053c7a47021871bb8b2c95397cc17c20e47"
@@ -4049,6 +4101,11 @@ queue-microtask@^1.2.2:
40494101
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
40504102
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
40514103

4104+
r-json@^1.2.10:
4105+
version "1.2.10"
4106+
resolved "https://registry.yarnpkg.com/r-json/-/r-json-1.2.10.tgz#62a73d9cafa7eabf670e5c2812c27bdb220a968b"
4107+
integrity sha512-hu9vyLjSlHXT62NAS7DjI9WazDlvjN0lgp3n431dCVnirVcLkZIpzSwA3orhZEKzdDD2jqNYI+w0yG0aFf4kpA==
4108+
40524109
read-file-relative@^1.2.0:
40534110
version "1.2.0"
40544111
resolved "https://registry.yarnpkg.com/read-file-relative/-/read-file-relative-1.2.0.tgz#98f7d96eaa21d2b4c7a2febd63d2fc8cf35e9f9b"
@@ -4315,15 +4372,13 @@ semver@^7.2.1, semver@^7.3.5:
43154372
dependencies:
43164373
lru-cache "^6.0.0"
43174374

4318-
set-value@^2.0.0, set-value@^2.0.1:
4319-
version "2.0.1"
4320-
resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b"
4321-
integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==
4375+
set-value@^4.1.0:
4376+
version "4.1.0"
4377+
resolved "https://registry.yarnpkg.com/set-value/-/set-value-4.1.0.tgz#aa433662d87081b75ad88a4743bd450f044e7d09"
4378+
integrity sha512-zTEg4HL0RwVrqcWs3ztF+x1vkxfm0lP+MQQFPiMJTKVceBwEV0A569Ou8l9IYQG8jOZdMVI1hGsc0tmeD2o/Lw==
43224379
dependencies:
4323-
extend-shallow "^2.0.1"
4324-
is-extendable "^0.1.1"
4325-
is-plain-object "^2.0.3"
4326-
split-string "^3.0.1"
4380+
is-plain-object "^2.0.4"
4381+
is-primitive "^3.0.1"
43274382

43284383
shebang-command@^2.0.0:
43294384
version "2.0.0"
@@ -5120,6 +5175,11 @@ validate-npm-package-license@^3.0.1:
51205175
spdx-correct "^3.0.0"
51215176
spdx-expression-parse "^3.0.0"
51225177

5178+
w-json@^1.3.10:
5179+
version "1.3.10"
5180+
resolved "https://registry.yarnpkg.com/w-json/-/w-json-1.3.10.tgz#ac448a19ca22376e2753a684b52369c7b1e83313"
5181+
integrity sha512-XadVyw0xE+oZ5FGApXsdswv96rOhStzKqL53uSe5UaTadABGkWIg1+DTx8kiZ/VqTZTBneoL0l65RcPe4W3ecw==
5182+
51235183
webauth@^1.1.0:
51245184
version "1.1.0"
51255185
resolved "https://registry.yarnpkg.com/webauth/-/webauth-1.1.0.tgz#64704f6b8026986605bc3ca629952e6e26fdd100"

0 commit comments

Comments
 (0)