Skip to content

Commit 6084642

Browse files
authored
Merge pull request #173 from RedisInsight/e2e/bugfix/fix-ttl-e2e
E2e/bugfix/fix ttl e2e
2 parents 51cea99 + 2619ab0 commit 6084642

File tree

9 files changed

+70
-18
lines changed

9 files changed

+70
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class ButtonActions extends BaseActions{
5555
*/
5656
static async clickElement(
5757
locatorToClick: Locator,
58-
timeout: number = 3000,
58+
timeout: number = 5000,
5959
): Promise<void> {
6060
ButtonActions.initializeDriver()
6161
const elementToClick = await ButtonActions.driver.wait(

tests/e2e/src/page-objects/components/editor-view/DoubleColumnKeyDetailsView.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ export class DoubleColumnKeyDetailsView extends KeyDetailsView {
1313
By.xpath(
1414
`//*[contains(@data-testid, "edit-${keyType}-button-${name}")] | //*[contains(@data-testid, "${keyType}_edit-btn-${name}")]`,
1515
)
16-
getValueInput = (keyType: string, name: string): By =>
17-
By.xpath(`//*[contains(@data-testid, "${keyType}_content-value-${name}")]`)
1816
getWrapperOfValueInput = (keyType: string, name: string): By =>
1917
By.xpath(`//*[contains(@data-testid, "${keyType}_content-value-${name}")]/parent::*`)
2018

tests/e2e/src/page-objects/components/editor-view/HashKeyDetailsView.ts

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ import { Key } from 'vscode-extension-tester'
99
* Hash Key details view
1010
*/
1111
export class HashKeyDetailsView extends DoubleColumnKeyDetailsView {
12-
hashFieldValueEditor = By.xpath(`//*[contains(@data-testid, 'hash_value-editor')]`)
12+
hashFieldValueEditor = By.xpath(
13+
`//*[contains(@data-testid, 'hash_value-editor')]`,
14+
)
1315
hashFieldTtlEditor = By.xpath(`//*[@data-testid = 'inline-item-editor']`)
1416
hashFieldsList = By.xpath(
1517
`//*[contains(@data-testid, 'hash-field-') and not(contains(@data-testid,'value'))]/div`,
1618
)
17-
hashValuesList = By.xpath(`//*[contains(@data-testid, 'hash_content-value-')]`)
19+
hashValuesList = By.xpath(
20+
`//*[contains(@data-testid, 'hash_content-value-')]`,
21+
)
1822
truncatedValue = By.xpath(
1923
`//*[contains(@data-testid, 'hash_content-value-')]//*[@class = 'truncate']`,
2024
)
@@ -26,7 +30,9 @@ export class HashKeyDetailsView extends DoubleColumnKeyDetailsView {
2630
`//*[@data-testid = 'add-hash-field-panel']//*[contains(@data-testid, 'hash-value-')]`,
2731
)
2832
saveHashFieldButton = By.xpath(`//*[@data-testid = 'save-fields-btn']`)
29-
showTtlCheckbox = By.xpath(`//*[@data-testid = 'show-ttl-column-checkbox']/parent::*/parent::*`)
33+
showTtlCheckbox = By.xpath(
34+
`//*[@data-testid = 'show-ttl-column-checkbox']/parent::*/parent::*`,
35+
)
3036

3137
getFieldTtlInputByField = (field: string): By =>
3238
By.xpath(`//div[@data-testid="hash-ttl_content-value-${field}"]`)
@@ -46,6 +52,8 @@ export class HashKeyDetailsView extends DoubleColumnKeyDetailsView {
4652
this.hashFieldValueEditor,
4753
KeyTypesShort.Hash,
4854
)
55+
// Wait until value changes
56+
await CommonDriverExtension.driverSleep(300)
4957
}
5058

5159
/**
@@ -65,16 +73,23 @@ export class HashKeyDetailsView extends DoubleColumnKeyDetailsView {
6573
* @param fieldName The field name
6674
* @param fieldTtl The hash field ttl value for Redis databases 7.3.4 and higher
6775
*/
68-
async editHashKeyTtl(fieldName: string, fieldTtl: string = ''): Promise<void> {
76+
async editHashKeyTtl(
77+
fieldName: string,
78+
fieldTtl: string = '',
79+
): Promise<void> {
6980
const enteredText = await this.getElementText(
70-
this.getFieldTtlInputByField(fieldName))
81+
this.getFieldTtlInputByField(fieldName),
82+
)
7183
const count = enteredText.length
7284

73-
await InputActions.hoverElement(this.getFieldTtlInputByField(fieldName),1000)
85+
await InputActions.hoverElement(
86+
this.getFieldTtlInputByField(fieldName),
87+
1000,
88+
)
7489
await ButtonActions.clickElement(this.getEditFieldByField(fieldName))
7590

7691
// clear the input
77-
for(let i = 0; i < count; i++){
92+
for (let i = 0; i < count; i++) {
7893
await InputActions.pressKey(this.hashFieldTtlEditor, Key.BACK_SPACE)
7994
}
8095
await InputActions.typeText(this.hashFieldTtlEditor, fieldTtl)

tests/e2e/src/page-objects/components/editor-view/KeyDetailsView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class KeyDetailsView extends WebView {
7878
By.xpath(`//*[@data-testid[starts-with(., '${keyName.split('-')[0]}') and contains(., '${columnName}')]]//*[@data-testid='value-as-json']
7979
| //*[@data-testid[starts-with(., '${keyName.split('-')[0]}-field-') and contains(., '${columnName}')]]//*[@data-testid='value-as-json']`)
8080
getEditBtnByKeyName = (keyName: string): By =>
81-
By.xpath(`//vscode-button[contains(@data-testid, 'edit_') and contains(@data-testid, '${keyName}')]`)
81+
By.xpath(`//vscode-button[contains(@data-testid, 'edit') and contains(@data-testid, '${keyName}')]`)
8282
/**
8383
* get key size
8484
*/

tests/e2e/src/page-objects/components/editor-view/SortedSetKeyDetailsView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class SortedSetKeyDetailsView extends DoubleColumnKeyDetailsView {
1212
`//*[contains(@data-testid, 'zset-member-value-')]`,
1313
)
1414
truncatedValue = By.xpath(
15-
`//*[contains(@data-testid, 'zset-member-value-')]//*[contains(@aria-describedby, 'popup')]`,
15+
`//*[contains(@data-testid, 'zset-score-value-')]//*[@class = 'truncate']`,
1616
)
1717
scoreSortedSetFieldsList = By.xpath(
1818
`//*[contains(@data-testid, 'zset_content-value-')]`,

tests/e2e/src/page-objects/components/tree-view/TreeView.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ export class TreeView extends WebView {
260260
value,
261261
)
262262
await ButtonActions.clickElement(this.keyTreeFilterApplyBtn)
263-
await this.waitForElementVisibility(this.loadingIndicator, 1000, false)
263+
await this.waitForElementVisibility(this.loadingIndicator, 2000, true)
264+
await this.waitForElementVisibility(this.loadingIndicator, 5000, false)
264265
}
265266

266267
/**

tests/e2e/src/tests/browser/filtering.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
KeyTypesShort,
2424
} from '@e2eSrc/helpers/constants'
2525
import { InnerViews } from '@e2eSrc/page-objects/components/WebView'
26+
import { CommonDriverExtension } from '@e2eSrc/helpers'
2627

2728
let keyName = `KeyForSearch*?[]789${Common.generateWord(10)}`
2829
let keyName2 = Common.generateWord(10)
@@ -426,10 +427,12 @@ describe('Filtering per key name in DB with 10 millions of keys', () => {
426427
await treeView.clearFilter()
427428
for (let i = 0; i < keyTypes.length - 1; i++) {
428429
await treeView.selectFilterGroupType(keyTypes[i].keyName)
430+
// Waiting for long db loading
431+
CommonDriverExtension.driverSleep(1000)
429432
// Verify that all results have the same type as in filter
430433
expect(
431434
await treeView.getElementText(treeView.getTreeViewItemByIndex(i + 1)),
432-
).contains(keyTypes[i].keyName, 'Keys filtered incorrectly by key type')
435+
).contains(keyTypes[i].keyName, 'Keys filtered incorrectly by key type after scanning more')
433436
}
434437
})
435438
})

tests/e2e/src/tests/browser/formatters.ts

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { expect } from 'chai'
22
import { describe, it } from 'mocha'
3-
import { before, beforeEach, after, afterEach, Locator } from 'vscode-extension-tester'
3+
import {
4+
before,
5+
beforeEach,
6+
after,
7+
afterEach,
8+
Locator,
9+
} from 'vscode-extension-tester'
410
import {
511
CliAPIRequests,
612
DatabaseAPIRequests,
@@ -16,7 +22,8 @@ import {
1622
} from '@e2eSrc/page-objects/components'
1723
import {
1824
ButtonActions,
19-
DatabasesActions, InputActions,
25+
DatabasesActions,
26+
InputActions,
2027
KeyDetailsActions,
2128
} from '@e2eSrc/helpers/common-actions'
2229
import { formatters, phpData } from '../../test-data/formatters-data'
@@ -224,6 +231,7 @@ describe('Formatters', () => {
224231
await keyDetailsView.selectFormatter(formatter.format)
225232
await hashKeyDetailsView.editHashKeyValue(invalidText)
226233
await ButtonActions.clickElement(keyDetailsView.saveButton)
234+
await CommonDriverExtension.driverSleep(500)
227235
// Verify that invalid value can be saved
228236
expect(
229237
await hashKeyDetailsView.getElementText(
@@ -487,7 +495,7 @@ describe('Formatters', () => {
487495
keysData,
488496
Config.ossStandaloneConfig.databaseName,
489497
value,
490-
value
498+
value,
491499
)
492500
// Refresh database
493501
await treeView.refreshDatabaseByName(
@@ -512,8 +520,26 @@ describe('Formatters', () => {
512520
await KeyDetailsActions.openKeyDetailsByKeyNameInIframe(key.keyName)
513521
await keyDetailsView.selectFormatter(formatter.format)
514522
await CommonDriverExtension.driverSleep(300)
523+
// Hover over value to see edit button for hash and list
524+
if (key.keyType === KeyTypesShort.Hash) {
525+
await InputActions.hoverElement(
526+
doubleColumnKeyDetailsView.getWrapperOfValueInput(
527+
key.keyType,
528+
value,
529+
),
530+
1000,
531+
)
532+
}
533+
if (key.keyType === KeyTypesShort.List) {
534+
await InputActions.hoverElement(
535+
doubleColumnKeyDetailsView.getWrapperOfValueInput(
536+
key.keyType,
537+
'0',
538+
),
539+
1000,
540+
)
541+
}
515542
// Verify that edit button disabled for Hash, List, String keys
516-
await InputActions.hoverElement(doubleColumnKeyDetailsView.getWrapperOfValueInput(key.keyName, value),1000)
517543
expect(await keyDetailsView.isElementDisabled(editBtn, 'class')).eql(
518544
true,
519545
`Key ${key.keyType} is enabled for ${formatter.format} formatter`,
@@ -530,6 +556,13 @@ describe('Formatters', () => {
530556
await KeyDetailsActions.openKeyDetailsByKeyNameInIframe(key.keyName)
531557
await keyDetailsView.selectFormatter(formatter.format)
532558
// Verify that edit button enabled for ZSet
559+
await InputActions.hoverElement(
560+
doubleColumnKeyDetailsView.getWrapperOfValueInput(
561+
key.keyType,
562+
'0',
563+
),
564+
1000,
565+
)
533566
expect(
534567
await keyDetailsView.isElementDisabled(editBtnLocator, 'class'),
535568
).eql(

tests/e2e/src/tests/browser/large-key-details-values.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ describe('Large key details verification', () => {
297297
await KeyDetailsActions.openKeyDetailsByKeyNameInIframe(
298298
bigStringKeyParameters.keyName,
299299
)
300+
// Wait until large key fully loaded
301+
CommonDriverExtension.driverSleep(1000)
300302
expect(
301303
await stringKeyDetailsView.isElementDisabled(
302304
stringKeyDetailsView.editKeyValueButton,

0 commit comments

Comments
 (0)