Assertions results for passed test are empty after upgrading to Jasmine2 in protractor - angularjs

I am using "resultJsonOutputFile" to write my test results in json format. Recently i have migrated to Jasmine2.0, but after that, assertions results for passed test is empty in the json output.
The issue was with assertions for only passed test cases. failed cases are perfectly fine. Before adding Jasmine2 as framework in config, i used to get assertions results for passed ones too. eg: below
[
{
"description": "test1",
"assertions": [
{
"passed": true
}
],
"duration": 4304
}
]
But after adding framework: jasmine2, the resultjsonoutput looks like this.
[
{
"description": "test1",
"assertions": [],
"duration": 12251
},
{
"description": "test2",
"assertions": [
{
"passed": false,
"errorMsg": "Failed: No element found using locator: By.cssSelector(\".search-box-desktop1\")",
"stackTrace": "Error: Failed: No element found using locator: By.cssSelector"
}
],
"duration": 14724
}
]
Only change I have made is framework change in config. So I am confused with output now.

Its an issue in protractor and will be getting resolved in release. Checked in Code

Related

Why is Google App Engine throwing access forbidden errors?

Could really use some help here. I have a GAE NodeJS app in the standard environment. Until a few days ago (09/23) it was running just fine, it would respond to requests as expected, etc.
Today, the app responds with 403's when I try to make any request to my appspot url. I'm 100% certain this is not a code issue, as if I deploy the same code to GAE in another project, it works fine. Furthermore, the only firewall rule is a wildcard to allow all traffic.
Edit: adding the only relevant-looking log entry I see from the project:
{
"protoPayload": {
"#type": "type.googleapis.com/google.cloud.audit.AuditLog",
"status": {},
"authenticationInfo": {
"principalEmail": "address#domain.com"
},
"requestMetadata": {
"callerIp": "x.x.x.x",
"requestAttributes": {
"time": "2021-09-23T15:04:05.198927Z",
"auth": {}
},
"destinationAttributes": {}
},
"serviceName": "appengine.googleapis.com",
"methodName": "google.appengine.v1.Services.UpdateService",
"authorizationInfo": [
{
"resource": "apps/my-google-cloud-project-id/services/default",
"permission": "appengine.services.update",
"granted": true,
"resourceAttributes": {}
}
],
"resourceName": "apps/my-google-cloud-project-id/services/default",
"serviceData": {
"#type": "type.googleapis.com/google.appengine.v1.AuditData",
"updateService": {
"request": {
"name": "apps/my-google-cloud-project-id/services/default",
"service": {
"networkSettings": {
"ingressTrafficAllowed": "INGRESS_TRAFFIC_ALLOWED_INTERNAL_AND_LB"
}
},
"updateMask": "networkSettings"
}
}
},
"resourceLocation": {
"currentLocations": [
"us-east1"
]
}
},
"insertId": "an-id",
"resource": {
"type": "gae_app",
"labels": {
"project_id": "my-google-cloud-project-id",
"zone": "",
"module_id": "default",
"version_id": ""
}
},
"timestamp": "2021-09-23T15:04:05.131761Z",
"severity": "NOTICE",
"logName": "projects/my-google-cloud-project-id/logs/cloudaudit.googleapis.com%2Factivity",
"operation": {
"id": "some-operation-uuid",
"producer": "appengine.googleapis.com/admin",
"first": true
},
"receiveTimestamp": "2021-09-23T15:04:05.495890906Z"
}
I don't recall making this change, and I'm not sure what the ingressTrafficAllowed value was before.
Somehow the ingress setting on the GAE service got changed. I believe that issue was fixed by going to GCP console > App Engine > Services > select affected service(s) -> Edit ingress setting from the top, and select the appropriate value.
I say I believe this fixed the issue as I was still getting 403's on my appspot url after doing this, and ultimately I ended up deleting and re-creating the project from scratch, which got everything working again. Clearly there was some misconfiguration somewhere in my project, but GCP does not make it easy to diagnose what the issue might be.

I have a datastudio error - basic json config

I've returned to try and make some datastudio custom javascript.
So I started off with a template type settings and basic js. Manifest is listing correctly - datastudio sees the custom item.
I took a long time for it to be authorised.
However, on adding the custome js, the console is reporting a load of erros.
first : data.0.type is not a valid config
second : data.0.elements.data.0.type is not a valid config.
Json:
{
"data": [
{
"id": "idtestviz",
"label": "Dimension Element Heading",
"type":"DIMENSION"
}
]
,
"style": [
{
"id": "idtestvizstyles",
"label": "Test Styles",
"elements":[
{
"id":"idtestvizfontcolor",
"label":"Font Colour",
"defaultValue":"#FFFF00"
}
]
}
]
}
It did have options in before, same error.
And appears to be the same as in https://developers.google.com/datastudio/visualization/define-config
Also it also is erroring on 'is already used in the config'
and that data.0.elements.style.0.elements.0.type required field that cannot be found
Seems like there are more checks that need to be done.
Is there a validator for json etc. before running, or has something updated on google side that their documentation hasn't been updated yet?
Or the more likely aspect, I'm missing some critical stuff...
Regards
Vince
Re checked my json config with a previous one that works, noted some errors in the objects. Corrected those and the json errors in the console have gone away.
JS errors remain - working on those... closing this question.
{
"data": [
{
"id":"test_viz_data",
"label":"Test Viz Data",
"elements":[
{
"id": "text_viz_dimensions",
"label": "Dimension Element Heading",
"type": "DIMENSION",
"options": {
"min": 1,
"max": 1
}
}
,
{
"id": "test_metrics",
"label": "Metric fields",
"type": "METRIC",
"options": {
"min": 1,
"max": 1
}
}
]
}
]
,
"style": [
{
"id": "idstyles",
"label": "Test Styles",
"elements":[
{
"id":"idfontcolor",
"label":"Font Colour",
"type":"FONT_COLOR",
"defaultValue":"#FFFF00"
}
]
}
]
,
"interactions": [
]
}

OData is returning Upper-case properties when filtering

I'm working on a project which has a front-end made in Reactjs + axios, and a backend with .NET Core 3.1 Web API which is configured to allow OData filtering.
Everything is working fine, but I only have one small problem.
If I consume, e.g: GET /api/questions without any OData filtering, I receive:
[
{
"id": "005b46c6-1811-42f2-b917-00178e916d2e",
"value": "List the requirements for Schedule III, IV, & V Prescriptions.",
"required": true,
"sequence": 0,
"questionType": {
"id": "4227e559-3b14-4e07-b90e-73151f723698",
"name": "Rating",
"value": "rating-question",
"description": "a question in where the user rates the answer"
},
"ratingSetting": {
"id": "5e6a883a-084d-4400-bdf2-78b97e2eba18",
"name": "Poor to Excellent",
"minValueText": "Poor",
"maxValueText": "Excellent",
"optionCount": 5
},
"answers": []
},
...
]
But if I perform some filtering, for example: GET /api/admin/questions?$select=id, value&$expand=questionType($select=name)&$expand=ratingSetting($select=name) the result contains an array where every property has changed to Upper-case:
[
{
"QuestionType": {
"Name": "Rating"
},
"RatingSetting": {
"Name": "Poor to Excellent"
},
"Id": "005b46c6-1811-42f2-b917-00178e916d2e",
"Value": "List the requirements for Schedule III, IV, & V Prescriptions."
},
...
]
As you can see, every property is upper case. This is causing me trouble when I try to bind the result object, because it's not the same question.id against question.Id, so I'm having an undefined exception in the front-end.
Is there any configuration that I have to perform in my backend to solve this?
Make sure you are using a contract resolver by specifying the appropriate NewtonSoftJsonOptions:
services.AddControllers(options =>
options.EnableEndpointRouting = false)
.AddNewtonsoftJson(options =>
{
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
});
Install these libraries:
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Microsoft.AspNetCore.OData.NewtonsoftJson" Version="8.0.4" />
Then add this in startup.cs or program.cs:
services.AddControllers().AddOData(options =>
{
options.EnableQueryFeatures(maxTopValue: 500);
})
.AddODataNewtonsoftJson()
.AddNewtonsoftJson(options =>
{
options.SerializerSettings.ContractResolver =
new CamelCasePropertyNamesContractResolver();
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
});

Multiple array definitions for single array in Azure API-management

I created a project that returns an array. Looking at the swagger.json everything looks fine, importing this swagger.json . But when I download the API definition from the developer portal I see some objects like ...Array, ...Array-1, ...Array-2. Which I don't expect:
How can I prevent this? How can I ensure that the generation behaves the same as my normal object (so no dashes, but dots). I created an example project that reproduces my issue: https://github.com/mvdiemen/SwaggerArrayGenerationExample.
Is this related to changes in Azure API management that are described over here? : https://blog.tomkerkhove.be/2018/04/13/changes-to-azure-api-management-openapi/
APIM does not support inlined schema. Try specifying schemas for response/request via $ref only, even if it's an array of object you've already defined - define a new object of type array and reference it.
So, instead of something like this:
"200": {
"description": "Success",
"schema": {
"uniqueItems": false,
"type": "array",
"items": {
"$ref": "#/definitions/SwaggerGenerationSample.Models.Response.Employee"
}
}
}
Have array itself defined in definitions and reference it:
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/EmployeeArray"
}
}
...
"definitions": {
"EmployeeArray": {
"uniqueItems": false,
"type": "array",
"items": {
"$ref": "#/definitions/SwaggerGenerationSample.Models.Response.Employee"
}
}
}

How to show broken tests under failed test category in allure report

I am trying to customize my CATEGORIES section to show broken test as failed test in allure report.
I am using the following categories JSON file:
[{
"name": "Product defects",
"traceRegex": ".*org.openqa.selenium.NoSuchElementException.*",
"matchedStatuses": ["failed"]
}]
I want all defects under Product defects category(failed tests). Can this be achieved?
I think you should not use category.json file to do that.
This file only allows you to add new categories for filtering/sorting. It has nothing to do with statuses.
What you are trying to achieve (show broken test as failed test) is something different.
this might work for you. It puts all failed testcases under the category
Product defects.
[{
"name": "Product defects",
"matchedStatuses": ["failed"]
}]
You could also try to add a category ignore.
[
{
"name": "Product defects",
"matchedStatuses": ["failed"]
},
{
"name": "Ignored tests",
"matchedStatuses": [ "skipped" ]
}
]
Catch the exception and re-throw an exception of type AssertionError. Currently Allure display test as Fail only on AssertionError and all Exception is treated as Broken

Resources