How to pass screenshot for the failed testcases to Report Portal. I am using Nightwatch for UI automation - ui-automation

Under the nightwatch.conf.js I have.
"screenshots": {
"enabled": true,
'on_failure': true,
'on_errors': true,
'path': 'tests_output/screenshots'
},
Although, this generates screenshots for failed testcases under the 'screenshots' folder but it doesn't share them on the Report portal. How can I achieve that?

Related

Azure Function : Release pipeline to include appsettings.json values

I have 2 settings file in my Azure Functions Project.
1)local.settings.json
2)appsettings.json
In the Startup.cs I am combining both into a single Configuration and everything works fine in the code with local debugging.
Config = new ConfigurationBuilder()
.SetBasePath(currentDirectory)
.AddConfiguration(configuration)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.Build();
The Appsetings.json contains nested values.
eg:
{
"Test":
{
"abc":"def"
}
}
I am deploying my code to a function App using the Release pipeline in Azure DevOps.
I am using "Azure App Service Settings" task in my release pipeline to substitute the values in the final deployment to the Function App.
So the values that go in the Release task mentioned above is,
[
{ "name": "FUNCTIONS_WORKER_RUNTIME", "value": "dotnet", "slotSetting": false },//from local.settings.json
{ "name": "Test__abc", "value": "def", "slotSetting": false },//from appsettings.json
]
ISSUE:
The code get deployed without any issue and the local.setting.json value is passing through fine. But the issue is with the appsettings.json value. This is getting added to the Configuration tab in Azure Portal, but it does not seem to be used by the app. The app is erroring out because that value is null.
How do I pass the appsetting value through the release task to Azure Functio?
The app started to work after I added .AddEnvironmentVariables() in startup.
Config = new ConfigurationBuilder()
.SetBasePath(currentDirectory)
.AddConfiguration(configuration)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables()
.Build();

Cannot get coc-java to work offline with gradle

I am trying to get coc-java to work in an environment where I don't have internet access. I generated my setup with internet access and transferred it to the offline environment, but when I open a java file and do :CocCommand workspace.showOutput and choose coc-java, I get a stacktrace beginning with Cannot download published Gradle versions. at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions.downloadVersionInformation(PublishedGradleVersions.java:165)...Caused by: java.net.UnknownHostException: services.gradle.org. I have gradle 7.4.2 already installed, and have the following settings in ~/.vim/coc-settings.json:
"java.enabled" : true,
"java.autobuild.enabled": true,
"java.codeGeneration.generateComments": true,
"java.implementationsCodeLens.enabled": true,
"java.referencesCodeLens.enabled": true,
"java.completion.enabled" : true,
"java.foldingRange.enabled" : true,
"java.format.comments.enabled" : true,
"java.format.enabled" : true,
"java.format.onType.enabled" : true,
"java.home" : "/usr/java/jdk-11.0.2",
"java.import.gradle.enabled": true,
"java.import.gradle.offline.enabled": true,
"java.import.gradle.home": "/home/me/.opt/gradle/gradle-7.4.2",
"java.import.gradle.user.home": "/home/me/.gradle",
"java.import.gradle.version": "7.4.2",
"java.import.gradle.wrapper.enabled": false,
"java.import.maven.enabled": true,
"java.progressReports.enabled" : false,
"java.trace.server": "verbose",
"java.configuration.runtimes": [
{
"name": "JavaSE-11",
"path": "/usr/java/jdk-11.0.2",
"default": true
}
]
The coc-java docs says this about java.import.gradle.home: Use Gradle from the specified local installation directory or GRADLE_HOME if the Gradle wrapper is missing or disabled and no 'java.import.gradle.version' is specified.
I've tried removing java.import.gradle.version as well, but same issue occurs.
Given that the stacktrace mentions eclipse buildship, I've tried Googling how to change eclipse/buildship settings, but haven't been able to find out how to configure offline settings, if that's even possible. Has anyone been able to get coc-java to work offline with gradle?
TL;DR
Place the gradle-bin zip file in $GRADLE_USER_HOME/wrapper/dists/gradle-<some-version>-bin/<some-hash>/
Long Version
I finally managed to hack my way around it. Even with the two properties set in coc-settings.json:
"java.import.gradle.offline.enabled": true,
"java.import.gradle.wrapper.enabled": false,
... It still seemed to be trying to fetch gradle-7.1.1 from services.gradle.org. After taking a look in $GRADLE_USER_HOME, I noticed a wrapper directory, despite never using gradle-wrapper for anything, so I dug deeper. After a lot of playing around, I managed to get it to work by taking a gradle-7.4.2-bin.zip file I already had and placing it in $GRADLE_USER_HOME/wrapper/dists/gradle-7.1.1-bin/f29rtwfnc96ub43tt7p47zsru/. I'm not sure the significance of that hash value nor why it would point to version 7.1.1 of gradle, but after putting the zip file there and opening a java file, it proceeded to create the gradle-7.4.2 folder under that hash folder with everything needed underneath, and coc commands started to work!

Need to report on data from Retrospectives - Azure Dev Ops

We need a way to access data through an automated way (either Rest API or some SDK) that is contained within the Retrospective Azure Dev Ops extension. Currently, there is an option to export CSV but the process is manual and limited to each Retrospective. Any ideas/thoughts?
You can try like as the following steps:
Run the API to get the information of project teams in a project.
Request URL
POST https://dev.azure.com/{organization_Name}/_apis/Contribution/HierarchyQuery?api-version=5.0-preview.1
Request Body
{
"contributionIds": ["ms.vss-admin-web.org-admin-groups-data-provider"],
"dataProviderContext": {
"properties": {
"teamsFlag": true,
"sourcePage": {
"url": "https://dev.azure.com/{organization_Name}/{project_Name}/_settings/teams",
"routeId": "ms.vss-admin-web.project-admin-hub-route",
"routeValues": {
"project": "{project_Name}",
"adminPivot": "teams",
"controller": "ContributedPage",
"action": "Execute",
"serviceHost": "{organization_Id} ({organization_Name})"
}
}
}
}
}
Run the API to list the retrospectives for a specified project team in the project.
GET https://extmgmt.dev.azure.com/{organization_Name}/_apis/ExtensionManagement/InstalledExtensions/ms-devlabs/team-retrospectives/Data/Scopes/Default/Current/Collections/{projectTeam_identityId}/Documents?api-version=3.1-preview.1
Run the API to get more details about a specified retrospective.
GET https://extmgmt.dev.azure.com/{organization_Name}/_apis/ExtensionManagement/InstalledExtensions/ms-devlabs/team-retrospectives/Data/Scopes/Default/Current/Collections/{retrospective_Id}?api-version=3.1-preview.1
However, we have not any available interface (API or CLI) to Export CSV content.

How to implement protractor grid system using JavaScript?

I created web-application using angular-5 for chatting and audio-call. need to implement automation using protractor.
Example test cases:
1.send message from machine-1 and receive message from machine-2.
2.make call from machine-1 and end call from the machine-2.
How to write protractor test-cases for these kind of scenarios.
As of now my current implementation is like.
multiCapabilities: [
{
seleniumAddress: 'http://machine1/wd/hub',
browserName: 'chrome',
directConnect: true,
sequential: true,
specs: [
'e2e/sender/login.js',
'e2e/sender/sendmsg.js',
'e2e/sender/makecall.js']
},
{
seleniumAddress: 'http://machine2/wd/hub',
browserName: 'chrome',
directConnect: true,
specs: [
'e2e/receiver/login.js',
'e2e/receiver/receivemessage.js',
'e2e/receiver/endcall.js']
}
]
Note: when i run the protractor, both machines will execute the test cases parallel.
How to implement proper test cases using protractor to test these kind of scenarios Please suggest.
Thanks in Advance..
You need to use driver.forkNewDriverInstance() https://www.protractortest.org/#/api?view=ProtractorBrowser.prototype.forkNewDriverInstance to create new browser instance for the same test.

How to deploy an opsworks application by cloudformation?

In a cloudformation template, I create an opsworks stack, a layer, an instance and an application. This template sets up and configures the instance by a chef cookbook of recipes and scripts. How can I deploy the application automatically from the template without clicking manually on deploy inside the stack ? After the deploy the defined Deloy recipes from the cookbook are being executed:
"MyLayer": {
"Type": "AWS::OpsWorks::Layer",
"DependsOn" : "OpsWorksServiceRole",
"Properties": {
"AutoAssignElasticIps" : false,
"AutoAssignPublicIps" : true,
"CustomRecipes" : {
"Setup" : ["cassandra::setup","awscli::setup","settings::setup"],
"Deploy": ["imports::deploy"]
},
"CustomSecurityGroupIds" : { "Ref" : "SecurityGroupIds" },
"EnableAutoHealing" : true,
"InstallUpdatesOnBoot": false,
"LifecycleEventConfiguration": {
"ShutdownEventConfiguration": {
"DelayUntilElbConnectionsDrained": false,
"ExecutionTimeout": 120 }
},
"Name": "script-node",
"Shortname" : "node",
"StackId": { "Ref": "MyStack" },
"Type": "custom",
"UseEbsOptimizedInstances": true,
"VolumeConfigurations": [ {
"Iops": 10000,
"MountPoint": "/dev/sda1",
"NumberOfDisks": 1,
"Size": 20,
"VolumeType": "gp2"
}]
}
}
An application looks like this:
Any idea ?
Thank you.
The CreateDeployment API call generates a one-off event that executes the Deploy actions within your OpsWorks stack. I don't think any official CloudFormation resource maps to this directly, but here are some ideas on how to call it within the context of a CloudFormation template:
Write a Custom Resource that calls CreateDeployment (e.g., via the AWS SDK for Node.js) when created.
Add an AWS::CodePipeline::Pipeline resource to your template that's configured to deploy your OpsWorks app as part of a Deploy Stage. See Using AWS CodePipeline with AWS OpsWorks Stacks for documentation on this integration. (Though it's an extra service + layer of complexity, I think CodePipeline is a better layer of abstraction for modeling deployment actions in your application stack anyway.)
I believe this can be done within the recipes. So in your recipes you'll have a function to validate the app name and if it exists then proceed with the deployment.
For example your deploy recipe would look something like this:
if validator(node[:app][:name]) == true
do whatever
end
and this validator function can reside in your chef library:
def validator(app_name)
app = search("aws_opsworks_app", "name:#{app_name}").first
if app[:deploy] == true
Chef::Log.warn("PROCEEDING: Deploy initiated for #{app[:name]}")
end
end