Skip to content

Commit

Permalink
MOSIP-30369 | Framework structure change to support device farm execu…
Browse files Browse the repository at this point in the history
…tion (#1039)

* Test script updated for new apk

Signed-off-by: kamalsingh <[email protected]>

* new test cases added

Signed-off-by: kamalsingh <[email protected]>

* new test cases added from master sheet

Signed-off-by: kamalsingh <[email protected]>

* Test cases added from regression sheet

Signed-off-by: kamalsingh <[email protected]>

* new test cases added

Signed-off-by: kamalsingh <[email protected]>

* automated ios tests for regression

Signed-off-by: kamalsingh <[email protected]>

* conflict resolved

Signed-off-by: kamalsingh <[email protected]>

* framework optimization

Signed-off-by: kamalsingh <[email protected]>

* folder structure changed

Signed-off-by: kamalsingh <[email protected]>

* framework restructure for device farm

Signed-off-by: kamalsingh <[email protected]>

* incorporated review comments

Signed-off-by: kamalsingh <[email protected]>

---------

Signed-off-by: kamalsingh <[email protected]>
  • Loading branch information
kamalsinghthoughtworks authored Nov 30, 2023
1 parent 6ce73a2 commit 7309938
Show file tree
Hide file tree
Showing 109 changed files with 3,569 additions and 995 deletions.
479 changes: 263 additions & 216 deletions injitest/pom.xml

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions injitest/src/main/assembly/zip.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>zip</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>./</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>./</outputDirectory>
<includes>
<include>/dependency-jars/</include>
</includes>
</fileSet>
</fileSets>
</assembly>
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package io.mosip.test.mob.inji.api;
package inji.api;

import io.restassured.response.Response;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;

import javax.ws.rs.core.MediaType;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.TimeZone;

import javax.ws.rs.core.MediaType;

import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;

import io.restassured.response.Response;
import org.apache.commons.lang.RandomStringUtils;

public class AdminTestUtil extends BaseTestCase {

private static final Logger logger = Logger.getLogger(AdminTestUtil.class);
Expand Down Expand Up @@ -68,9 +66,9 @@ public static boolean activateUIN(String inputJson, String role) {
}

public static String buildaddIdentityRequestBody(String schemaJson, String uin, String rid) {
org.json.JSONObject schemaresponseJson = new org.json.JSONObject(schemaJson);
JSONObject schemaresponseJson = new JSONObject(schemaJson);

org.json.JSONObject schemaData = (org.json.JSONObject) schemaresponseJson.get("response");
JSONObject schemaData = (JSONObject) schemaresponseJson.get("response");
Double schemaVersion = (Double) schemaData.get("idVersion");
String schemaJsonData = schemaData.getString("schemaJson");
String schemaFile = schemaJsonData.toString();
Expand Down Expand Up @@ -159,21 +157,21 @@ public static int getOtpExpTimeFromActuator() {
if (!BaseTestCase.isTargetEnvLTS())
section = "/mosip-config/sandbox/application-lts.properties";
Response response = null;
org.json.JSONObject responseJson = null;
JSONObject responseJson = null;
JSONArray responseArray = null;
String url = ApplnURI + propsKernel.getProperty("actuatorIDAEndpoint");
try {
response = RestClient.getRequest(url, MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON);

responseJson = new org.json.JSONObject(response.getBody().asString());
responseJson = new JSONObject(response.getBody().asString());
responseArray = responseJson.getJSONArray("propertySources");

for (int i = 0, size = responseArray.length(); i < size; i++) {
org.json.JSONObject eachJson = responseArray.getJSONObject(i);
JSONObject eachJson = responseArray.getJSONObject(i);
logger.info("eachJson is :" + eachJson.toString());
if (eachJson.get("name").toString().contains(section)) {

org.json.JSONObject otpExpiryTime = (org.json.JSONObject) eachJson
JSONObject otpExpiryTime = (JSONObject) eachJson
.getJSONObject(GlobalConstants.PROPERTIES).get("mosip.kernel.otp.expiry-time");
otpExpTime = otpExpiryTime.getString(GlobalConstants.VALUE);
if (ConfigManager.IsDebugEnabled())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.mosip.test.mob.inji.api;

import javax.ws.rs.core.MediaType;
package inji.api;

import io.restassured.response.Response;

import javax.ws.rs.core.MediaType;

public class ApplicationLibrary extends BaseTestCase {

private static CommonLibrary commonLibrary = new CommonLibrary();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package io.mosip.test.mob.inji.api;
package inji.api;

import inji.driver.TestRunner;
import inji.utils.TestDataReader;
import io.restassured.response.Response;
import org.apache.log4j.PropertyConfigurator;
import org.json.simple.JSONObject;

import javax.ws.rs.core.MediaType;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import io.restassured.response.Response;

import javax.ws.rs.core.MediaType;

import org.apache.log4j.PropertyConfigurator;
import org.json.simple.JSONObject;

import io.mosip.test.mob.inji.driver.TestRunner;
import io.mosip.test.mob.inji.utils.TestDataReader;

//import org.apache.log4j.Logger;

Expand Down Expand Up @@ -180,12 +178,13 @@ private static Properties getLoggerPropertyConfig() {
logProp.setProperty("log4j.appender.Appender2.layout.ConversionPattern", "%-7p %d [%t] %c %x - %m%n");
return logProp;
}


//ToDo - Need to address this
public static String getOtp() {
String otp="";
/*String otp="";
String externalemail = TestDataReader.readData("externalemail");
otp = MockSMTPListener.getOtp(externalemail);
return otp;
otp = MockSMTPListener.getOtp(externalemail);*/
return "111111";
}

public static JSONObject getRequestJson(String filepath) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
package io.mosip.test.mob.inji.api;
package inji.api;

import static io.restassured.RestAssured.given;
import inji.driver.TestRunner;
import io.restassured.http.Cookie;
import io.restassured.response.Response;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.*;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;

import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

import io.mosip.test.mob.inji.driver.TestRunner;
import io.restassured.http.Cookie;
import io.restassured.response.Response;
import static io.restassured.RestAssured.given;

public class CommonLibrary extends BaseTestCase {
private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(CommonLibrary.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package io.mosip.test.mob.inji.api;
package inji.api;


import inji.driver.TestRunner;
import inji.utils.TestDataReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

import io.mosip.test.mob.inji.driver.TestRunner;


public class ConfigManager {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.mosip.test.mob.inji.api;
package inji.api;

public class GlobalConstants {
public static final String EXCEPTION_STRING_2 = "Exception ";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.mosip.test.mob.inji.api;
import org.testng.Reporter;
package inji.api;

import io.restassured.response.Response;
import org.testng.Reporter;
public class GlobalMethods {

public static void reportResponse(String responseHeader, String url, Response response) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package io.mosip.test.mob.inji.api;
package inji.api;

import org.apache.commons.beanutils.PropertyUtils;

import org.apache.log4j.Logger;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.log4j.Logger;

public class JsonPrecondtion {
private static final Logger JSONPRECONDATION_LOGGER = Logger.getLogger(JsonPrecondtion.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package io.mosip.test.mob.inji.api;

import java.util.Map;
package inji.api;

import io.restassured.response.Response;
import org.json.simple.JSONObject;

import io.restassured.response.Response;
import java.util.Map;


public class KernelAuthentication extends BaseTestCase {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
package io.mosip.test.mob.inji.api;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

import javax.ws.rs.core.Response;
package inji.api;

import inji.driver.TestRunner;
import inji.utils.TestDataReader;
import org.keycloak.OAuth2Constants;
import org.keycloak.admin.client.CreatedResponseUtil;
import org.keycloak.admin.client.Keycloak;
Expand All @@ -20,7 +13,13 @@
import org.keycloak.representations.idm.RoleRepresentation;
import org.keycloak.representations.idm.UserRepresentation;

import io.mosip.test.mob.inji.driver.TestRunner;
import javax.ws.rs.core.Response;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;


public class KeycloakUserManager {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
package io.mosip.test.mob.inji.api;
package inji.api;

import com.fasterxml.jackson.databind.ObjectMapper;
import inji.api.pojo.Root;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;

import java.net.URI;
import java.net.http.HttpClient;
Expand All @@ -11,10 +16,6 @@
import java.util.concurrent.CompletionStage;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.mosip.test.mob.inji.api.pojo.Root;


public class MockSMTPListener{
Expand Down Expand Up @@ -45,7 +46,7 @@ public void run() {

}

private static class WebSocketClient implements WebSocket.Listener {
private static class WebSocketClient implements Listener {
Long count = (long) 00;
Root root = new Root();

Expand All @@ -57,7 +58,7 @@ public WebSocketClient() {
@Override
public void onOpen(WebSocket webSocket) {
logger.info("onOpen using subprotocol " + webSocket.getSubprotocol());
WebSocket.Listener.super.onOpen(webSocket);
Listener.super.onOpen(webSocket);
}

@Override
Expand Down Expand Up @@ -91,15 +92,15 @@ public CompletionStage<?> onText(WebSocket webSocket, CharSequence data, boolean
logger.error(e.getMessage());
}

return WebSocket.Listener.super.onText(webSocket, data, last);
return Listener.super.onText(webSocket, data, last);
}

@Override
public void onError(WebSocket webSocket, Throwable error) {

logger.info("Bad day! " + webSocket.toString());
logger.error(error.getMessage());
WebSocket.Listener.super.onError(webSocket, error);
Listener.super.onError(webSocket, error);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.mosip.test.mob.inji.api;
package inji.api;

public class OutputValidationDto {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.mosip.test.mob.inji.api;
package inji.api;

import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.mosip.test.mob.inji.api;

import org.testng.log4testng.Logger;
import static io.restassured.RestAssured.given;
package inji.api;

import io.restassured.RestAssured;
import io.restassured.config.HttpClientConfig;
import io.restassured.config.RestAssuredConfig;
import io.restassured.response.Response;
import org.testng.log4testng.Logger;

import static io.restassured.RestAssured.given;

public class RestClient {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.mosip.test.mob.inji.api.pojo;
package inji.api.pojo;

import java.util.ArrayList;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.mosip.test.mob.inji.api.pojo;
package inji.api.pojo;

import java.util.ArrayList;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.mosip.test.mob.inji.api.pojo;
package inji.api.pojo;

public class HeaderLine{
public String key;
Expand Down
4 changes: 4 additions & 0 deletions injitest/src/main/java/inji/api/pojo/Headers.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package inji.api.pojo;

public class Headers{
}
Loading

0 comments on commit 7309938

Please sign in to comment.