Giter Club home page Giter Club logo

node-testrail-api's Introduction

rundef's github stats

Top Langs

node-testrail-api's People

Contributors

dreef3 avatar jsoet avatar nicholasboll avatar nicoaiko avatar rundef avatar xywang68 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

List Projects: is_completed should be 0 or 1

If we are using the function below to get all the projects, we have to pass 'is_completed: false' to FILTERS. But I could not retrieve any project with it.

testrail.getProjects(/FILTERS=/{is_completed: false}, function (err, response, projects) {
console.log(projects);
});

While if we look at TestRail API v2 reference, is_completed is either 0 or 1, not true or false. Can you please check?

http://docs.gurock.com/testrail-api2/reference-projects

All active projects

GET index.php?/api/v2/get_projects&is_completed=0

OPTIONS preflight error in Chrome

When trying to make a basic call, I will get a preflight error

Failed to load https://myinstance.testrail.com/index.php?/api/v2/get_project/1: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 400. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Is there a way to set that? Or is there some other special setting I need to do?

@types/request missing for Typescript projects

Pretty much as the title says, if you use this package in a typescript project, you get errors saying that there are no type definition for the request library. Easy workaround is to install @types/request on the project, but it would be better if the dependency was specified by node-testrail-api

API calls returning "undefined"

Thanks for the thorough work; the other available packages were missing various API calls.

We're new to Test Rail and I'm attempting to integrate this into our test automation suite, but every test I run returns undefined. For example:

'use strict';

var Testrail = require('testrail-api');

describe( "This Test Rail test", function ()
{
    var testrail = new Testrail({
        host: 'https://url.to.host.goes.here',
        user: '[email protected],
        password: 'API Key goes here'
    });

    it( "should update the status of Case #2 for Run #2 to Failed", function (done)
    {
        testrail.addResultsForCases(/*RUN_ID=*/2, /*CONTENT=*/{ "case_id": 2, "status_id": 5, "comment": "this test has failed" }, function (err, results)
        {
            console.log(results);
            done();
        });
    })
});

Your example for this particular API call didn't specify that an explicit array was required, which is what the API expects, but I've tried it both ways and it returns undefined each time. Apologies if I'm just missing something simple; I am new to Node as well.

Thanks!

Type definitions are incorrect since #8

#8 added a wrapper object to responses returned in the callback and in the promise, but the type definitions were not updated to reflect this change.

Example

testrail.getRun(1).then(run => {
  console.log(run.id) // Type definitions say `id` exists, but logs `undefined`
  console.log(run.body.id) // Type error, but logs `1`
})

My code is working in a mocha before(), but not in an after(), is there any known reason for this?

The following code block works with a runId printing:

before(function () {
    testrail.getRuns(/*PROJECT_ID=*/1, /*FILTERS=*/{}, function (err, response, runs) {
        let runId = runs[0].id
        console.log('runId:', runId)
    });
})

This code does not work with no print occurring at all. There is no error either as err is null.

after(function () {
    testrail.getRuns(/*PROJECT_ID=*/1, /*FILTERS=*/{}, function (err, response, runs) {
        let runId = runs[0].id
        console.log('runId:', runId)
    });
})

I've used this before without the issue, but now this is happening in a new implementation. What could be causing this?

[Discussion] Provide response status code for each api call

Hello there again.

Do you mind if we add some more response to each api call?
As it is right now, we can't deal different status codes as the package just doesn't sends them through with the response's body.

I'll do a Pull Request for it, if you don't mind. We can discuss further then.

callback is not a function

There is a error in the code: index.js line 90: callback(err.message || err)
but this code branch executed when typeof callback !== 'function'

TestRail 7.2.1 release is imminent as of Sept 3, 2021

TestRail 7.2.1 release news

The newest release for Testrail will update JSON response object to all Bulk API endpoints.

Right now before the update is released, it is possible to receive the new JSON response object by including the ‘x-api-ident’: ‘beta’ header/value pair in API requests.

Is there support for being able to query the beta bulk API endpoints and also node-testrail-api support for the new offset and limit parameters for the new pagination features?

What sort of things would need to be improved in order to achieve this testrail functionality on this npm package?

Add pending PR

Can someone merge the new PRs that passed all checks?

Missing Support to Auth Token

Actually into the TestRails Api we can use a token instead of username/password, so I've a token for that and in this repo I can't found any way to use it. Please add support for this kind of tokens. Thanks.

Unexpected end of JSON input

I get this error when I try to test testrail.deleteSection

Here's the output message in my terminal.

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Request._callback (...path/node_modules/testrail-api/index.js:88:29)
    at Request.self.callback (...path/node_modules/request/request.js:186:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (...path/node_modules/request/request.js:1163:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (...path/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1055:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

And here's my test code:

const sectionObject = {
  name: 'Test Section',
};

testrailInstance.addSection(projectId, sectionObject)
  .then((result) => {
    testrailInstance.deleteSection(result.id)
      .then(console.log)
      .catch(console.log);
  })
  .catch(console.error);

What's going on here? It can't JSON.parse the result?

Pagination

Since recent TestRail update, they introduced pagination, e.g. https://www.gurock.com/testrail/docs/api/reference/tests#gettests
We need to use offset (Number that sets the position where the response should start from (Optional parameter) (requires TestRail 6.7 or later)), but the current methods do not support offset configuration:

testrail.getTests(/*RUN_ID=*/1, /*FILTERS=*/{}, function (err, response, tests) {
  console.log(tests);
});

Are you planning to add it?

addResults error

Hi,
if i submit this request with valid data:

testrail.addResults(300, {"results": [{"test_id": 301386, "status_id": 5, "comment": "This test failed", "defects": "TR-7"}]})

than i get following error message:

{"message":{"error":"Field :results.test_id is a required field."},"response":{"statusCode":400,"body":"{"error":"Field :results.test_id is a required field."}"

Best Regards

Missing case_id in API addResultsForCases

It looks like the addResultsForCases is missing case_id:

TestRail.prototype.addResultsForCases = function (run_id, data, callback) {
  return this.apiPost('add_results_for_cases/' + run_id, JSON.stringify({ results: data }), callback);
};```
Should have been:

TestRail.prototype.addResultsForCases = function (run_id, case_id, data, callback) {
return this.apiPost('add_results_for_cases/' + run_id+'/'+case_id, JSON.stringify({ results: data }), callback);
};```

According to the docs:
"The difference to add_result is that this method expects a test run + test case instead of a test."
POST index.php?/api/v2/add_result_for_case/:run_id/:case_id
https://www.gurock.com/testrail/docs/api/reference/results#addresultforcase

addResults and addResultsForCases

Either the type definitions for addResults and addResultsForCases is incorrect, or the runtime implementation is incorrect:

testrail.addResultsForCases(1, [{
  case_id: 1,
  status_id: 1,
  comment: 'This is an automated comment.'
  elapsed: 0,
  assignedto_id: 16
}])

// TypeScript is happy, but I get a 400: { message: { error: 'Field :results is a required field.' }

I think the type definitions make sense so the implementation would have to change to wrap data with a results wrapped:

TestRail.prototype.addResults = function (run_id, data, callback) {
  return this.apiPost('add_results/' + run_id, JSON.stringify({ results: data }), callback);
};

TestRail.prototype.addResultsForCases = function (run_id, data, callback) {
  return this.apiPost('add_results_for_cases/' + run_id, JSON.stringify({ results: data }), callback);
};

That change would probably break anyone using these methods and providing the results wrapping manually.

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.