-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Tricentis QTest new components #14137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5f8fd62
Package / base app method
GTFalcao e879a99
pnpm
GTFalcao 35d2cae
Create Requirement + async props
GTFalcao 3bf7498
Get Requirement + async props
GTFalcao f6a959e
Adding additionalProps for requirement fields
GTFalcao 22760b2
Merge branch 'master' into 14077-tricentis-new-components
GTFalcao a981a4c
Update Requirement + reusing commons
GTFalcao cd78dcc
Adding defect requests
GTFalcao fed537e
Submit Defect + reusing field methods for requirements
GTFalcao 064b9ae
Update Defect + many adjustments & improvements
GTFalcao 9d3cee7
Get Defect + pagination improvement
GTFalcao 90c5dbf
Version numbers
GTFalcao 94b24bb
Syntax adjustment
GTFalcao d205c6e
Merge branch 'master' into 14077-tricentis-new-components
GTFalcao a06e08c
Base URL adjustment
GTFalcao ad858d6
Including field type in prop description
GTFalcao d2901f9
Merge branch 'master' into 14077-tricentis-new-components
GTFalcao 3aea478
Merge branch 'master' into 14077-tricentis-new-components
GTFalcao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
61 changes: 61 additions & 0 deletions
61
components/tricentis_qtest/actions/create-requirement/create-requirement.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import { | ||
| getFieldProps as additionalProps, getProperties, | ||
| } from "../../common/utils.mjs"; | ||
| import tricentisQtest from "../../tricentis_qtest.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tricentis_qtest-create-requirement", | ||
| name: "Create Requirement", | ||
| description: "Create a new requirement. [See the documentation](https://documentation.tricentis.com/qtest/od/en/content/apis/apis/requirement_apis.htm#CreateARequirement)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| tricentisQtest, | ||
| projectId: { | ||
| propDefinition: [ | ||
| tricentisQtest, | ||
| "projectId", | ||
| ], | ||
| }, | ||
| parentId: { | ||
| propDefinition: [ | ||
| tricentisQtest, | ||
| "parentId", | ||
| ({ projectId }) => ({ | ||
| projectId, | ||
| }), | ||
| ], | ||
| reloadProps: true, | ||
| }, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "Requirement name", | ||
| }, | ||
| }, | ||
| additionalProps, | ||
| methods: { | ||
| getDataFields() { | ||
| return this.tricentisQtest.getRequirementFields(this.projectId); | ||
| }, | ||
| getProperties, | ||
| }, | ||
| async run({ $ }) { | ||
| const { // eslint-disable-next-line no-unused-vars | ||
| tricentisQtest, projectId, parentId, name, getProperties, getDataFields, ...fields | ||
| } = this; | ||
| const response = await tricentisQtest.createRequirement({ | ||
| $, | ||
| projectId, | ||
| params: { | ||
| parentId, | ||
| }, | ||
| data: { | ||
| name, | ||
| properties: getProperties(fields), | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created requirement (ID: ${response.id})`); | ||
| return response; | ||
| }, | ||
| }; |
38 changes: 38 additions & 0 deletions
38
components/tricentis_qtest/actions/get-defect/get-defect.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import tricentisQtest from "../../tricentis_qtest.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tricentis_qtest-get-defect", | ||
| name: "Get Defect", | ||
| description: "Get details of a defect. [See the documentation](https://documentation.tricentis.com/qtest/od/en/content/apis/apis/defect_apis.htm#GetRecentlyUpdatedDefects)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| tricentisQtest, | ||
| projectId: { | ||
| propDefinition: [ | ||
| tricentisQtest, | ||
| "projectId", | ||
| ], | ||
| }, | ||
| defectId: { | ||
| propDefinition: [ | ||
| tricentisQtest, | ||
| "defectId", | ||
| ({ projectId }) => ({ | ||
| projectId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| tricentisQtest, ...args | ||
| } = this; | ||
| const response = await tricentisQtest.getDefect({ | ||
| $, | ||
| ...args, | ||
| }); | ||
| $.export("$summary", `Successfully fetched defect (ID: ${args.defectId})`); | ||
| return response; | ||
| }, | ||
| }; |
38 changes: 38 additions & 0 deletions
38
components/tricentis_qtest/actions/get-requirement/get-requirement.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import tricentisQtest from "../../tricentis_qtest.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tricentis_qtest-get-requirement", | ||
| name: "Get Requirement", | ||
| description: "Get details of a requirement. [See the documentation](https://documentation.tricentis.com/qtest/od/en/content/apis/apis/requirement_apis.htm#GetARequirementByItsID)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| tricentisQtest, | ||
| projectId: { | ||
| propDefinition: [ | ||
| tricentisQtest, | ||
| "projectId", | ||
| ], | ||
| }, | ||
| requirementId: { | ||
| propDefinition: [ | ||
| tricentisQtest, | ||
| "requirementId", | ||
| ({ projectId }) => ({ | ||
| projectId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| tricentisQtest, ...args | ||
| } = this; | ||
| const response = await tricentisQtest.getRequirement({ | ||
| $, | ||
| ...args, | ||
| }); | ||
| $.export("$summary", `Successfully fetched requirement (ID: ${args.requirementId})`); | ||
| return response; | ||
| }, | ||
| }; |
43 changes: 43 additions & 0 deletions
43
components/tricentis_qtest/actions/submit-defect/submit-defect.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { | ||
| getFieldProps as additionalProps, getProperties, | ||
| } from "../../common/utils.mjs"; | ||
| import tricentisQtest from "../../tricentis_qtest.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tricentis_qtest-submit-defect", | ||
| name: "Submit Defect", | ||
| description: "Submit a new defect. [See the documentation](https://documentation.tricentis.com/qtest/od/en/content/apis/apis/defect_apis.htm#SubmitaDefect)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| tricentisQtest, | ||
| projectId: { | ||
| propDefinition: [ | ||
| tricentisQtest, | ||
| "projectId", | ||
| ], | ||
| reloadProps: true, | ||
| }, | ||
| }, | ||
| additionalProps, | ||
| methods: { | ||
| getDataFields() { | ||
| return this.tricentisQtest.getDefectFields(this.projectId); | ||
| }, | ||
| getProperties, | ||
| }, | ||
| async run({ $ }) { | ||
| const { // eslint-disable-next-line no-unused-vars | ||
| tricentisQtest, projectId, getProperties, getDataFields, ...fields | ||
| } = this; | ||
| const response = await tricentisQtest.createDefect({ | ||
| $, | ||
| projectId, | ||
| data: { | ||
| properties: getProperties(fields), | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully submitted defect (ID: ${response.id})`); | ||
| return response; | ||
| }, | ||
| }; |
53 changes: 53 additions & 0 deletions
53
components/tricentis_qtest/actions/update-defect/update-defect.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import { | ||
| getFieldProps as additionalProps, getProperties, | ||
| } from "../../common/utils.mjs"; | ||
| import tricentisQtest from "../../tricentis_qtest.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tricentis_qtest-update-defect", | ||
| name: "Update Defect", | ||
| description: "Update a defect. [See the documentation](https://documentation.tricentis.com/qtest/od/en/content/apis/apis/defect_apis.htm#UpdateADefect)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| tricentisQtest, | ||
| projectId: { | ||
| propDefinition: [ | ||
| tricentisQtest, | ||
| "projectId", | ||
| ], | ||
| }, | ||
| defectId: { | ||
| propDefinition: [ | ||
| tricentisQtest, | ||
| "defectId", | ||
| ({ projectId }) => ({ | ||
| projectId, | ||
| }), | ||
| ], | ||
| reloadProps: true, | ||
| }, | ||
| }, | ||
| additionalProps, | ||
| methods: { | ||
| getDataFields() { | ||
| return this.tricentisQtest.getDefectFields(this.projectId); | ||
| }, | ||
| getProperties, | ||
| }, | ||
| async run({ $ }) { | ||
| const { // eslint-disable-next-line no-unused-vars | ||
| tricentisQtest, projectId, defectId, getProperties, getDataFields, ...fields | ||
| } = this; | ||
| const response = await tricentisQtest.updateDefect({ | ||
| $, | ||
| projectId, | ||
| defectId, | ||
| data: { | ||
| properties: getProperties(fields), | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully updated defect (ID: ${defectId})`); | ||
| return response; | ||
| }, | ||
| }; |
65 changes: 65 additions & 0 deletions
65
components/tricentis_qtest/actions/update-requirement/update-requirement.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import { | ||
| getFieldProps as additionalProps, getProperties, | ||
| } from "../../common/utils.mjs"; | ||
| import tricentisQtest from "../../tricentis_qtest.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tricentis_qtest-update-requirement", | ||
| name: "Update Requirement", | ||
| description: "Update a requirement. [See the documentation](https://documentation.tricentis.com/qtest/od/en/content/apis/apis/requirement_apis.htm#UpdateARequirement)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| tricentisQtest, | ||
| projectId: { | ||
| propDefinition: [ | ||
| tricentisQtest, | ||
| "projectId", | ||
| ], | ||
| }, | ||
| requirementId: { | ||
| propDefinition: [ | ||
| tricentisQtest, | ||
| "requirementId", | ||
| ({ projectId }) => ({ | ||
| projectId, | ||
| }), | ||
| ], | ||
| reloadProps: true, | ||
| }, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "Requirement name", | ||
| }, | ||
| }, | ||
| additionalProps, | ||
| methods: { | ||
| getDataFields() { | ||
| return this.tricentisQtest.getRequirementFields(this.projectId); | ||
| }, | ||
| getProperties, | ||
| }, | ||
| async run({ $ }) { | ||
| const { /* eslint-disable no-unused-vars */ | ||
| tricentisQtest, | ||
| projectId, | ||
| requirementId, | ||
| name, | ||
| getProperties, | ||
| getDataFields, | ||
| ...fields | ||
| } = this; /* eslint-enable no-unused-vars */ | ||
| const response = await tricentisQtest.updateRequirement({ | ||
| $, | ||
| projectId, | ||
| requirementId, | ||
| data: { | ||
| name, | ||
| properties: getProperties(fields), | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully updated requirement (ID: ${requirementId})`); | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| export async function getFieldProps() { | ||
| if (this.useFields === false) return {}; | ||
|
|
||
| const fields = await this.getDataFields(); | ||
|
|
||
| function getFieldType(type) { | ||
| switch (type) { | ||
| case "LongText": | ||
| default: | ||
| return "string"; | ||
| case "Number": | ||
| return "integer"; | ||
| case "ArrayNumber": | ||
| return "integer[]"; | ||
| } | ||
| } | ||
|
|
||
| const result = {}; | ||
| const isUpdate = !!(this.requirementId || this.defectId); | ||
|
|
||
| fields?.forEach(({ | ||
| id, label, attribute_type: fieldType, allowed_values: options, required, | ||
| }) => { | ||
| const type = getFieldType(fieldType); | ||
| result[`field_${id}`] = { | ||
| label, | ||
| type, | ||
| description: `Field ID: ${id}`, | ||
| optional: isUpdate || !required, | ||
| ...(options && { | ||
| options: options.map(({ | ||
| label, value, | ||
| }) => ({ | ||
| label, | ||
| value: (type === "string" && typeof value !== "string") | ||
| ? value.toString() | ||
| : value, | ||
|
Comment on lines
+34
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle potential In the options mapping: value: (type === "string" && typeof value !== "string")
? value.toString()
: value,Consider adding a check to handle cases where Apply this diff to add a null check: value: (type === "string" && typeof value !== "string")
- ? value.toString()
+ ? (value != null ? value.toString() : "")
: value, |
||
| })), | ||
| }), | ||
| }; | ||
| }); | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
| export function getProperties(fields) { | ||
| return fields && Object.entries(fields).map(([ | ||
| id, | ||
| value, | ||
| ]) => ({ | ||
| field_id: id.split("_").pop(), | ||
| field_value: value, | ||
| })); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/tricentis_qtest", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Tricentis qTest Components", | ||
| "main": "tricentis_qtest.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
GTFalcao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.