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
4 changes: 3 additions & 1 deletion tests/e2e/test-data/formatters-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Vector32BitFormatter,
Vector64BitFormatter
} from './formatters';
import { DataTimeFormatter } from './formatters/DataTime';

interface IFormatter {
format: string,
Expand All @@ -36,7 +37,8 @@ export const formatters: IFormatter[] = [
BinaryFormatter,
PickleFormatter,
Vector32BitFormatter,
Vector64BitFormatter
Vector64BitFormatter,
DataTimeFormatter
];

export const binaryFormattersSet: IFormatter[] = [
Expand Down
7 changes: 7 additions & 0 deletions tests/e2e/test-data/formatters/DataTime.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const DataTimeFormatter = {
format: 'Timestamp to DateTime',
fromText: '1633072800',
fromTextEdit: '-179064000000',
formattedText: '09:20:00.000 1 Oct 2021',
formattedTextEdit: '13:00:00.000 29 Apr 1964'
};
48 changes: 47 additions & 1 deletion tests/e2e/tests/web/critical-path/browser/formatters.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
formattersHighlightedSet,
formattersWithTooltipSet,
fromBinaryFormattersSet,
notEditableFormattersSet
notEditableFormattersSet,
formatters
} from '../../../../test-data/formatters-data';
import { phpData } from '../../../../test-data/formatters';

Expand Down Expand Up @@ -233,3 +234,48 @@ notEditableFormattersSet.forEach(formatter => {
}
});
});
test('Verify that user can format timestamp value', async t => {
const formatterName = 'Timestamp to DateTime';
await browserPage.openKeyDetailsByKeyName(keysData[0].keyName);
//Add fields to the hash key
await browserPage.selectFormatter('Unicode');
const formatter = formatters.find(f => f.format === formatterName);
if (!formatter) {
throw new Error('Formatter not found');
}
// add key in sec
const hashSec = {
field: 'fromTextSec',
value: formatter.fromText!
};
// add key in msec
const hashMsec = {
field: 'fromTextMsec',
value: `${formatter.fromText!}000`
};
// add key with minus
const hashMinusSec = {
field: 'fromTextEdit',
value: formatter.fromTextEdit!
};
//Search the added field
await browserPage.addFieldToHash(
hashSec.field, hashSec.value
);
await browserPage.addFieldToHash(
hashMsec.field, hashMsec.value
);
await browserPage.addFieldToHash(
hashMinusSec.field, hashMinusSec.value
);

await browserPage.searchByTheValueInKeyDetails(hashSec.field);
await browserPage.selectFormatter('DateTime');
await t.expect(await browserPage.getHashKeyValue()).eql(formatter.formattedText!, `Value is not formatted as DateTime ${formatter.fromText}`);

await browserPage.searchByTheValueInKeyDetails(hashMsec.field);
await t.expect(await browserPage.getHashKeyValue()).eql(formatter.formattedText!, `Value is not formatted as DateTime ${formatter.fromTextEdit}`);

await browserPage.searchByTheValueInKeyDetails(hashMinusSec.field);
await t.expect(await browserPage.getHashKeyValue()).eql(formatter.formattedTextEdit!, `Value is not formatted as DateTime ${formatter.fromTextEdit}`);
});