Skip to content

Commit 8fd0312

Browse files
author
maria-hambardzumian
committed
EPMRPP-84449 || crf
1 parent 85891ab commit 8fd0312

File tree

4 files changed

+59
-8
lines changed

4 files changed

+59
-8
lines changed

__tests__/report-portal-client.spec.js

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -876,14 +876,14 @@ describe('ReportPortal javascript client', () => {
876876
});
877877
});
878878

879-
it('should automatically add NOT_ISSUE when status is SKIPPED and skippedIssue is false', function (done) {
879+
it('should automatically add NOT_ISSUE when status is SKIPPED and skippedIsNotIssue is true', function (done) {
880880
const mockClient = new RPClient(
881881
{
882882
apiKey: 'test',
883883
endpoint: 'https://reportportal-stub-url',
884884
launch: 'test launch',
885885
project: 'test project',
886-
skippedIssue: false,
886+
skippedIsNotIssue: true,
887887
},
888888
{ name: 'test', version: '1.0.0' },
889889
);
@@ -920,14 +920,54 @@ describe('ReportPortal javascript client', () => {
920920
}, 50);
921921
});
922922

923-
it('should not add NOT_ISSUE when status is SKIPPED and skippedIssue is true', function (done) {
923+
it('should support legacy skippedIssue config option', function (done) {
924+
const mockClient = new RPClient(
925+
{
926+
apiKey: 'test',
927+
endpoint: 'https://reportportal-stub-url',
928+
launch: 'test launch',
929+
project: 'test project',
930+
skippedIssue: false,
931+
},
932+
{ name: 'test', version: '1.0.0' },
933+
);
934+
935+
const spyFinishTestItemPromiseStart = jest
936+
.spyOn(mockClient, 'finishTestItemPromiseStart')
937+
.mockImplementation(() => {});
938+
939+
mockClient.map = {
940+
testItemId: {
941+
children: [],
942+
finishSend: false,
943+
promiseFinish: Promise.resolve(),
944+
resolveFinish: () => {},
945+
},
946+
};
947+
948+
mockClient.finishTestItem('testItemId', { status: 'skipped' });
949+
950+
setTimeout(() => {
951+
expect(spyFinishTestItemPromiseStart).toHaveBeenCalledWith(
952+
expect.any(Object),
953+
'testItemId',
954+
expect.objectContaining({
955+
status: 'skipped',
956+
issue: { issueType: 'NOT_ISSUE' },
957+
}),
958+
);
959+
done();
960+
}, 50);
961+
});
962+
963+
it('should not add NOT_ISSUE when status is SKIPPED and skippedIsNotIssue is false', function (done) {
924964
const mockClient = new RPClient(
925965
{
926966
apiKey: 'test',
927967
endpoint: 'https://reportportal-stub-url',
928968
launch: 'test launch',
929969
project: 'test project',
930-
skippedIssue: true,
970+
skippedIsNotIssue: false,
931971
},
932972
{ name: 'test', version: '1.0.0' },
933973
);

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ declare module '@reportportal/client-javascript' {
155155
launchUuidPrintOutput?: string;
156156
restClientConfig?: RestClientConfig;
157157
token?: string;
158-
skippedIssue?: boolean;
158+
skippedIsNotIssue?: boolean;
159159
/**
160160
* OAuth 2.0 configuration object. When provided, OAuth authentication will be used instead of API key.
161161
*/

lib/commons/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const getClientConfig = (options) => {
115115
description: options.description,
116116
launchUuidPrint: options.launchUuidPrint,
117117
launchUuidPrintOutput,
118-
skippedIssue: options.skippedIssue,
118+
skippedIsNotIssue: !!options.skippedIsNotIssue,
119119
};
120120
} catch (error) {
121121
// don't throw the error up to not break the entire process

lib/report-portal-client.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,14 @@ class RPClient {
201201
this.launchUuid = launchDataRQ.id;
202202
} else {
203203
const systemAttr = helpers.getSystemAttribute();
204+
if (this.config.skippedIsNotIssue === true) {
205+
const skippedIsNotIssueAttribute = {
206+
key: 'skippedIssue',
207+
value: 'false',
208+
system: true,
209+
};
210+
systemAttr.push(skippedIsNotIssueAttribute);
211+
}
204212
const attributes = Array.isArray(launchDataRQ.attributes)
205213
? launchDataRQ.attributes.concat(systemAttr)
206214
: systemAttr;
@@ -610,8 +618,11 @@ class RPClient {
610618
...(itemObj.children.length ? {} : { status: RP_STATUSES.PASSED }),
611619
...finishTestItemRQ,
612620
};
613-
614-
if (finishTestItemData.status === RP_STATUSES.SKIPPED && this.config.skippedIssue === false) {
621+
622+
if (
623+
finishTestItemData.status === RP_STATUSES.SKIPPED &&
624+
this.config.skippedIsNotIssue === true
625+
) {
615626
finishTestItemData.issue = { issueType: 'NOT_ISSUE' };
616627
}
617628

0 commit comments

Comments
 (0)