Skip to content

Commit 62f2d73

Browse files
committed
Merge branch 'main' into build/demo
# Conflicts: # README.md # tests/e2e/src/tests/setup.ts
2 parents b060949 + ba6ccd9 commit 62f2d73

34 files changed

+439
-170
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Redis-for-VS-Code
1+
# Redis for Visual Studio Code
22

33
Temporary repository to work on the VS Code extension
44

src/webviews/src/modules/key-details/components/hash-details/add-hash-fields/AddHashFields.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as l10n from '@vscode/l10n'
33
import { VSCodeButton } from '@vscode/webview-ui-toolkit/react'
44
import Popup from 'reactjs-popup'
55
import cx from 'classnames'
6+
import { toNumber } from 'lodash'
67

78
import {
89
stringToBuffer,
@@ -79,7 +80,7 @@ const AddHashFields = (props: Props) => {
7980
fields: fields.map((item) => ({
8081
field: stringToBuffer(item.fieldName),
8182
value: stringToBuffer(item.fieldValue),
82-
expire: item.fieldTTL,
83+
expire: toNumber(item.fieldTTL) || undefined,
8384
})),
8485
}
8586

@@ -141,7 +142,7 @@ const AddHashFields = (props: Props) => {
141142
value={item.fieldTTL}
142143
disabled={loading || disabled}
143144
onChange={(e: ChangeEvent<HTMLInputElement>) =>
144-
setFields(handleItemChange(fields, 'fieldTTL', item.id, +validateTTLNumberForAddKey(e.target.value)))}
145+
setFields(handleItemChange(fields, 'fieldTTL', item.id, validateTTLNumberForAddKey(e.target.value)))}
145146
data-testid={`hash-ttl-${index}`}
146147
/>
147148
</div>

tests/e2e/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
API_URL=http://127.0.0.1:5544/api
1+
API_URL=http://127.0.0.1:5541/api
22
RI_TEST=true
33
OSS_SENTINEL_PASSWORD=password
44
RI_APP_FOLDER_NAME=.redis-insight-vsc-stage

tests/e2e/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"name": "redis-insight-vsc-plugin",
3+
"version": "0.0.1",
4+
"description": "End-to-end tests",
25
"scripts": {
36
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
47
"lint:fix": "eslint . --fix --ext .js,.jsx,.ts,.tsx",
@@ -38,7 +41,7 @@
3841
"ts-node": "10.9.1",
3942
"tsc-alias": "^1.8.8",
4043
"typescript": "^5.1.3",
41-
"vscode-extension-tester": "^8.3.1"
44+
"vscode-extension-tester": "^8.5.0"
4245
},
4346
"dependencies": {
4447
"clone-deep": "^4.0.1",

tests/e2e/rte.docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ services:
102102
ports:
103103
- 8104:6379
104104

105+
# oss standalone v7
106+
oss-standalone-v7:
107+
logging: *logging
108+
image: redis:7.4-rc2
109+
ports:
110+
- 8108:6379
111+
105112
# oss sentinel
106113
oss-sentinel:
107114
logging: *logging

tests/e2e/src/helpers/Conf.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class Config {
99
static apiUrl = process.env.API_URL || 'http://127.0.0.1:5541/api'
1010
static vscodeVersion = process.env.VSCODE_VERSION || '1.87.2'
1111
static extensionName =
12-
process.env.EXTENSION_NAME || 'redis-insight-vsc-plugin.vsix'
12+
process.env.EXTENSION_NAME || 'redis-insight-vsc-extension.vsix'
1313

1414
static workingDirectory =
1515
process.env.APP_FOLDER_ABSOLUTE_PATH ||
@@ -59,6 +59,14 @@ export class Config {
5959
databasePassword: process.env.OSS_STANDALONE_REDISEARCH_PASSWORD,
6060
}
6161

62+
static ossStandaloneV7Config = {
63+
host: process.env.OSS_STANDALONE_V7_HOST || 'localhost',
64+
port: process.env.OSS_STANDALONE_V7_PORT || '8108',
65+
databaseName: `${process.env.OSS_STANDALONE_V7_DATABASE_NAME || 'test_standalone-v7'}-${this.uniqueId}`,
66+
databaseUsername: process.env.OSS_STANDALONE_V7_USERNAME,
67+
databasePassword: process.env.OSS_STANDALONE_V7_PASSWORD
68+
}
69+
6270
static ossClusterConfig = {
6371
ossClusterHost: process.env.OSS_CLUSTER_HOST || 'localhost',
6472
ossClusterPort: process.env.OSS_CLUSTER_PORT || '8200',

tests/e2e/src/helpers/api/KeyApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,8 @@ export class KeyAPIRequests {
379379
static async addKeysApi(
380380
keyData: KeyData[],
381381
databaseName: string,
382-
keyField: string = 'test_field',
383-
keyValue: string = 'test_value',
382+
keyField = 'test_field',
383+
keyValue = 'test_value',
384384
): Promise<void> {
385385
for (let key of keyData) {
386386
await this.addKeyApi(key, databaseName, keyField, keyValue)

tests/e2e/src/helpers/common-actions/TreeViewActions.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ export class TreeViewActions extends CommonDriverExtension {
6868
delimiter,
6969
)
7070
const node = treeView.getFolderSelectorByName(nodeName)
71-
const nodeElement = await treeView.getElement(node)
72-
const fullTestIdSelector = await nodeElement.getAttribute('data-testid')
71+
const fullTestIdSelector = await treeView.getElementAttribute(node, 'data-testid')
7372
if (!fullTestIdSelector?.includes('expanded')) {
7473
await ButtonActions.clickElement(node)
7574
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { VSBrowser, WebDriver } from 'vscode-extension-tester'
2+
import { Locator, until } from 'selenium-webdriver'
3+
4+
/**
5+
* Base action for actions
6+
*/
7+
export class BaseActions {
8+
static driver: WebDriver
9+
static initializeDriver(): void {
10+
if (!BaseActions.driver) {
11+
BaseActions.driver = VSBrowser.instance.driver
12+
}
13+
}
14+
/**
15+
* Hover mouse to element
16+
* @param locator locator to hover over
17+
* @param timeout timeout to wait for element
18+
*/
19+
static async hoverElement(
20+
locator: Locator,
21+
timeout: number = 3000,
22+
): Promise<void> {
23+
BaseActions.initializeDriver()
24+
const elementToHover = await BaseActions.driver.wait(
25+
until.elementLocated(locator),
26+
timeout,
27+
)
28+
await BaseActions.driver
29+
.actions( { async: true, bridge: true })
30+
.move({ duration: 5000, origin: elementToHover, x: 0, y: 0 })
31+
.perform()
32+
}
33+
}

tests/e2e/src/helpers/common-actions/actions/ButtonActions.ts

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
import { VSBrowser, WebDriver } from 'vscode-extension-tester'
22
import { Locator, until } from 'selenium-webdriver'
3+
import { BaseActions } from '@e2eSrc/helpers/common-actions/actions/BaseActions'
34

45
/**
56
* Buttons
67
*/
7-
export class ButtonActions {
8-
static driver: WebDriver
9-
static initializeDriver(): void {
10-
if (!ButtonActions.driver) {
11-
ButtonActions.driver = VSBrowser.instance.driver
12-
}
13-
}
8+
export class ButtonActions extends BaseActions{
149

1510
/**
1611
* Click on button with wait
@@ -69,24 +64,4 @@ export class ButtonActions {
6964
)
7065
await elementToClick.click()
7166
}
72-
73-
/**
74-
* Hover mouse to element
75-
* @param locator locator to hover over
76-
* @param timeout timeout to wait for element
77-
*/
78-
static async hoverElement(
79-
locator: Locator,
80-
timeout: number = 3000,
81-
): Promise<void> {
82-
ButtonActions.initializeDriver()
83-
const elementToHover = await ButtonActions.driver.wait(
84-
until.elementLocated(locator),
85-
timeout,
86-
)
87-
await ButtonActions.driver
88-
.actions( { async: true, bridge: true })
89-
.move({ duration: 5000, origin: elementToHover, x: 0, y: 0 })
90-
.perform()
91-
}
9267
}

0 commit comments

Comments
 (0)