Skip to content

Commit 615cd27

Browse files
committed
updates by pr comments
1 parent 0c86922 commit 615cd27

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

tests/e2e/helpers/keys.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export const keyTypes = [
4646
* Adding keys of each type through the cli
4747
* @param keyData The key data
4848
* @param keyValue The key value
49+
* @param keyField The key field value
4950
*/
5051
export async function addKeysViaCli(keyData: KeyData, keyValue?: string, keyField?: string): Promise<void> {
5152
await t.click(cliPage.cliExpandButton);

tests/e2e/pageObjects/browser-page.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,9 @@ export class BrowserPage {
469469
// Scan until finding element or all keys scanned
470470
while (true) {
471471
await t.click(this.scanMoreButton);
472-
if (await this.isKeyIsDisplayedInTheList(keyName) || scannedValueText === totalKeysValue) break;
472+
if (await this.isKeyIsDisplayedInTheList(keyName) || scannedValueText === totalKeysValue) {
473+
break;
474+
}
473475
}
474476
}
475477

@@ -555,6 +557,17 @@ export class BrowserPage {
555557
await t.click(this.saveHashFieldButton);
556558
}
557559

560+
/**
561+
* Edit Hash key value from details
562+
* @param value The value of the key
563+
*/
564+
async editHashKeyValue(value: string): Promise<void> {
565+
await t
566+
.click(this.editHashButton)
567+
.typeText(this.hashFieldValueEditor, value, {replace: true, paste: true})
568+
.click(this.applyButton);
569+
}
570+
558571
/**
559572
* Search by the value in the key details
560573
* @param value The value of the search parameter
@@ -960,7 +973,7 @@ export type AddKeyArguments = {
960973
fieldValueStartWith?: string,
961974
elementStartWith?: string,
962975
memberStartWith?: string
963-
}
976+
};
964977

965978
/**
966979
* Keys Data parameters

tests/e2e/tests/critical-path/browser/formatters.e2e.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,10 @@ test('Verify that user can edit the values in the key regardless if they are val
7878
// Open key details and select formatter
7979
await browserPage.openKeyDetails(keysData[0].keyName);
8080
await browserPage.selectFormatter(formatter.format);
81-
await t.click(browserPage.editHashButton);
82-
await t.typeText(browserPage.hashFieldValueEditor, invalidText, { replace: true, paste: true });
83-
await t.click(browserPage.applyButton);
81+
await browserPage.editHashKeyValue(invalidText);
8482
// Verify that invalid value can be saved
8583
await t.expect(browserPage.hashFieldValue.textContent).contains(invalidText, `Invalid ${formatter.format} value is not saved`);
86-
await t.click(browserPage.editHashButton);
87-
await t.typeText(browserPage.hashFieldValueEditor, formatter.fromText, { replace: true, paste: true });
88-
await t.click(browserPage.applyButton);
84+
await browserPage.editHashKeyValue(formatter.fromText);
8985
// Verify that valid value can be saved
9086
await t.expect(browserPage.hashFieldValue.innerText).contains(formatter.fromText, `Valid ${formatter.format} value is not saved`);
9187
await t.expect(browserPage.hashFieldValue.find(browserPage.cssJsonValue).exists).ok(`Value is not formatted to ${formatter.format}`);
@@ -117,18 +113,17 @@ test
117113
// Create new keys
118114
await addKeysViaCli(keysData, formatters[1].fromText);
119115
})('Verify that user can see highlighted key details in Msgpack format', async t => {
120-
const valueSelector = browserPage.stringKeyValueInput;
121-
// Open String key details
122-
await browserPage.openKeyDetailsByKeyName(keysData[4].keyName);
116+
// Open HaSH key details
117+
await browserPage.openKeyDetailsByKeyName(keysData[0].keyName);
123118
// Verify that msgpack value not formatted with default formatter
124-
await t.expect(valueSelector.find(browserPage.cssJsonValue).exists).notOk('Value is formatted to Msgpack');
119+
await t.expect(browserPage.hashFieldValue.find(browserPage.cssJsonValue).exists).notOk('Value is formatted to Msgpack');
125120
// Add valid msgpack in HEX format
126121
await browserPage.selectFormatter('HEX');
127-
await browserPage.editStringKeyValue(formatters[1].toText!);
122+
await browserPage.editHashKeyValue(formatters[1].toText!);
128123
await browserPage.selectFormatter('Msgpack');
129124
// Verify that msgpack value is formatted and highlighted
130-
await t.expect(valueSelector.innerText).contains('{\n "field": "value"\n}', 'Value is not saved as msgpack');
131-
await t.expect(valueSelector.find(browserPage.cssJsonValue).exists).ok('Value is not formatted to Msgpack');
125+
await t.expect(browserPage.hashFieldValue.innerText).contains(formatters[1].fromText!, 'Value is not saved as msgpack');
126+
await t.expect(browserPage.hashFieldValue.find(browserPage.cssJsonValue).exists).ok('Value is not formatted to Msgpack');
132127
});
133128
test
134129
.before(async() => {
@@ -164,9 +159,7 @@ test('Verify that user can edit value for Hash field in ASCII/HEX and convert th
164159
await browserPage.openKeyDetails(keysData[0].keyName);
165160
await browserPage.selectFormatter(formatter.format);
166161
// Add value in selected format
167-
await t.click(browserPage.editHashButton);
168-
await t.typeText(browserPage.hashFieldValueEditor, formatter.toText!, { replace: true, paste: true });
169-
await t.click(browserPage.applyButton);
162+
await browserPage.editHashKeyValue(formatter.toText!);
170163
// Verify that value saved in selected format
171164
await t.expect(browserPage.hashFieldValue.innerText).contains(formatter.toText!, `${formatter.format} value is not saved`);
172165
await browserPage.selectFormatter('Unicode');

0 commit comments

Comments
 (0)