Coder Social home page Coder Social logo

node-testrail-api's People

Contributors

dlenroc avatar github-actions[bot] avatar unickq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-testrail-api's Issues

npm install failure due to sed error

Hello,

npm install dlenroc/node-testrail-api --production --save seems to be failing due to this error

npm ERR! prepareGitDep 1> 
npm ERR! prepareGitDep > [email protected] prepare /home/ysong/.npm/_cacache/tmp/git-clone-6f9a257a
npm ERR! prepareGitDep > npm run build
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > [email protected] build /home/ysong/.npm/_cacache/tmp/git-clone-6f9a257a
npm ERR! prepareGitDep > rollup -c && sed -i '' 's/export default TestRail;/export default TestRail; export = TestRail;/' ./dist/TestRail.d.ts
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 2> npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
npm ERR! prepareGitDep 
npm ERR! prepareGitDep src/TestRail.ts โ†’ dist/TestRail.node.js, dist/TestRail.node.mjs, dist/TestRail.browser.mjs, dist/TestRail.umd.js...
npm ERR! prepareGitDep created dist/TestRail.node.js, dist/TestRail.node.mjs, dist/TestRail.browser.mjs, dist/TestRail.umd.js in 1.9s
npm ERR! prepareGitDep sed: can't read s/export default TestRail;/export default TestRail; export = TestRail;/: No such file or directory
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 2
npm ERR! prepareGitDep npm ERR! [email protected] build: `rollup -c && sed -i '' 's/export default TestRail;/export default TestRail; export = TestRail;/' ./dist/TestRail.d.ts`
npm ERR! prepareGitDep npm ERR! Exit status 2
npm ERR! prepareGitDep npm ERR! 
npm ERR! prepareGitDep npm ERR! Failed at the [email protected] build script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /home/ysong/.npm/_logs/2020-09-18T17_54_27_750Z-debug.log
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 2
npm ERR! prepareGitDep npm ERR! [email protected] prepare: `npm run build`
npm ERR! prepareGitDep npm ERR! Exit status 2
npm ERR! prepareGitDep npm ERR! 
npm ERR! prepareGitDep npm ERR! Failed at the [email protected] prepare script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /home/ysong/.npm/_logs/2020-09-18T17_54_27_769Z-debug.log
npm ERR! prepareGitDep 
npm ERR! premature close

I think the problem is with this line

rollup -c && sed -i '' 's/export default TestRail;/export default TestRail; export = TestRail;/' ./dist/TestRail.d.ts

where it fields

npm ERR! prepareGitDep sed: can't read s/export default TestRail;/export default TestRail; export = TestRail;/: No such file or directory

Use of Proxy with TestRail API

When we push our results from our automated tests to Testrail behind our corporate firewall they fail but when pushed outside the corporate firewall they work with no issues.
Is there a way to use a proxy with the TestRail API.

ts compilation errors

Hi!
I'm facing some errors trying to compile my project:

tsc --noEmit
node_modules/@dlenroc/testrail/src/TestRail.ts:589:18 - error TS2304: Cannot find name 'FormData'.

589       body = new FormData();
                     ~~~~~~~~

node_modules/@dlenroc/testrail/src/TestRail.ts:600:30 - error TS2304: Cannot find name 'fetch'.

600       const response = await fetch(url, { method, body, headers });
                                 ~~~~~

node_modules/@dlenroc/testrail/src/TestRail.ts:675:37 - error TS2304: Cannot find name 'FormData'.

675 function appendToFormData(formData: FormData, name: string, value: string | Blob, filename?: string) {
                                        ~~~~~~~~

node_modules/@dlenroc/testrail/src/TestRail.ts:676:45 - error TS2304: Cannot find name 'window'.

676   if (typeof Blob !== 'undefined' && typeof window !== 'undefined' && window?.FormData === FormData) {
                                                ~~~~~~

node_modules/@dlenroc/testrail/src/TestRail.ts:676:71 - error TS2304: Cannot find name 'window'.

676   if (typeof Blob !== 'undefined' && typeof window !== 'undefined' && window?.FormData === FormData) {
                                                                          ~~~~~~

node_modules/@dlenroc/testrail/src/TestRail.ts:676:92 - error TS2304: Cannot find name 'FormData'.

676   if (typeof Blob !== 'undefined' && typeof window !== 'undefined' && window?.FormData === FormData) {
                                                                                               ~~~~~~~~
Found 6 errors in the same file, starting at: node_modules/@dlenroc/testrail/src/TestRail.ts:589

It looks like the file is missing imports or something:

import { Request, Response } from './payload';
import { stringify as qs } from './query-string';
import { TestRailException } from './TestRailException';

export * from './payload';
export type { Request as Payload, Response as Model };

class TestRail {
  static Exception = TestRailException;
  private readonly username?: string;
  private readonly password?: string;
  private readonly baseURL: string;

  constructor(config?: { host: string; username: string; password: string }) {
    // @ts-ignore - Backward compatibility
    this.username = config?.username || config?.user;
    this.password = config?.password;
    this.baseURL = (config?.host || '') + '/index.php?/api/v2/';
  }

TestRailException: Field :custom_browser_type is a required field.

Hi, I'm a little bit stuck with this error and I can't find any information on other place, so maybe you can help me, I juts got this error when I'm trying to use the addResultToCase() call, here's the code:

api.addResultForCase(run.id, testCase[0].id, {status_id: testStatus.id, comment: dataBrokerTest.output})

Then I got the error on console:

TestRailException: Field :custom_browser_type is a required field. at p._api (/Users/wosorto/Documents/Projects/fusiontestrail-connector/node_modules/@dlenroc/testrail/dist/TestRail.node.js:1:8519)

getCases method requires suite id and fails when attempting to run.

This was run against a setup using 7.0.1

A second issue I noted after updating the method locally to work was that in some larger sets(600-3000), The method would only get a subset. 341 of 600+ or 900 of 2000.
I left the default limit as adding the limit would just get that amount vs not setting the limit would get 250+ records when there were more.
I tried debugging the issue and noted(in the pagination "while" loop), that the first call would work, limit = 250, offset = 0, but on the second call, with the offset = 250, I would end up just getting 140 vs the 250+ remaining tests.
I would also see, if I console logged the output of the getCases, a line at the end that would say "... xxx more items"
however, if I do the calls serially with the limit and offset passed in, I would get the correct values.
This seems like what the while loop is doing so I'm not clear as to why it's failing.
ex
getcases(projId, suiteId, {limit: 250, offset: 0) // returns 250
getcases(projId, suiteId, {limit: 250, offset: 250) // returns 250
getcases(projId, suiteId, {limit: 250, offset: 500)// returns 25

EDIT: A little more debugging and seems like it's at the item filter. It catching duplicates that appear in the second set of data.
Interestingly enough, if I remove the line to not filter, it gets the expected number of cases...
Now I'm wondering if it's an api issue.

EDIT2: Not an api error. Further looking, it looks like there is a var row_number that exists that can help in uniqeifying the Set value used to compare.
Both changes are in my forked repo.

methods dont work unless they are public

I can only make methods from Testrail.ts to work when i edit them and make them public. Am I doing something wrong or how come it cant be used without changing the testrail.ts code?

Per-request timeout

Hi,
Occasionally TestRail API performance tanks and requests to open a test run via this library are hanging. I was interested in setting a request timeout, but it seems like the AbortController signal I pass when creating the TestRail client is reused, so the timeout I set there isn't per-request but for the runtime of my entire script.

Could you please explain if there's a means by which I can set a request timeout per request?

function createAbortController(ms: number): AbortController {
  const ac = new AbortController();
  setTimeout(() => ac.abort(), ms);
  return ac;
}

const tr = new TestRail({
  // host, username, password...
  signal: createAbortController(10_000).signal,
});

How to update custom field with custom data?

I manually created a test field in TestRail named additional_link (text area) , and while posting test results to Test Rail, I need to fill the field with some data, I didn't find the method in TestRail official documentation, and decided to ask you. Please provide some advices...
I tried to add the data while creating of test case but it doesn't appear in TestRail

TypeScript issues with Node 16

Hi again,
I'm having trouble using your library with Node 16 and TypeScript. I'm working in a large monorepo so upgrading to Node 18 is not currently an option.

Including @types/node 16.11.20 in my dependencies and trying to type-check a script that uses your library is throwing these errors:

$ tsc --noEmit
node_modules/@dlenroc/testrail/src/internal/request.ts:70:34 - error TS2339: Property 'reason' does not exist on type 'AbortSignal'.

70     return Promise.reject(signal.reason);
                                    ~~~~~~

node_modules/@dlenroc/testrail/src/internal/request.ts:86:22 - error TS2339: Property 'reason' does not exist on type 'AbortSignal'.

86       reject(signal?.reason);
                        ~~~~~~

node_modules/@dlenroc/testrail/src/TestRail.ts:504:39 - error TS2339: Property 'reason' does not exist on type 'AbortSignal'.

504       return Promise.reject(ctxSignal.reason || options.signal.reason);
                                          ~~~~~~

node_modules/@dlenroc/testrail/src/TestRail.ts:504:64 - error TS2339: Property 'reason' does not exist on type 'AbortSignal'.

504       return Promise.reject(ctxSignal.reason || options.signal.reason);
                                                                   ~~~~~~

node_modules/@dlenroc/testrail/src/TestRail.ts:510:70 - error TS2339: Property 'reason' does not exist on type 'AbortSignal'.

510     const onAbort = () => { clearAbort(); controller.abort(ctxSignal.reason || optionsSignal.reason); };
                                                                         ~~~~~~

node_modules/@dlenroc/testrail/src/TestRail.ts:510:94 - error TS2339: Property 'reason' does not exist on type 'AbortSignal'.

510     const onAbort = () => { clearAbort(); controller.abort(ctxSignal.reason || optionsSignal.reason); };
                                                                                                 ~~~~~~


Found 6 errors in 2 files.

Errors  Files
     2  node_modules/@dlenroc/testrail/src/internal/request.ts:70
     4  node_modules/@dlenroc/testrail/src/TestRail.ts:504
error Command failed with exit code 2.

This seems to be because the AbortSignal interface changed between Node 16 and 18. I managed to pass your library the signal by hand (as opposed to using AbortSignal.timeout() as discussed in #70 since this isn't available in Node 16), so all my code passes type checks, but TypeScript seems to be checking the .ts files in your library despite my ignoring node_modules in tsconfig.json.

I created a minimum reproducible example here: https://github.com/treyturner/testrail-debug. You can see the problem I'm having by running yarn type-check. Is this a misconfiguration on my part?

I'm pretty inexperienced when it comes to JS/TS build configuration and package bundling; I see you ship both a dist folder and a types.d.ts file in your package. Are the .ts files needed? It occurs to me that if they weren't included, TypeScript wouldn't take issue with the package.

Thanks again for your time and work on the library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.