cypress-testrail-reporter is not updating the result in testrail - cypress

I am trying to update the results of my testcases to testrail , and i tried to use the below options
reporter: "cypress-testrail-reporter",
reporterOptions: {
"host": "URL",
"username": "name",
"password": "api",
"projectId": 82,
"suiteId": 11092
}
And as i given the proper name for my TC in my script as well
it("C305662 testcases",
But , i can see new testrun is getting created and it is added the testcases from suite , but result of the TC "C305662" is not getting updated after run.
I am not seeing any errors either
any inputs to fix

Related

Is there an API that shows the user task histroy on the Camunda side?

I have a Camunda flow, there are 2-3 user tasks in this flow. I want to see their history after completing these tasks. There are a couple of methods, but I just want to get both the label and the entered value with rest-api.
I can't get them directly with rest-api.
The following method returns variables with the processInstanceId.
List<HistoricVariableInstance> instances = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(processIntanceId)
.list();
but I need to call another rest-api to get the labels. GET /process-definition/{id}/xml with this api.
Other topics have been opened for this, but it does not meet exactly what I want.
similar question
I think you are right, you need 2 steps. I would combine the following requests:
First get all User Tasks:
GET /history/task -see API Reference
From its result Array you need the id and the name (which is the label):
[{"id":"anId",
...
"name":"aName",
...
}]
Now you can get the variables for each UserTask, like
GET /history/variable-instance?taskIdIn=YourTaskId see API Reference
https://docs.camunda.org/manual/7.16/reference/rest/history/variable-instance/post-variable-instance-query/
returns the name (label) and the value of the process variables
[
{
"id": "someId",
"name": "someVariable",
"type": "Integer",
"variableType": "integer",
"value": 5,
"valueInfo": {},
"processDefinitionKey": "aProcessDefinitionKey",
"processDefinitionId": "aProcessDefinitionId",
"processInstanceId": "aProcInstId",
"executionId": "aExecutionId",
"activityInstanceId": "aActivityInstId",
"caseDefinitionKey": null,
"caseDefinitionId": null,
"caseInstanceId": null,
"caseExecutionId": null,
"taskId": null,
"tenantId": null,
"errorMessage": null,
"state": "CREATED",
"createTime":"2017-02-10T14:33:19.000+0200",
"removalTime": "2018-02-10T14:33:19.000+0200",
"rootProcessInstanceId": "aRootProcessInstanceId"
}
]

Accessing Cypress results outside of the application to display on a Webpage

Scope: I am trying to make a website (hub) that displays the test results of other websites in a table like format. For Example:
Google.com - 42 tests - 41 passed.
Or Ebay.com - 50 tests - 50 passed.
Then for each website have a green or red if all the tests pass.
I have been looking for a way to access Cypress results like you would access an API to get data from it to be displayed. Is there already a Cypress function like this, that enables access to test results outside of the application?
You might be interested in running via the Module API, specifically
const cypress = require('cypress')
cypress
.run({
// the path is relative to the current working directory
spec: './cypress/integration/examples/actions.spec.js',
})
.then((results) => {
console.log(results)
})
Results - Stats section
{
...
"stats": {
"suites": 1,
"tests": 1,
"passes": 0,
"pending": 0,
"skipped": 0,
"failures": 1,
"startedAt": "2020-08-05T08:38:37.589Z",
"endedAt": "2018-07-11T17:53:35.675Z",
"duration": 1171
},
}
or per test details
"tests": [{
"title": [ "test" ],
"state": "failed",
You can use a reporter to customize what the output of the report looks like, as well as several other things, including a destination output for the results. Check out Cypress's documentation on reporters for more information.
Cypress's Reporter Documentation

"NoSuchSessionError: This driver instance does not have a valid session ID" when running a simple Selenium Runner test

I just installed the latest version of Selenium Runner
npm install -g selenium-side-runner
on my Mac High Sierra. I'm running node v14.1.0. I'm using Chrome Driver v 83. I want to run a very simple file that simply opens a page, waiting for an element on that page to be present. However, I'm getting a "NoSuchSessionError: This driver instance does not have a valid session ID" error.
The Selenium Runner .side file in question is
$ cat selenium/KarmaDecayGetResults.side
{
"id": "9664bd47-b18f-405f-9bd3-06014919ca7e",
"version": "2.0",
"name": "KarmaDecay",
"url": "http://karmadecay.com",
"tests": [
{
"id": "8f462171-01b8-4247-87b9-40e2d1fef143",
"name": "KarmaDecay",
"commands": [
{
"id": "c297319b-4350-4f04-b72e-1a347a67100c",
"comment": "",
"command": "open",
"target": "/r/gifs/comments/gz5v5j/caracal_visits_jimmy_kimmel_gets_shy_and_tries_to/",
"targets": [],
"value": ""
},
{
"id": "32f35ed7-1a28-4540-a93d-3cb8ba0e012a",
"comment": "",
"command": "pause",
"target": "",
"targets": [],
"value": "2000"
},
{
"id": "95261633-22ff-4477-ab6f-7b3354bea8b9",
"comment": "",
"command": "setWindowSize",
"target": "1440x900",
"targets": [],
"value": ""
},
{
"id": "fbf35ed7-1a28-4540-a93d-3cb8ba0e012a",
"comment": "",
"command": "waitForElementPresent",
"target": "id=content",
"targets": [],
"value": ""
},
{
"id": "aed35ed7-1a28-4540-a93d-3cb8ba0e012a",
"comment": "",
"command": "waitForElementVisible",
"target": "id=content",
"targets": [],
"value": ""
},
{
"id": "fbf59ed7-1a28-4540-a93d-3cb8ba0e012a",
"comment": "",
"command": "pause",
"target": "",
"targets": [],
"value": "2000"
}
]
}
],
"suites": [
{
"id": "91809d77-24c1-457b-8266-516b2fc58555",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": [
"8f462171-01b8-4247-87b9-40e2d1fef143"
]
}
],
"urls": [
"http://karmadecay.com/"
],
"plugins": []
}
Below is the output of running the file ...
$ PATH=/Users/davea/Documents/workspace/article_project/selenium/dev:/usr/local/bin:$PATH /usr/local/bin/selenium-side-runner -c "goog:chromeOptions.args=[--headless,--nogpu] browserName=chrome" selenium/KarmaDecayGetResults.side
FAIL ./DefaultSuite.test.js (301.959s)
Default Suite
✕ KarmaDecay (300540ms)
● Default Suite › KarmaDecay
: Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.Error:
8 | jest.setTimeout(300000);
9 | describe("Default Suite", () => {
> 10 | it("KarmaDecay", async () => {
| ^
11 | await tests["KarmaDecay"](driver, vars);
12 | expect(true).toBeTruthy();
13 | });
at new Spec (../../../../../../usr/local/lib/node_modules/selenium-side-runner/node_modules/jest-jasmine2/build/jasmine/Spec.js:116:22)
at Suite.<anonymous> (DefaultSuite.test.js:10:3)
● Default Suite › KarmaDecay
NoSuchSessionError: This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used.
at ../../../../../../usr/local/lib/node_modules/selenium-side-runner/node_modules/selenium-webdriver/lib/webdriver.js:729:38
at Object.thenFinally [as finally] (../../../../../../usr/local/lib/node_modules/selenium-side-runner/node_modules/selenium-webdriver/lib/promise.js:124:12)
at runMicrotasks (<anonymous>)
at WebdriverEnvironment.global.cleanup (../../../../../../usr/local/lib/node_modules/selenium-side-runner/node_modules/jest-environment-selenium/dist/index.js:30:7)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 302.159s
Ran all test suites.
Do I need to be doing something different to get my test to run cleanly?
invalid session id
The invalid session ID error is a WebDriver error that occurs when the server does not recognize the unique session identifier. This happens if the session has been deleted or if the session ID is invalid.
A WebDriver session can be deleted through either of the following ways:
Explicit session deletion: A WebDriver session is explicitly deleted when explicitly invoking the quit() method.
Implicit session deletion: A WebDriver session is implicitly deleted when you close the last window or tab invoking close().
You can find a detailed discussion in selenium.common.exceptions.WebDriverException: Message: invalid session id using Selenium with ChromeDriver and Chrome through Python
This usecase
I don't see any such error within your code block. However your main error seems to be...
Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.Error:
...which implies that the Async callback being referred to in the error is getting timedout even with timeout set as 300000:
jest.setTimeout(300000);
The real issue is with the url of KarmaDecay which contains a hCaptcha to keep off automated bots.
URL Snapshot:
Conclusion
As per your test setup to execute the selenium-side-runner within the website http://karmadecay.com/ first you have to interact with the captcha to get authenticated and then run your tests.
You can find a couple of relevant discussions on how to interact with recaptcha in:
How to identify the 32 bit data-sitekey of ReCaptcha V2 to obtain a valid response programmatically using Selenium and Python Requests?
Find the reCAPTCHA element and click on it — Python + Selenium
How to click on the reCaptcha using Selenium and Java
Another aspect
If the initial tests works fine but for the rest of your tests you get a session ID error most possibly the Selenium WebDriver controled Browsing Context is getting detected and hence blocking the next requests.
There are different reasons for the WebDriver controled Web Browser to get detected and simultaneously get blocked. You can find a couple of detailed discussion in:
Can a website detect when you are using selenium with chromedriver?
Selenium webdriver: Modifying navigator.webdriver flag to prevent selenium detection

Check the code coverage for a project on sonar with rest api

Sonar version : 5.3
I am making this call
https://mysonar/api/resources/index?metrics=coverage&key=test-project
However , I am not getting the coverage of test-project from this call.
But I am getting rest of the projects and their coverages.
When I just do this
https://sonaraws.kdc.capitalone.com/api/resources/index
I am able to see my test-project on the api response.
How do I drill down to a specific project and not check the other projects from the rest call to Sonar.
I am using the below api for fetching coverage. Sonarqube version - 6.7.5
Get the componentId for a project using first api listed below.
https://sonarurl/api/components/show?key=ProjectKey
https://sonarurl/api/measures/component?componentId=Ahvhjvds87373&metricKeys=coverage
Response
{
"component": {
"id": "Ahvhjvds87373",
"key": "ProjectKey",
"name": "ProjectName",
"qualifier": "TRK",
"measures": [{
"metric": "coverage",
"value": "79.3",
"periods": [{
"index": 1,
"value": "0.0"
}]
}]
}
}
The api/resources doesn't support the key parameter. You have to specify project id by using qualifiers and resource parameters.
This should work for you:
https://mysonar/api/resources/index?metrics=coverage&qualifiers=TRK&resource=test-project
Available values of the qualifiers parameter:
VW: view
SVW: sub-view
TRK: project
BRC: module
UTS: unit test
DIR: directory
FIL: file
DEV: developer

SonarQube 5.5 API - componentKey convention

I'm trying to extract coverage data from our SonarQube instance using the 'api/measures/component' endpoint. This is for a multi module java project. Using POSTMAN i can query for a single java file using a 'componentKey' which is build up of string like this
[maven-groupId]:[maven-artifactId]:[path to java file]
which generates a string like
com.i.pc.e.components.o:om-wf-e:src/main/java/com/i/e/o/wf/actions/Xxxx.java
and returns this json response
{
"component": {
"id": "AVci_6G7elHqFlTqG_OC",
"key": "com.i.pc.e.components.o:om-wfl-e:src/main/java/com/i/e/o/wf/actions/Xxxx.java",
"name": "Xxxx.java",
"qualifier": "FIL",
"path": "src/main/java/com/i/e/om/wf/actions/Xxxxx.java",
"language": "java",
"measures": []
},
"metrics": [
{
"key": "coverage",
"name": "Coverage",
"description": "Coverage by unit tests",
"domain": "Coverage",
"type": "PERCENT",
"higherValuesAreBetter": true,
"qualitative": true,
"hidden": false,
"custom": false,
"decimalScale": 1,
"bestValue": "100.0",
"worstValue": "0.0"
}
]
}
This is fine for a one-off request but I need to do this for a number of Java source files and I won't have the Maven details to hand.
Is there a convention or documentation on the format of the 'componentKey'?
Ideally i'd like to define the full package and java source file name in the 'compomentKey' or is there a way to look up the 'componentId' via some other REST API call?
Use the components service to iterate through your tree (or sub-trees within your tree) starting from your project and feeding your sonar.projectKey value into the baseComponentKey parameter. Pay particular attention to the strategy parameter, which determines what sub-set of children a call retrieves.
Once you have the data on each child, it should be simple to iterate through them to get their measures.

Resources