Skip to content

Commit 463da6e

Browse files
authored
Merge pull request #188 from reportportal/develop
Release 5.2.2
2 parents 523485e + 39b24e7 commit 463da6e

5 files changed

Lines changed: 18 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
### Fixed
2+
- [#187](https://github.com/reportportal/agent-js-playwright/issues/187) Logs being displayed in incorrect order and with identical timestamps.
13

24
## [5.2.1] - 2025-08-27
35
### Fixed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.2.1
1+
5.2.2-SNAPSHOT

src/__tests__/reportingApi.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
*
1616
*/
1717

18+
import helpers from '@reportportal/client-javascript/lib/helpers';
1819
import { ReportingApi } from '../reportingApi';
1920
import * as utils from '../utils';
2021
import { LOG_LEVELS } from '../constants';
22+
import { mockedDate } from './mocks/RPClientMock';
2123

2224
const reportingApiStatusMethods = [
2325
{ method: 'setStatusPassed', status: 'passed' },
@@ -70,6 +72,8 @@ jest.mock('@playwright/test', () => ({
7072
}));
7173

7274
describe('reportingApi', () => {
75+
jest.spyOn(helpers, 'now').mockReturnValue(mockedDate);
76+
7377
test('addAttributes should call sendEventToReporter with params', () => {
7478
const attrs = [
7579
{
@@ -176,6 +180,7 @@ describe('reportingApi', () => {
176180
file,
177181
level: 'INFO',
178182
message: 'message',
183+
time: mockedDate,
179184
};
180185
const spySendEventToReporter = jest.spyOn(utils, 'sendEventToReporter');
181186
ReportingApi.log(LOG_LEVELS.INFO, 'message', file, suite);
@@ -208,6 +213,7 @@ describe('reportingApi', () => {
208213
file,
209214
level: 'INFO',
210215
message: 'message',
216+
time: mockedDate,
211217
};
212218
const spySendEventToReporter = jest.spyOn(utils, 'sendEventToReporter');
213219
ReportingApi.launchLog(LOG_LEVELS.INFO, 'message', file);

src/reporter.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,16 @@ export class RPReporter implements Reporter {
245245
}
246246
}
247247

248-
sendLog(tempId: string, { level = LOG_LEVELS.INFO, message = '', file }: LogRQ): void {
248+
sendLog(
249+
tempId: string,
250+
{ level = LOG_LEVELS.INFO, message = '', time = clientHelpers.now(), file }: LogRQ,
251+
): void {
249252
const { promise } = this.client.sendLog(
250253
tempId,
251254
{
252255
message,
253256
level,
254-
time: clientHelpers.now(),
257+
time,
255258
},
256259
file,
257260
);

src/reportingApi.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717

1818
import { EVENTS } from '@reportportal/client-javascript/lib/constants/events';
19+
import clientHelpers from '@reportportal/client-javascript/lib/helpers';
1920
import { sendEventToReporter } from './utils';
2021
import { Attribute } from './models';
2122
import { STATUSES, LOG_LEVELS } from './constants';
@@ -66,9 +67,10 @@ export const ReportingApi = {
6667
message = '',
6768
file?: Attachment,
6869
suite?: string,
69-
): void => sendEventToReporter(EVENTS.ADD_LOG, { level, message, file }, suite),
70+
): void =>
71+
sendEventToReporter(EVENTS.ADD_LOG, { level, message, file, time: clientHelpers.now() }, suite),
7072
launchLog: (level: LOG_LEVELS = LOG_LEVELS.INFO, message = '', file?: Attachment): void =>
71-
sendEventToReporter(EVENTS.ADD_LAUNCH_LOG, { level, message, file }),
73+
sendEventToReporter(EVENTS.ADD_LAUNCH_LOG, { level, message, file, time: clientHelpers.now() }),
7274
trace: (message: string, file?: Attachment, suite?: string): void =>
7375
ReportingApi.log(LOG_LEVELS.TRACE, message, file, suite),
7476
debug: (message: string, file?: Attachment, suite?: string): void =>

0 commit comments

Comments
 (0)