Skip to content

Commit 9d3cee7

Browse files
committed
Get Defect + pagination improvement
1 parent 064b9ae commit 9d3cee7

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import tricentisQtest from "../../tricentis_qtest.app.mjs";
2+
3+
export default {
4+
key: "tricentis_qtest-get-defect",
5+
name: "Get Defect",
6+
description: "Get details of a defect. [See the documentation](https://documentation.tricentis.com/qtest/od/en/content/apis/apis/defect_apis.htm#GetRecentlyUpdatedDefects)",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
props: {
10+
tricentisQtest,
11+
projectId: {
12+
propDefinition: [
13+
tricentisQtest,
14+
"projectId",
15+
],
16+
},
17+
defectId: {
18+
propDefinition: [
19+
tricentisQtest,
20+
"defectId",
21+
({ projectId }) => ({
22+
projectId,
23+
}),
24+
],
25+
},
26+
},
27+
async run({ $ }) {
28+
const {
29+
tricentisQtest, ...args
30+
} = this;
31+
const response = await tricentisQtest.getDefect({
32+
$,
33+
...args,
34+
});
35+
$.export("$summary", `Successfully fetched defect (ID: ${args.defectId})`);
36+
return response;
37+
},
38+
};

components/tricentis_qtest/common/utils.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ export async function getFieldProps() {
1515
}
1616
}
1717

18-
console.log(fields);
19-
2018
const result = {};
2119
const isUpdate = !!(this.requirementId || this.defectId);
2220

components/tricentis_qtest/tricentis_qtest.app.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ export default {
3737
label: "Requirement ID",
3838
description: "The ID of a requirement",
3939
async options({
40-
page, projectId,
40+
page = 0, projectId,
4141
}) {
4242
const requirements = await this.getRequirements({
4343
projectId,
4444
params: {
45-
page,
45+
page: page + 1,
4646
},
4747
});
4848
return (requirements ?? []).map(({
@@ -58,7 +58,7 @@ export default {
5858
label: "Defect ID",
5959
description: "The ID of a defect. The listed options are defects that have been updated in the last 30 days.",
6060
async options({
61-
page, projectId, prevContext: { startTime },
61+
page = 0, projectId, prevContext: { startTime },
6262
}) {
6363
if (!startTime) {
6464
const date = new Date();
@@ -70,7 +70,7 @@ export default {
7070
const defects = await this.getDefects({
7171
projectId,
7272
params: {
73-
page,
73+
page: page + 1,
7474
startTime,
7575
},
7676
});

0 commit comments

Comments
 (0)