Tuesday, 28 September 2021
Friday, 24 September 2021
Ashot library to your visual automation in java based project
Though I was very impressed last time when I used webdriverIO visual automation capability, but the flakiness which comes with it, always made me skeptical about relying on it much. And now, when I am again back to java based automation framework, I feel it to give it a try one more time.
So after searching about the library which can give support the visual capability for a java based project, I came across the Ashot library. I added its dependency in my maven project and started working on a POC. I tried to do a comparison for a static page, specific web element and then a page having dynamic content.
In my local machine, I didn't face any issue, and it worked great. But the one thing, which disappointed me is their support. Looks like, team is not actively maintaining the code. And it might be, that if you will stuck at some place, you wouldn't find support much.
So if you have a java maven project, add Ashot maven dependency.
<dependency>
<groupId>ru.yandex.qatools.ashot</groupId>
<artifactId>ashot</artifactId>
<version>1.5.4</version>
</dependency>
Sonar lint [A must have tool] for your automation project and team
Recently I feel the need to have a static code analysis of my one of the java automation project. I was aware about the sonar qube and sonar lint but I never implemented or used these tool in any of my automation project. Though in one of my Typescript bases project we have used TSLint which was very impressive.
So I started googling about it. And picked one of my sample project to use these tools. Let me first differentiate between these 2.
Sonar lint lives only in the IDE (IntelliJ, Eclipse and Visual Studio). Its purpose is to give instantaneous feedback as you type your code. For this, it concentrates on what code you are adding or updating.
SonarQube is a central server that processes full analyses (triggered by the various SonarQube Scanners). Its purpose is to give a 360° vision of the quality of your code base. For this, it analyzes all the source lines of your project on a regular basis.
So I preferred to use sonar lint in one of my project. As usual, I added this in my favorite IDE intelij. Once it get installed, you can see an option sonar Lint in the bottom as an option,
It keeps showing you code smells with explanation and a possible solution.
For example:
This helps you to reduce lots of small issues which we simply missed because of unawareness and our ignorance. We can run this for the whole project also, though it takes some time to get complete if its a large project.
Sonar lint is available for eclipse and visual studio as well.
Thursday, 16 September 2021
[Fix] -> Clicking on elements is failing in Jenkins
Recently, I encountered a weird issue where in my local machine, all my UI Automation scripts were working perfectly fine but when same ran on Jenkins machine, they started failing by giving exception: Element is not clickable at this point. I first thought, it might be happening because of different resolution of Jenkin machine (which still a possible reason) but unfortunately, I didn't have access to that Jenkin machine where it was failing.
To fix this, I tried to change the selenium click method to java script executor click method. And, it worked.
WebElement elem = driver.findElement(By.xpath("your xpath"));
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", elem);
So the second thing which I did was changing all click method to java script executor click. But then I identified, that few of the clicks are not working.
Those were the elements which were present as Button in the webpage. So I didn't change that click.
And It resolved.
Wednesday, 15 September 2021
[Workfront] -> Workfront API to retrieve task/request/project field and custom form values
This post is in continuation of my last worlfront post. So after creating request, the next operation is to validate that with whatever field values, we have created the request, same is reflecting there or not. The same validtaion, we need to perform after converting this request to project as well.
So to perform both these validations, we need to fetch the field values from API response. Below are the end points which can be sued for fetching the parameter values from a request/task:
Method: Get
Path: /attask/api/v9.0/optask
Params: action: generateApiKey
Param: apiKey: apikeyvalue
Param: ID: requestid
Param: fields:parameterValues
Similarly, if we need to fetch field values from project, then we need to replace ID with projectID, though end point will change.
Method: Get
Path: /attask/api/v9.0/project/search
Params: action: generateApiKey
Param: apiKey: apikeyvalue
Param: ID: projectID
Param: fields:parameterValues
Similarly, if you want to fetch the custom form names for a project, you can get it with below details:
Method: Get
Path: /attask/api/v9.0/PROJ/search
Params: action: generateApiKey
Param: apiKey: apikeyvalue
Param: ID: projectID
Param: fields:objectCategories:category:name
This will give all the custom form name for the project.
Sunday, 5 September 2021
[Zoom] How to create zoom calendar meetings via API
If you are using zoom APIs and at some time, you need to create meetings via API's, then the below endpoints can help:
1. First create a token. Here, I am using OAuth2.0. To create Oauth2.0, we can use client id and secret id.
2. Callback URL: https://oauth.pstmn.io/v1/callback
3. Authorize using a browser
4. Auth URL: https://zoom.us/oauth/authorize
5. Access Token URL: https://zoom.us/oauth/token
6. Client ID
7. Client Secret