Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev cloud #31

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
af565f7
Added testDataId to runMetaData and version bumped to 1.0.6
vikram-chaitanya Aug 21, 2022
629d9a7
Support for email interface and bumping versions to 1.0.7
vikram-chaitanya Aug 27, 2022
606d3e8
[TE-6243] [TE-6507] API and Automatic Data availability and Post Plan…
sugant-testsigma Dec 20, 2022
a7d1770
[3.4.0][TE-6243]Failed added
sugant-testsigma Dec 20, 2022
51f85d8
Update build.gradle
rahul-testsigma Dec 20, 2022
3c18eb9
[3.4.2][TE-6507]: Addon updates
rahul-testsigma Dec 27, 2022
3401464
[3.4.0custoemr][TE-7146] Added required params
sugant-testsigma Jan 4, 2023
727d165
[3.4.0.customer][TE-6243]Version bump
sugant-testsigma Jan 4, 2023
a7c638a
[3.4.0.customer][TE-6243]Version Final Bump
sugant-testsigma Jan 5, 2023
50e5145
CR-364 Added Option to Get Mailbox Messages inside Addon (#8)
kasyap-gundu Jan 16, 2023
4db4877
TE-7356 Added Attachments, url and otp Extracting Functions, Timestam…
kasyap-gundu Jan 31, 2023
d57b98e
[TE-8229] - OCR Text Extraction Capability
Ganesh-Testsigma Mar 27, 2023
15ba2a5
[TE-8229] - OCR Text Extraction Capability
Ganesh-Testsigma Mar 28, 2023
82e3c47
[TE-8229] - Change SDK version to 1.1.0_beta_1
Ganesh-Testsigma Mar 30, 2023
707d636
Merge pull request #10 from testsigmahq/feat/TE-8229-ocr-text-extract…
Ganesh-Testsigma Mar 30, 2023
fec44d3
fix(Addon runtime) : Added isRuntime variable property in annotation …
vigneshtestsigma Jun 28, 2023
2cc0710
[TE-8388]Image Search Capability for Addon
navyana-srivalli Jul 17, 2023
7e4197d
Siging flag is enabled
ManoharKrishnaBoppe Jul 18, 2023
4084b77
Upgraded gradle to latest: 8.2.1
ManoharKrishnaBoppe Jul 18, 2023
36cb18a
Fix: TE-11472 Sending Email from Addon is not working (#16)
kasyap-gundu Aug 8, 2023
3c8106c
feat: Selenium/Appium upgrade for Cloud Java SDK
Ganesh-Testsigma Nov 20, 2023
d4ac108
Merge pull request #17 from testsigmahq/feat/selenium-appium-upgrade-…
Ganesh-Testsigma Nov 21, 2023
212ac56
Update gradle.properties
vikram-chaitanya Nov 29, 2023
88f91a3
feat: Testsigma Java SDK changes for Selenium/Appium upgrade
Ganesh-Testsigma Dec 6, 2023
0d245b0
Merge pull request #18 from testsigmahq/feat/selenium-appium-upgrade-…
Ganesh-Testsigma Dec 6, 2023
1177313
Feat[TE-14116]: Added canTakeScreenshot in Action annotation (#19)
SivasaiPodugu Dec 19, 2023
27c3350
Feat[TE-15256]: Click on Web Page Element Using OCR Text Data
SunilGembali Jan 2, 2024
3d902a7
Feat[TE-15256]: Added two more methods for extracting sentences from …
SunilGembali Jan 3, 2024
c1a318e
Corrected the spelling mistake of sentences
SunilGembali Jan 5, 2024
6f02d7c
Merge pull request #20 from testsigmahq/feat/TE-15256
rajesh-testsigma Jan 5, 2024
53e2ffd
feat[TE-17324] Addon for sending reply mails (#21)
navyana-srivalli Mar 20, 2024
d89b439
TE-17810 Windows UFT Addon Support (#22)
kasyap-gundu Apr 16, 2024
19bb79e
fix: Added RUNNING Status in Result enum (#23)
SivasaiPodugu Apr 23, 2024
8e30d68
Feat[TE-18261]: added suiteResult and TestMachineResult annotations i…
SivasaiPodugu Apr 29, 2024
c054969
Feat[TE-18438]: Support API application type in Addon creation (#25)
SunilGembali May 17, 2024
dd4798b
[TE-17076]: updated EnvironmentData parameters with List of VariableD…
udayareddyvempalli Jul 12, 2024
1ca423c
fix[TFS-1095]: Added Support for Add-on in Salesforce Application.
girish-kadambari Aug 2, 2024
995e2cc
Merge pull request #29 from testsigmahq/feat/TFS-1095-support-sf-addons
girish-kadambari Aug 2, 2024
68d766b
chore: removed unwanted commit RELEASE_SIGNING_ENABLED=true
girish-kadambari Aug 2, 2024
f924eee
Merge pull request #30 from testsigmahq/6.3.1
girish-kadambari Aug 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.20.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.25.3'
}
}

plugins {
id 'java'
id 'maven-publish'
id 'signing'
id 'com.vanniktech.maven.publish' version '0.20.0'
id 'com.vanniktech.maven.publish' version '0.25.3'
}

repositories {
Expand All @@ -27,19 +27,21 @@ repositories {
}

group = 'com.testsigma'
version = '1.0.5'
version = '1.2.13_cloud'
description = 'Testsigma Java SDK'
java.sourceCompatibility = JavaVersion.VERSION_11

dependencies {
implementation 'org.projectlombok:lombok:1.18.20'
implementation 'org.seleniumhq.selenium:selenium-api:3.141.59'
implementation 'io.appium:java-client:7.0.0'
implementation 'org.seleniumhq.selenium:selenium-api:4.14.1'
implementation 'org.seleniumhq.selenium:selenium-java:4.14.1'
implementation 'io.appium:java-client:9.0.0'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.testng:testng:7.4.0'
implementation 'org.seleniumhq.selenium:selenium-java:3.141.59'
implementation 'org.json:json:20160810'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.0'
annotationProcessor 'org.projectlombok:lombok:1.18.20'
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
}

tasks.named('test') {
Expand Down
7 changes: 5 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ RELEASE_SIGNING_ENABLED=true

GROUP=com.testsigma
POM_ARTIFACT_ID=testsigma-java-sdk
VERSION_NAME=1.0.3
VERSION_NAME=1.2.13_cloud

POM_NAME=Testsigma Java SDK
POM_DESCRIPTION=Testsigma Java SDK
Expand All @@ -20,4 +20,7 @@ POM_SCM_DEV_CONNECTION=scm:git:ssh://github.com:TestsigmaHq/testsigma-java-sdk.g

POM_DEVELOPER_ID=Testsigma Technologies Inc
POM_DEVELOPER_NAME=Testsigma Technologies Inc
POM_DEVELOPER_URL=https://github.com/vikram-chaitanya/
POM_DEVELOPER_URL=https://github.com/vikram-chaitanya/

SONATYPE_CONNECT_TIMEOUT_SECONDS=600
SONATYPE_CLOSE_TIMEOUT_SECONDS=900
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion src/main/java/com/testsigma/sdk/ApplicationType.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.testsigma.sdk;

public enum ApplicationType {
WEB,MOBILE_WEB,IOS,ANDROID, WINDOWS, MAC
WEB, MOBILE_WEB, IOS, ANDROID, WINDOWS, WINDOWS_UFT, MAC, REST_API, Salesforce;
}
23 changes: 23 additions & 0 deletions src/main/java/com/testsigma/sdk/Email.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.testsigma.sdk;

import org.apache.http.entity.ContentType;

import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface Email {
void setTo(List<String> to);
void setCc(List<String> cc);
void setBcc(List<String> bcc);
void setSubject(String subject);
void setBody(String body);
void setAttachments(List<File> attachments);

void setContentType(ContentType contentType);
void setHeader(Map<String, String> headersList);

String getMessageId(String headers);
Boolean send();
}
11 changes: 8 additions & 3 deletions src/main/java/com/testsigma/sdk/EnvironmentData.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@

import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.json.JSONObject;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

@Data
@RequiredArgsConstructor
public class EnvironmentData {

private final JSONObject parameters;
private final List<VariableData> variables;

public String getParameter(String key){
return parameters.get(key).toString();
Optional<VariableData> variableData = variables.stream().filter(variable -> variable.getKey().equals(key))
.collect(Collectors.toList()).stream().findFirst();
return variableData.isPresent() ? variableData.get().getValue() : "";
}

}
18 changes: 18 additions & 0 deletions src/main/java/com/testsigma/sdk/FindImageResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.testsigma.sdk;

import lombok.Data;
import lombok.RequiredArgsConstructor;

import java.util.Map;

@RequiredArgsConstructor
@Data
public class FindImageResponse {
Boolean isFound;
int x1;
int y1;
int x2;
int y2;
Map<String,Object> additionalData;

}
24 changes: 24 additions & 0 deletions src/main/java/com/testsigma/sdk/Hook.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.testsigma.sdk;


import org.apache.commons.lang3.StringUtils;

public abstract class Hook {
private static final int MESSAGE_MAX_SIZE = 500;
protected com.testsigma.sdk.Logger logger = new Logger(new StringBuilder(""));
protected String errorMessage;
protected String successMessage;
private StringBuffer loggedMessages = new StringBuffer();
protected abstract Result execute();

protected void setErrorMessage(String errorMessage) {
this.errorMessage = StringUtils.abbreviate(errorMessage, MESSAGE_MAX_SIZE);
}

protected void setSuccessMessage(String successMessage) {
this.successMessage = StringUtils.abbreviate(successMessage, MESSAGE_MAX_SIZE);
}
protected void log(Object message){
loggedMessages.append(message.toString()).append("<br>");
}
}
5 changes: 5 additions & 0 deletions src/main/java/com/testsigma/sdk/HookType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.testsigma.sdk;

public enum HookType {
AFTER, BEFORE
}
16 changes: 16 additions & 0 deletions src/main/java/com/testsigma/sdk/IterationResult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.testsigma.sdk;


import lombok.Data;
import lombok.RequiredArgsConstructor;

import java.sql.Timestamp;

@RequiredArgsConstructor
@Data
public class IterationResult {
Result result;
Timestamp startTime;
Timestamp endTime;
Long testDataSetId;
}
17 changes: 17 additions & 0 deletions src/main/java/com/testsigma/sdk/Mailbox.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.testsigma.sdk;

import lombok.Data;
import lombok.RequiredArgsConstructor;

import java.util.List;

@RequiredArgsConstructor
@Data
public abstract class Mailbox {

private String email;


public abstract List<MailboxMessage> getMessages() throws Exception;

}
142 changes: 142 additions & 0 deletions src/main/java/com/testsigma/sdk/MailboxMessage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
package com.testsigma.sdk;

import lombok.Data;
import lombok.RequiredArgsConstructor;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@RequiredArgsConstructor
@Data
public class MailboxMessage {
private String subject;
private String sentTo;
private String textMessage;
private String htmlMessage;
private String receivedFrom;
private Map<String, String> attachmentUrls;
private Timestamp receivedAt;
private String headers;



public String getOTP(String regex) throws Exception {
String parsedOTP = null;
if (getHtmlMessage() != null) {
parsedOTP = parseOTP(regex, getTextMessage());
}
return parsedOTP;
}

public String urlWithText(String text)
throws Exception {
String url = getLinkWithTextFromHtml(text);
if(url != null) {
return url;
}
throw new Exception("No Url found");
}

public String urlWhichContains(String substring)
throws Exception {
List<String> allLinks = getLinksFromContent(null);
for(String url : allLinks){
if(url.contains(substring))
return url;
}
throw new Exception("No Url found");
}

private String parseOTP(String regex, String message) throws Exception {
if (regex == null) {
regex = "\\d{4,8}";
}
try {
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(message);
if (matcher.find()) {
return matcher.group(0);
} else {
throw new Exception("OTP parsing failed with given regex.");
}
} catch (Exception e) {
throw new Exception("OTP parsing failed - " + e.getMessage());
}
}




private String getLinkWithTextFromHtml(String text) throws Exception {
String parsedLink = null;
if (getHtmlMessage() != null) {
parsedLink = parseLinkWithTextFromHtml(getHtmlMessage(), text);
}
assert parsedLink != null;
return parsedLink;
}

private String parseLinkWithTextFromHtml(String htmlMessage, String text) throws Exception{

/*
aTagRegex consists of 3 groups
group 0 : will return the whole a tag(<a href="...">text</a>)
group 1 : will return the href attribute which contains url only
group 2 : will return the text associated with link
*/
String aTagRegex = "<a\\s+[^>]*href=\"([^\"]*)\"[^>]*>(?:<a[^>]*>)*"+text+"(?:</a>)*</a>";
String urlRegex = "(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";

try{
Matcher aTagMatcher = Pattern.compile(aTagRegex).matcher(htmlMessage);
if(aTagMatcher.find()) {
Matcher urlMatcher = Pattern.compile(urlRegex).matcher(aTagMatcher.group(1));
if(urlMatcher.find()){
return aTagMatcher.group(1).substring(urlMatcher.start(0),urlMatcher.end(0));
}
else{
throw new Exception("No Url exists for link with Text " + text);
}
}
} catch (Exception e){
throw new Exception("URL Parsing Failed - " + e.getMessage());
}
return null;
}


private List<String> getLinksFromContent(String regex)
throws Exception {
List<String> parsedLink = null;
if (this.getHtmlMessage() != null) {
parsedLink = extractLinks(regex, getHtmlMessage());
}
assert parsedLink != null;
return parsedLink;
}

private List<String> extractLinks(String regex, String message) throws Exception {
if (regex == null) {
regex = "\\b(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";
}
try {
Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(message);
List<String> parsedURLs = new ArrayList<String>();
while (matcher.find()) {
parsedURLs.add(message.substring(matcher.start(0), matcher.end(0)));
}
if (!(parsedURLs.size() > 0)) {
throw new Exception(" No URL found with matching condition in the email message.");
}
return parsedURLs;

} catch (Exception e) {
throw new Exception(" : URLs extraction failed - " + e.getMessage());
}
}
}
30 changes: 30 additions & 0 deletions src/main/java/com/testsigma/sdk/OCR.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.testsigma.sdk;

import java.io.File;
import java.util.List;
import java.util.Map;

public interface OCR {
public List<OCRTextPoint> extractTextFromPage();

public List<OCRTextPoint> extractTextFromImage(OCRImage image);

public List<OCRTextPoint> extractTextFromElement(Element element);

public FindImageResponse findImage(String imageURl, Float threshold);

public FindImageResponse findImage(String imageUrl);

public FindImageResponse findImage(String imageUrl, Float threshold, Integer scale);

public FindImageResponse findImage(String imageUrl, Integer occurrence);

public FindImageResponse findImage(String imageUrl, Integer occurrence, Float threshold);

public void uploadFile(String s3SignedURL, File baseImageFile);

public Map<String,List<OCRTextPoint>> extractTextAndSentencesFromImage(OCRImage image);

public Map<String,List<OCRTextPoint>> extractTextAndSentencesFromImage();

}
12 changes: 12 additions & 0 deletions src/main/java/com/testsigma/sdk/OCRImage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.testsigma.sdk;

import lombok.Data;
import lombok.RequiredArgsConstructor;

import java.io.File;

@RequiredArgsConstructor
@Data
public class OCRImage {
File ocrImageFile;
}
Loading
Loading