Magnifyb apis code
This commit is contained in:
parent
586c6b2476
commit
0d085c52ba
223
pom.xml
Normal file
223
pom.xml
Normal file
|
@ -0,0 +1,223 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>MagnifyB</groupId>
|
||||
<artifactId>MagnifyB</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>TestNG</name>
|
||||
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-java</artifactId>
|
||||
<version>4.12.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>7.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
|
||||
<dependency>
|
||||
<groupId>io.github.bonigarcia</groupId>
|
||||
<artifactId>webdrivermanager</artifactId>
|
||||
<version>5.5.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-scratchpad -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/openxml4j -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>openxml4j</artifactId>
|
||||
<version>1.0-beta</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/ooxml-schemas -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>ooxml-schemas</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<version>4.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-1.2-api -->
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-1.2-api</artifactId>
|
||||
<version>2.18.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
|
||||
<dependency>
|
||||
<groupId>io.rest-assured</groupId>
|
||||
<artifactId>rest-assured</artifactId>
|
||||
<version>5.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/io.rest-assured/json-schema-validator -->
|
||||
<dependency>
|
||||
<groupId>io.rest-assured</groupId>
|
||||
<artifactId>json-schema-validator</artifactId>
|
||||
<version>5.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.15.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JavaMail API -->
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Additional JavaMail IMAP Libraries -->
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>imap</artifactId>
|
||||
<version>1.6.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>smtp</artifactId>
|
||||
<version>1.6.7</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/net.javacrumbs.json-unit/json-unit -->
|
||||
<dependency>
|
||||
<groupId>net.javacrumbs.json-unit</groupId>
|
||||
<artifactId>json-unit</artifactId>
|
||||
<version>3.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.skyscreamer</groupId>
|
||||
<artifactId>jsonassert</artifactId>
|
||||
<version>1.5.0</version> <!-- Use the latest version available -->
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
|
||||
<dependency>
|
||||
<groupId>com.aventstack</groupId>
|
||||
<artifactId>extentreports</artifactId>
|
||||
<version>5.0.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-text -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.11.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version> <!-- You can adjust the version as
|
||||
needed -->
|
||||
|
||||
<configuration>
|
||||
<source>11</source> <!-- Specify your desired source version -->
|
||||
<target>11</target> <!-- Specify your desired target version -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<!-- <build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
<configuration>
|
||||
<suiteXmlFiles>
|
||||
<suiteXmlFile>testng.xml</suiteXmlFile>
|
||||
</suiteXmlFiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build> -->
|
||||
|
||||
</project>
|
|
@ -0,0 +1,78 @@
|
|||
package com.magnifyb.api.authenticationcontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class AuthenticationController {
|
||||
|
||||
RequestSpecification requestSpecification;
|
||||
Response response;
|
||||
ValidatableResponse validatableResponse;
|
||||
private static Properties properties;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void login() throws JSONException {
|
||||
|
||||
String username = properties.getProperty("username");
|
||||
String password = properties.getProperty("password");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("username", username);
|
||||
json.put("password", password);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/login";
|
||||
|
||||
// Create a request specification
|
||||
RequestSpecification requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
Response response = requestSpecification.post();
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
ValidatableResponse validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
|
||||
// Check response body - username attribute
|
||||
validatableResponse.body("data.username", Matchers.is(username));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,457 @@
|
|||
package com.magnifyb.api.cmscontrollerhome;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class CmsControllerHome {
|
||||
|
||||
private static Properties properties;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void about_us() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/about_us");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void access_code() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/access_code");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void balance_sheet() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/balance_sheet");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void business_area() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/business_area");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clearAllCaches() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/clearAllCaches");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void company_dashboard() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/company_dashboard");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void confirm_password() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/confirm_password");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void contactUs() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/contactUs");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customer_stories() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/customer_stories");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emailVerification() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/email-verification");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void finance_system_int() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/finance_system_int");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void footer_page() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/footer_page");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void forgot_password() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/forgot_password");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_chapters_count() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String moduleID = properties.getProperty("moduleId");
|
||||
Response response = RestAssured.get(baseUrl + "/get_chapters_count?moduleId=" + moduleID);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_subchapters_count() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String chapterID = properties.getProperty("chapterId");
|
||||
Response response = RestAssured.get(baseUrl + "/get_subchapters_count?chapterId=" + chapterID);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sectors() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/get-sectors");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void home_page() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/home-page");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void how_do_compare() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/how_do_compare");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void integrate_finance() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/integrate_finance");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void landingPage() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/landingPage");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void magnifyb_video() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/magnifyb_video");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void module_master() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/module_master");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void premium_signup_form() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/premium_signup_form");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void questions() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/questions");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void read_more() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/read_more");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void session_out() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/session_out");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void signIn() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/signIn");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void signup() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/signup");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void signup_info() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/signup_info");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void task_management() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/task_management");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void terms_conditions() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/terms_conditions");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void thankyou_signup() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/thankyou_signup");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void what_if_inputs() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/what_if_inputs");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package com.magnifyb.api.commoncontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class CommonController {
|
||||
|
||||
private static Properties properties;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_dates() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/get_dates");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_financial_year_months() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/get_financial_year_months");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_pastMonths() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String userID = properties.getProperty("userId");
|
||||
Response response = RestAssured.get(baseUrl + "/get_pastMonths/" + userID);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_pastSixMonths() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/get_pastSixMonths");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_presentMonths() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String userID = properties.getProperty("userId");
|
||||
Response response = RestAssured.get(baseUrl + "/get_presentMonths/" + userID);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sector_list() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/sector_list");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void today_date() {
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
Response response = RestAssured.get(baseUrl + "/today_date");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package com.magnifyb.api.companydashboardcontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class CompanyDashboardController {
|
||||
|
||||
private static Properties properties;
|
||||
Response response;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dashboard_months_balance() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/dashboard_months_balance/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dashboard_sales_annualized() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/dashboard_sales_annualized/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dashboard_todays_balance() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/dashboard_todays_balance/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void get_actualPBT() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_actualPBT/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_profitBeforeTax_Ytd() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_profitBeforeTax_Ytd_/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void turnover_dashboard() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/turnover_dashboard/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
package com.magnifyb.api.companyinfocontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class CompanyInfoController {
|
||||
private static Properties properties;
|
||||
Response response;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dashboard_months_balance() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String userID = properties.getProperty("userId");
|
||||
response = RestAssured.get(baseUrl + "/financial_year_flag/" + userID);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_all_companies() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
response = RestAssured.get(baseUrl + "/get_all_companies");
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_company_by_username() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
Response response = RestAssured.get(baseUrl + "/get_company_by_username/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_company_list_by_id() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String id = properties.getProperty("id");
|
||||
response = RestAssured.get(baseUrl + "/get_company_list_by_id/" + id);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_company() throws JSONException {
|
||||
|
||||
String addressLine = properties.getProperty("addressLine");
|
||||
String city = properties.getProperty("city");
|
||||
String companyName = properties.getProperty("companyName");
|
||||
String companyRegistrationNumber = properties.getProperty("companyRegistrationNumber");
|
||||
String companyType = properties.getProperty("companyType");
|
||||
String email = properties.getProperty("email2");
|
||||
String firstName = properties.getProperty("firstName");
|
||||
String isAdmin = properties.getProperty("isAdmin");
|
||||
String isPremium = properties.getProperty("isPremium");
|
||||
String lastName = properties.getProperty("lastName");
|
||||
String marketingPermission = properties.getProperty("marketingPermission");
|
||||
String password = properties.getProperty("password");
|
||||
String phone = properties.getProperty("phone");
|
||||
String postCode = properties.getProperty("postCode");
|
||||
String privacyNotice = properties.getProperty("privacyNotice");
|
||||
String sector = properties.getProperty("sector");
|
||||
String streetAddress = properties.getProperty("streetAddress");
|
||||
String subscriptionType = properties.getProperty("subscriptionType");
|
||||
String termsAndConditions = properties.getProperty("termsAndConditions");
|
||||
String webAddress = properties.getProperty("webAddress");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("addressLine", addressLine);
|
||||
json.put("city", city);
|
||||
json.put("companyName", companyName);
|
||||
json.put("companyRegistrationNumber", companyRegistrationNumber);
|
||||
json.put("companyType", companyType);
|
||||
json.put("email", email);
|
||||
json.put("firstName", firstName);
|
||||
json.put("isAdmin", isAdmin);
|
||||
json.put("isPremium", isPremium);
|
||||
json.put("lastName", lastName);
|
||||
json.put("marketingPermission", marketingPermission);
|
||||
json.put("password", password);
|
||||
json.put("phone", phone);
|
||||
json.put("postCode", postCode);
|
||||
json.put("privacyNotice", privacyNotice);
|
||||
json.put("sector", sector);
|
||||
json.put("streetAddress", streetAddress);
|
||||
json.put("subscriptionType", subscriptionType);
|
||||
json.put("termsAndConditions", termsAndConditions);
|
||||
json.put("webAddress", webAddress);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_company";
|
||||
|
||||
// Create a request specification
|
||||
RequestSpecification requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
Response response = requestSpecification.post();
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
ValidatableResponse validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_financial_end_month() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String userId = properties.getProperty("userId");
|
||||
String endMonth = properties.getProperty("endMonth");
|
||||
response = RestAssured.get(baseUrl + "/save_financial_end_month/" + userId + "/" + endMonth);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
package com.magnifyb.api.contactuscontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.hamcrest.Matchers;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class ContactUsController {
|
||||
|
||||
private static Properties properties;
|
||||
RequestSpecification requestSpecification;
|
||||
Response response;
|
||||
ValidatableResponse validatableResponse;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void contact_us() throws JSONException {
|
||||
|
||||
String answersText = properties.getProperty("answersText");
|
||||
String companyName = properties.getProperty("companyName");
|
||||
String date = properties.getProperty("date");
|
||||
String day = properties.getProperty("day");
|
||||
String hours = properties.getProperty("hours");
|
||||
String minutes = properties.getProperty("minutes");
|
||||
String nanos = properties.getProperty("nanos");
|
||||
String seconds = properties.getProperty("seconds");
|
||||
String time = properties.getProperty("time");
|
||||
String timezoneOffset = properties.getProperty("timezoneOffset");
|
||||
String year = properties.getProperty("year");
|
||||
String email = properties.getProperty("email");
|
||||
String id = properties.getProperty("id");
|
||||
String name = properties.getProperty("name");
|
||||
String questions = properties.getProperty("questions");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("answersText", answersText);
|
||||
json.put("companyName", companyName);
|
||||
json.put("date", date);
|
||||
json.put("day", day);
|
||||
json.put("hours", hours);
|
||||
json.put("minutes", minutes);
|
||||
json.put("nanos", nanos);
|
||||
json.put("seconds", seconds);
|
||||
json.put("time", time);
|
||||
json.put("timezoneOffset", timezoneOffset);
|
||||
json.put("year", year);
|
||||
json.put("email", email);
|
||||
json.put("id", id);
|
||||
json.put("name", name);
|
||||
json.put("questions", questions);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/contact_us";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
validatableResponse.body("responseMessage", Matchers.is("ContactUs saved Successfully"));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
package com.magnifyb.api.defaultslidercontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class DefaultSliderController {
|
||||
private static Properties properties;
|
||||
RequestSpecification requestSpecification;
|
||||
Response response;
|
||||
ValidatableResponse validatableResponse;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_slider_values() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_slider_values/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void saveSliderValues() throws JSONException {
|
||||
|
||||
String costOfSalesLastYear = properties.getProperty("costOfSalesLastYear");
|
||||
String costOfSalesYTD = properties.getProperty("costOfSalesYTD");
|
||||
String email = properties.getProperty("email");
|
||||
String ID = properties.getProperty("id");
|
||||
String noOfMonthsLastYear = properties.getProperty("noOfMonthsLastYear");
|
||||
String noOfMonthsThisYear = properties.getProperty("noOfMonthsThisYear");
|
||||
String overheadCostsLastYear = properties.getProperty("overheadCostsLastYear");
|
||||
String overheadCostsYTD = properties.getProperty("overheadCostsYTD");
|
||||
String payrollCostLastYear = properties.getProperty("payrollCostLastYear");
|
||||
String payrollYTD = properties.getProperty("payrollYTD");
|
||||
String salesLastYear = properties.getProperty("salesLastYear");
|
||||
String salesYTD = properties.getProperty("salesYTD");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("costOfSalesLastYear", costOfSalesLastYear);
|
||||
json.put("costOfSalesYTD", costOfSalesYTD);
|
||||
json.put("email", email);
|
||||
json.put("id", ID);
|
||||
json.put("noOfMonthsLastYear", noOfMonthsLastYear);
|
||||
json.put("noOfMonthsThisYear", noOfMonthsThisYear);
|
||||
json.put("overheadCostsLastYear", overheadCostsLastYear);
|
||||
json.put("overheadCostsYTD", overheadCostsYTD);
|
||||
json.put("payrollCostLastYear", payrollCostLastYear);
|
||||
json.put("payrollYTD", payrollYTD);
|
||||
json.put("salesLastYear", salesLastYear);
|
||||
json.put("salesYTD", salesYTD);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_slider_values";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateUser() throws JSONException {
|
||||
|
||||
String costOfSalesLastYear = properties.getProperty("costOfSalesLastYear");
|
||||
String costOfSalesYTD = properties.getProperty("costOfSalesYTD");
|
||||
String email = properties.getProperty("email");
|
||||
String ID = properties.getProperty("id");
|
||||
String noOfMonthsLastYear = properties.getProperty("noOfMonthsLastYear");
|
||||
String noOfMonthsThisYear = properties.getProperty("noOfMonthsThisYear");
|
||||
String overheadCostsLastYear = properties.getProperty("overheadCostsLastYear");
|
||||
String overheadCostsYTD = properties.getProperty("overheadCostsYTD");
|
||||
String payrollCostLastYear = properties.getProperty("payrollCostLastYear");
|
||||
String payrollYTD = properties.getProperty("payrollYTD");
|
||||
String salesLastYear = properties.getProperty("salesLastYear");
|
||||
String salesYTD = properties.getProperty("salesYTD");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("costOfSalesLastYear", costOfSalesLastYear);
|
||||
json.put("costOfSalesYTD", costOfSalesYTD);
|
||||
json.put("email", email);
|
||||
json.put("id", ID);
|
||||
json.put("noOfMonthsLastYear", noOfMonthsLastYear);
|
||||
json.put("noOfMonthsThisYear", noOfMonthsThisYear);
|
||||
json.put("overheadCostsLastYear", overheadCostsLastYear);
|
||||
json.put("overheadCostsYTD", overheadCostsYTD);
|
||||
json.put("payrollCostLastYear", payrollCostLastYear);
|
||||
json.put("payrollYTD", payrollYTD);
|
||||
json.put("salesLastYear", salesLastYear);
|
||||
json.put("salesYTD", salesYTD);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/update_slider_values";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify format in which request payload will be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as string
|
||||
requestSpecification.body(jsonString);
|
||||
|
||||
// Calling PUT method
|
||||
response = requestSpecification.put();
|
||||
|
||||
/*
|
||||
* To perform validation on response, we need to get ValidatableResponse type of
|
||||
* response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Get status code
|
||||
validatableResponse.statusCode(200);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
package com.magnifyb.api.detailedplcontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class DetailedPLController {
|
||||
private static Properties properties;
|
||||
RequestSpecification requestSpecification;
|
||||
Response response;
|
||||
ValidatableResponse validatableResponse;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void detail_profit_loss_changes() throws JSONException {
|
||||
|
||||
String changePercentage = properties.getProperty("changePercentage");
|
||||
String cumulativePlMonths = properties.getProperty("cumulativePlMonths");
|
||||
String cumulativePlValue = properties.getProperty("cumulativePlValue");
|
||||
String productName = properties.getProperty("productName");
|
||||
String typeKeyword = properties.getProperty("typeKeyword");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("changePercentage", changePercentage);
|
||||
json.put("cumulativePlMonths", cumulativePlMonths);
|
||||
json.put("cumulativePlValue", cumulativePlValue);
|
||||
json.put("productName", productName);
|
||||
json.put("typeKeyword", typeKeyword);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/detail_profit_loss_changes";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_detail_profit_loss_values() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_detail_profit_loss_values/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void save_detail_profit_loss() throws JSONException {
|
||||
|
||||
String annualizedPlMonths = properties.getProperty("annualizedPlMonths");
|
||||
String cumulativePlMonths = properties.getProperty("cumulativePlMonths");
|
||||
String cumulativePlValue = properties.getProperty("cumulativePlValue");
|
||||
String information_from = properties.getProperty("information_from");
|
||||
String productName = properties.getProperty("productName");
|
||||
String type = properties.getProperty("typeKeyword");
|
||||
String userId = properties.getProperty("userId");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("annualizedPlMonths", annualizedPlMonths);
|
||||
json.put("cumulativePlMonths", cumulativePlMonths);
|
||||
json.put("cumulativePlValue", cumulativePlValue);
|
||||
json.put("information_from", information_from);
|
||||
json.put("productName", productName);
|
||||
json.put("type", type);
|
||||
json.put("userId", userId);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_detail_profit_loss";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
// System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.magnifyb.api.dummycontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class DummyController {
|
||||
private static Properties properties;
|
||||
RequestSpecification requestSpecification;
|
||||
Response response;
|
||||
ValidatableResponse validatableResponse;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void get_dummy_sliders() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String currentValue = properties.getProperty("currentValue");
|
||||
String thisYearValue = properties.getProperty("thisYearValue");
|
||||
response = RestAssured.get(baseUrl + "/get_dummy_sliders/" + currentValue+"/"+thisYearValue);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,402 @@
|
|||
package com.magnifyb.api.financialdatatemplatecontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class FinancialDataTemplateController {
|
||||
private static Properties properties;
|
||||
RequestSpecification requestSpecification;
|
||||
Response response;
|
||||
ValidatableResponse validatableResponse;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void balance_sheets_graph() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/balance_sheets_graph/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void balancesheet_average() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/balancesheet_average/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void balancesheet_daywise() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/balancesheet_daywise/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void balancesheet_monthwise() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/balancesheet_monthwise/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void balancesheet_view_data() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/balancesheet_view_data/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void capital_reserves() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/capital_reserves/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cash_balance_month_data() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/cash_balance_month_data/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cashflow_last_five_days_data() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/cashflow_last_five_days_data/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cashflow_month_data() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/cashflow_month_data/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cashflow_month_view_data() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/cashflow_month_view_data/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cashflow_view_data() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/cashflow_view_data/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void current_assests_and_liabilities() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/current_assests_and_liabilities/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DetailedPL() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String email = properties.getProperty("email");
|
||||
response = RestAssured.get(baseUrl + "/DetailedPL/" + email);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_financial_data() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_financial_data/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gross_margin_by_month() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/gross_margin_by_month/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void grossmargin_average() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/grossmargin_average/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void my_money_graph() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/my_money_graph/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PLLastYearMonthWise() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/PLLastYearMonthWise/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void PLThisYearMonthWise() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/PLThisYearMonthWise/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void profit_and_loss_average() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/profit_and_loss_average/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void profit_and_loss_graph() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/profit_and_loss_graph/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rolling_tweleve_months() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/rolling_tweleve_months/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sales_and_revenue_graph() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/sales_and_revenue_graph/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sales_average() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/sales_average/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_financial_data() throws JSONException {
|
||||
|
||||
// balanceSheetDayWiseData
|
||||
String cashIn = properties.getProperty("cashIn");
|
||||
String cashOut = properties.getProperty("cashOut");
|
||||
String creditors = properties.getProperty("creditors");
|
||||
String debtors = properties.getProperty("debtors");
|
||||
String id = properties.getProperty("id");
|
||||
String informationFrom = properties.getProperty("informationFrom");
|
||||
String stock = properties.getProperty("stock");
|
||||
String storedDate = properties.getProperty("storedDate");
|
||||
String todaysBalance = properties.getProperty("todaysBalance");
|
||||
String username = properties.getProperty("username");
|
||||
|
||||
// balanceSheetLastYearMinusOneMonthWiseEntity
|
||||
String creditorsBalanceSheet = properties.getProperty("creditorsBalanceSheet");
|
||||
String currentAssets = properties.getProperty("currentAssets");
|
||||
String currentLiabilities = properties.getProperty("currentLiabilities");
|
||||
String employees = properties.getProperty("employees");
|
||||
String fixedAssets = properties.getProperty("fixedAssets");
|
||||
String monthAndYear = properties.getProperty("monthAndYear");
|
||||
String monthEndBalance = properties.getProperty("monthEndBalance");
|
||||
|
||||
// profitAndLossLastYear
|
||||
String costOfSalesLastYear = properties.getProperty("costOfSalesLastYear");
|
||||
String monthAndYearLastYear = properties.getProperty("monthAndYearLastYear");
|
||||
String payrollLastYear = properties.getProperty("payrollLastYear");
|
||||
String salesAndRevenueLastYear = properties.getProperty("salesAndRevenueLastYear");
|
||||
|
||||
// profitAndLossLastYearMinusOneMonthWiseData
|
||||
String overheads = properties.getProperty("overheads");
|
||||
String payroll = properties.getProperty("payroll");
|
||||
String salesAndRevenue = properties.getProperty("salesAndRevenue");
|
||||
|
||||
// profitAndLossThisYear
|
||||
String costOfSales = properties.getProperty("costOfSales");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
// balanceSheetDayWiseData
|
||||
json.put("cashIn", cashIn);
|
||||
json.put("cashOut", cashOut);
|
||||
json.put("creditors", creditors);
|
||||
json.put("debtors", debtors);
|
||||
json.put("id", id);
|
||||
json.put("informationFrom", informationFrom);
|
||||
json.put("stock", stock);
|
||||
json.put("storedDate", storedDate);
|
||||
json.put("todaysBalance", todaysBalance);
|
||||
json.put("username", username);
|
||||
|
||||
// balanceSheetLastYearMinusOneMonthWiseEntity
|
||||
json.put("creditorsBalanceSheet", creditorsBalanceSheet);
|
||||
json.put("currentAssets", currentAssets);
|
||||
json.put("currentLiabilities", currentLiabilities);
|
||||
json.put("employees", employees);
|
||||
json.put("fixedAssets", fixedAssets);
|
||||
json.put("monthAndYear", monthAndYear);
|
||||
json.put("monthEndBalance", monthEndBalance);
|
||||
|
||||
// profitAndLossLastYear
|
||||
json.put("costOfSalesLastYear", costOfSalesLastYear);
|
||||
json.put("monthAndYearLastYear", monthAndYearLastYear);
|
||||
json.put("payrollLastYear", payrollLastYear);
|
||||
json.put("salesAndRevenueLastYear", salesAndRevenueLastYear);
|
||||
|
||||
// profitAndLossLastYearMinusOneMonthWiseData
|
||||
json.put("overheads", overheads);
|
||||
json.put("payroll", payroll);
|
||||
json.put("salesAndRevenue", salesAndRevenue);
|
||||
|
||||
// profitAndLossThisYear
|
||||
json.put("costOfSales", costOfSales);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_financial_data";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stock_debtors_creditors_by_day() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/stock_debtors_creditors_by_day/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stock_debtors_creditors_by_month() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/stock_debtors_creditors_by_month/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stock_debtors_creditors_view_data() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/stock_debtors_creditors_view_data/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void today_balance() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/today_balance/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void todays_balance_view_data() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/todays_balance_view_data/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,540 @@
|
|||
package com.magnifyb.api.questionariescontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class QuestionariesController {
|
||||
private static Properties properties;
|
||||
RequestSpecification requestSpecification;
|
||||
Response response;
|
||||
ValidatableResponse validatableResponse;
|
||||
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_chapter_questions_details() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_chapter_questions_details/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
@Test
|
||||
public void get_chapter_wise_score() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_chapter_wise_score/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_generic_questions() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_generic_questions/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_goal_details() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_goal_details/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_goals_by_goal_id() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String id = properties.getProperty("id");
|
||||
response = RestAssured.get(baseUrl + "/get_goals_by_goal_id/" + id);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_goals_by_priority() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String id = properties.getProperty("id");
|
||||
response = RestAssured.get(baseUrl + "/get_goals_by_priority/" + id);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_goals_by_userid() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("id");
|
||||
response = RestAssured.get(baseUrl + "/get_goals_by_userid/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void get_goals_byid() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String id = properties.getProperty("id");
|
||||
String status = properties.getProperty("status");
|
||||
response = RestAssured.get(baseUrl + "/get_goals_by_userid/" + id+"/"+status);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_notifications() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_notifications/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_paid_questions() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_paid_questions/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
@Test(enabled = false)
|
||||
public void get_priority_by_id() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String id = properties.getProperty("id");
|
||||
String priority = properties.getProperty("priority");
|
||||
response = RestAssured.get(baseUrl + "/get_priority_by_id/" + id+"/"+priority);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_probility() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_probility/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_scoring() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_scoring/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void percentage_completion_new() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/percentage_completion_new/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void percentage_completion() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/percentage_completion/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void quiz_check() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
String chapterCode = properties.getProperty("chapterCode");
|
||||
response = RestAssured.get(baseUrl + "/quiz_check/" + username+"/"+chapterCode);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void recomended_readings() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/recomended_readings/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_chapter_questions() throws JSONException {
|
||||
|
||||
String moduleCode = properties.getProperty("chapterModuleCode");
|
||||
String answerCode = properties.getProperty("chapterAnswerCode");
|
||||
String chapterCode = properties.getProperty("chaptercode");
|
||||
String chapterName = properties.getProperty("chapterName");
|
||||
String questionCode = properties.getProperty("chapterQuestionCode");
|
||||
String score = properties.getProperty("chapterScore");
|
||||
String subChapterCount = properties.getProperty("subChapterCount");
|
||||
String weightage = properties.getProperty("weightage");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("moduleCode", moduleCode);
|
||||
json.put("answerCode", answerCode);
|
||||
json.put("chapterCode", chapterCode);
|
||||
json.put("chapterName", chapterName);
|
||||
json.put("questionCode", questionCode);
|
||||
json.put("score", score);
|
||||
json.put("subChapterCount", subChapterCount);
|
||||
json.put("weightage", weightage);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_chapter_questions";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_generic_questionaries() throws JSONException {
|
||||
|
||||
String moduleId = properties.getProperty("GenericmoduleId");
|
||||
String answer = properties.getProperty("GenericAnswer");
|
||||
String answerCode = properties.getProperty("GenericAnswerCode");
|
||||
String questionCode = properties.getProperty("GenericQuestionCode");
|
||||
String serialNumber = properties.getProperty("serialNumber");
|
||||
String questionId = properties.getProperty("questionId");
|
||||
String username = properties.getProperty("username");
|
||||
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("moduleId", moduleId);
|
||||
json.put("answer", answer);
|
||||
json.put("answerCode", answerCode);
|
||||
json.put("questionCode", questionCode);
|
||||
json.put("serialNumber", serialNumber);
|
||||
json.put("questionId", questionId);
|
||||
json.put("username", username);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_generic_questionaries";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_goals() throws JSONException {
|
||||
|
||||
String answer = properties.getProperty("GoalAnswer");
|
||||
String cost = properties.getProperty("GoalCost");
|
||||
String date = properties.getProperty("GoalDate");
|
||||
String goal = properties.getProperty("goal");
|
||||
String goalStatus = properties.getProperty("goalStatus");
|
||||
String id = properties.getProperty("GoalID");
|
||||
String isPriority = properties.getProperty("isPriority");
|
||||
String overallCost = properties.getProperty("overallCost");
|
||||
String username = properties.getProperty("username");
|
||||
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("answer", answer);
|
||||
json.put("cost", cost);
|
||||
json.put("date", date);
|
||||
json.put("goal", goal);
|
||||
json.put("goalStatus", goalStatus);
|
||||
json.put("id", id);
|
||||
json.put("isPriority", isPriority);
|
||||
json.put("overallCost", overallCost);
|
||||
json.put("username", username);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_goals";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_paid_questionaries() throws JSONException {
|
||||
|
||||
String answerId = properties.getProperty("PaidAnswerId");
|
||||
String moduleId = properties.getProperty("PaidModuleId");
|
||||
String moduleName = properties.getProperty("PaidModuleName");
|
||||
String questionId = properties.getProperty("PaidQuestionId");
|
||||
String scoring = properties.getProperty("PaidScoring");
|
||||
String username = properties.getProperty("username");
|
||||
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("answerId", answerId);
|
||||
json.put("moduleId", moduleId);
|
||||
json.put("moduleName", moduleName);
|
||||
json.put("questionId", questionId);
|
||||
json.put("scoring", scoring);
|
||||
json.put("username", username);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_paid_questionaries";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_quiz_questions() throws JSONException {
|
||||
|
||||
String chapterCode = properties.getProperty("QuizChapterCode");
|
||||
String chapterName = properties.getProperty("QuizChapterName");
|
||||
String answerCode = properties.getProperty("QuizAnswerCode");
|
||||
String questionCode = properties.getProperty("QuizQuestionCode");
|
||||
String serialNumber = properties.getProperty("QuizSerialNumber");
|
||||
String subChapterCode = properties.getProperty("QuizSubChapterCode");
|
||||
String subChapterName = properties.getProperty("QuizSubChapterName");
|
||||
String value = properties.getProperty("QuizValue");
|
||||
String username = properties.getProperty("username");
|
||||
String weightage = properties.getProperty("weightage");
|
||||
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("chapterCode", chapterCode);
|
||||
json.put("chapterName", chapterName);
|
||||
json.put("answerCode", answerCode);
|
||||
json.put("questionCode", questionCode);
|
||||
json.put("serialNumber", serialNumber);
|
||||
json.put("subChapterCode", subChapterCode);
|
||||
json.put("subChapterName", subChapterName);
|
||||
json.put("value", value);
|
||||
json.put("username", username);
|
||||
json.put("weightage", weightage);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_quiz_questions";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void taskscount() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/taskscount/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tm_completedList() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/tm_completedList/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,564 @@
|
|||
package com.magnifyb.api.signupcontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class SignUpController {
|
||||
private static Properties properties;
|
||||
RequestSpecification requestSpecification;
|
||||
Response response;
|
||||
ValidatableResponse validatableResponse;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_chapter_questions_details() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/dashboard_myfinance_flag/" + username + "?dashboardLogin=" + username
|
||||
+ "&" + "myFinanceLogin=" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void login() throws JSONException {
|
||||
|
||||
String email = properties.getProperty("email");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("email", email);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/forgot_password/" + email;
|
||||
|
||||
// Create a request specification
|
||||
RequestSpecification requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
Response response = requestSpecification.post();
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
ValidatableResponse validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generate_access_code() throws JSONException {
|
||||
|
||||
String businessName = properties.getProperty("businessName");
|
||||
String email = properties.getProperty("email");
|
||||
String firstName = properties.getProperty("firstName");
|
||||
String lastName = properties.getProperty("lastName");
|
||||
String marketingPermission = properties.getProperty("marketingPermission");
|
||||
String mobileNumber = properties.getProperty("mobileNumber");
|
||||
String privacyNotice = properties.getProperty("privacyNotice");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("businessName", businessName);
|
||||
json.put("email", email);
|
||||
json.put("firstName", firstName);
|
||||
json.put("lastName", lastName);
|
||||
json.put("marketingPermission", marketingPermission);
|
||||
json.put("mobileNumber", mobileNumber);
|
||||
json.put("privacyNotice", privacyNotice);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/generate_access_code";
|
||||
|
||||
// Create a request specification
|
||||
RequestSpecification requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
Response response = requestSpecification.post();
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
ValidatableResponse validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_dashboard_myfinance_flag() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_dashboard_myfinance_flag/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_signup_progress_details() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_signup_progress_details/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void issues_enquiry_for_signup() throws JSONException {
|
||||
|
||||
String businessName = properties.getProperty("businessName");
|
||||
String email = properties.getProperty("email");
|
||||
String id = properties.getProperty("id");
|
||||
String issueOrEnquiryType = properties.getProperty("issueOrEnquiryType");
|
||||
String firstName = properties.getProperty("firstName");
|
||||
String lastName = properties.getProperty("lastName");
|
||||
String marketingPermission = properties.getProperty("marketingPermission");
|
||||
String mobileNumber = properties.getProperty("mobileNumber");
|
||||
String privacyNotice = properties.getProperty("privacyNotice");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("businessName", businessName);
|
||||
json.put("email", email);
|
||||
json.put("firstName", firstName);
|
||||
json.put("id", id);
|
||||
json.put("issueOrEnquiryType", issueOrEnquiryType);
|
||||
json.put("lastName", lastName);
|
||||
json.put("marketingPermission", marketingPermission);
|
||||
json.put("mobileNumber", mobileNumber);
|
||||
json.put("privacyNotice", privacyNotice);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/issues_enquiry_for_signup";
|
||||
|
||||
// Create a request specification
|
||||
RequestSpecification requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
Response response = requestSpecification.post();
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
ValidatableResponse validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void new_signin() throws JSONException {
|
||||
|
||||
String password = properties.getProperty("password");
|
||||
String username = properties.getProperty("username");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("password", password);
|
||||
json.put("username", username);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/new_signin";
|
||||
|
||||
// Create a request specification
|
||||
RequestSpecification requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
Response response = requestSpecification.post();
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
ValidatableResponse validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void passcode_authentication() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String email = properties.getProperty("email");
|
||||
String passcode = properties.getProperty("passcode");
|
||||
response = RestAssured.get(baseUrl + "/passcode_authentications/" + email +"/"+ passcode);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void reset_password() throws JSONException {
|
||||
String newPassword = properties.getProperty("newPassword");
|
||||
String password = properties.getProperty("password");
|
||||
String userName = properties.getProperty("email");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("newPassword", newPassword);
|
||||
json.put("password", password);
|
||||
json.put("userName", userName);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/reset_password";
|
||||
|
||||
String responseBody = response.getBody().asPrettyString();
|
||||
System.out.println("Response Body: " + responseBody);
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_forgot_password() throws JSONException {
|
||||
String email = properties.getProperty("email");
|
||||
String passcode = properties.getProperty("passcode");
|
||||
String password = properties.getProperty("password");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("email", email);
|
||||
json.put("passcode", passcode);
|
||||
json.put("password", password);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_forgot_password";
|
||||
|
||||
// Create a request specification
|
||||
RequestSpecification requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
Response response = requestSpecification.post();
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
ValidatableResponse validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_signup_progress() throws JSONException {
|
||||
|
||||
String dashboardFlag = properties.getProperty("dashboardFlag");
|
||||
String detailedQuestionFlag = properties.getProperty("detailedQuestionFlag");
|
||||
String earlyLaunchScreenFlag = properties.getProperty("earlyLaunchScreenFlag");
|
||||
String emailVerificationScreenFlag = properties.getProperty("emailVerificationScreenFlag");
|
||||
String financeQuestionsFlag = properties.getProperty("financeQuestionsFlag");
|
||||
String financeSummapasscoderyFlag = properties.getProperty("financeSummapasscoderyFlag");
|
||||
String financeSystemScreenFlag = properties.getProperty("financeSystemScreenFlag");
|
||||
String genericScreenFlag = properties.getProperty("genericScreenFlag");
|
||||
String id = properties.getProperty("id");
|
||||
String mangnifybBenifitsFlag = properties.getProperty("mangnifybBenifitsFlag");
|
||||
String progressScreenFlag = properties.getProperty("progressScreenFlag");
|
||||
String thankYouScreenFlag = properties.getProperty("thankYouScreenFlag");
|
||||
String username = properties.getProperty("username");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("dashboardFlag", dashboardFlag);
|
||||
json.put("detailedQuestionFlag", detailedQuestionFlag);
|
||||
json.put("earlyLaunchScreenFlag", earlyLaunchScreenFlag);
|
||||
json.put("emailVerificationScreenFlag", emailVerificationScreenFlag);
|
||||
json.put("financeQuestionsFlag", financeQuestionsFlag);
|
||||
json.put("financeSummapasscoderyFlag", financeSummapasscoderyFlag);
|
||||
json.put("financeSystemScreenFlag", financeSystemScreenFlag);
|
||||
json.put("genericScreenFlag", genericScreenFlag);
|
||||
json.put("id", id);
|
||||
json.put("mangnifybBenifitsFlag", mangnifybBenifitsFlag);
|
||||
json.put("progressScreenFlag", progressScreenFlag);
|
||||
json.put("thankYouScreenFlag", thankYouScreenFlag);
|
||||
json.put("username", username);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_signup_progress";
|
||||
|
||||
// Create a request specification
|
||||
RequestSpecification requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
Response response = requestSpecification.post();
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
ValidatableResponse validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void signup() throws JSONException {
|
||||
|
||||
String addressLine = properties.getProperty("addressLine");
|
||||
String city = properties.getProperty("city");
|
||||
String companyName = properties.getProperty("companyName");
|
||||
String companyRegistrationNumber = properties.getProperty("companyRegistrationNumber");
|
||||
String companyType = properties.getProperty("companyType");
|
||||
String email = properties.getProperty("email2");
|
||||
String firstName = properties.getProperty("firstName");
|
||||
String isAdmin = properties.getProperty("isAdmin");
|
||||
String isPremium = properties.getProperty("isPremium");
|
||||
String lastName = properties.getProperty("lastName");
|
||||
String marketingPermission = properties.getProperty("marketingPermission");
|
||||
String password = properties.getProperty("password");
|
||||
String phone = properties.getProperty("phone");
|
||||
String postCode = properties.getProperty("postCode");
|
||||
String privacyNotice = properties.getProperty("privacyNotice");
|
||||
String sector = properties.getProperty("sector");
|
||||
String streetAddress = properties.getProperty("streetAddress");
|
||||
String subscriptionType = properties.getProperty("subscriptionType");
|
||||
String termsAndConditions = properties.getProperty("termsAndConditions");
|
||||
String webAddress = properties.getProperty("webAddress");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("addressLine", addressLine);
|
||||
json.put("city", city);
|
||||
json.put("companyName", companyName);
|
||||
json.put("companyRegistrationNumber", companyRegistrationNumber);
|
||||
json.put("companyType", companyType);
|
||||
json.put("email", email);
|
||||
json.put("firstName", firstName);
|
||||
json.put("isAdmin", isAdmin);
|
||||
json.put("isPremium", isPremium);
|
||||
json.put("lastName", lastName);
|
||||
json.put("marketingPermission", marketingPermission);
|
||||
json.put("password", password);
|
||||
json.put("phone", phone);
|
||||
json.put("postCode", postCode);
|
||||
json.put("privacyNotice", privacyNotice);
|
||||
json.put("sector", sector);
|
||||
json.put("streetAddress", streetAddress);
|
||||
json.put("subscriptionType", subscriptionType);
|
||||
json.put("termsAndConditions", termsAndConditions);
|
||||
json.put("webAddress", webAddress);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/signup";
|
||||
|
||||
// Create a request specification
|
||||
RequestSpecification requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
Response response = requestSpecification.post();
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
ValidatableResponse validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void specific_count() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/specific_count/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void user_check() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String email = properties.getProperty("email");
|
||||
response = RestAssured.get(baseUrl + "/user_check/" + email);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validate_access_code() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String accessCode = properties.getProperty("accessCode");
|
||||
response = RestAssured.get(baseUrl + "/validate_access_code/" + accessCode);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verify_email() throws JSONException {
|
||||
|
||||
String email = properties.getProperty("useremail");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("email", email);
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
|
||||
// Ensure proper URL encoding of the email
|
||||
String encodedEmail = URLEncoder.encode(email, StandardCharsets.UTF_8);
|
||||
|
||||
// Update the base URI
|
||||
RestAssured.baseURI = baseUrl + "/verify_email/" + encodedEmail;
|
||||
|
||||
// RestAssured.baseURI = baseUrl + "/verify_email/" + email;
|
||||
|
||||
// Create a request specification
|
||||
RequestSpecification requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
Response response = requestSpecification.post();
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
ValidatableResponse validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,225 @@
|
|||
package com.magnifyb.api.slidercalculatorcontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class SliderCalculatorController {
|
||||
|
||||
private static Properties properties;
|
||||
RequestSpecification requestSpecification;
|
||||
Response response;
|
||||
ValidatableResponse validatableResponse;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_balance_sheet_new() throws JSONException {
|
||||
|
||||
String costOfSales = properties.getProperty("BLcostOfSales");
|
||||
String currentBalanceSheetFigureInStock = properties.getProperty("currentBalanceSheetFigureInStock");
|
||||
String currentBalanceSheetFigureInTradeCreditors = properties.getProperty("currentBalanceSheetFigureInTradeCreditors");
|
||||
String currentBalanceSheetFigureInTradeDebtors = properties.getProperty("currentBalanceSheetFigureInTradeDebtors");
|
||||
String increaseSTockTurnByPercentage = properties.getProperty("increaseSTockTurnByPercentage");
|
||||
String negotiate60DayTerms = properties.getProperty("negotiate60DayTerms");
|
||||
String noOfMonthsThisYear = properties.getProperty("noOfMonthsThisYear");
|
||||
String sales = properties.getProperty("sales");
|
||||
String targetDebtorDays = properties.getProperty("targetDebtorDays");
|
||||
String username = properties.getProperty("username");
|
||||
String vatRatio = properties.getProperty("vatRatio");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("costOfSales", costOfSales);
|
||||
json.put("currentBalanceSheetFigureInStock", currentBalanceSheetFigureInStock);
|
||||
json.put("currentBalanceSheetFigureInTradeCreditors", currentBalanceSheetFigureInTradeCreditors);
|
||||
json.put("currentBalanceSheetFigureInTradeDebtors", currentBalanceSheetFigureInTradeDebtors);
|
||||
json.put("increaseSTockTurnByPercentage", increaseSTockTurnByPercentage);
|
||||
json.put("negotiate60DayTerms", negotiate60DayTerms);
|
||||
json.put("noOfMonthsThisYear", noOfMonthsThisYear);
|
||||
json.put("sales", sales);
|
||||
json.put("targetDebtorDays", targetDebtorDays);
|
||||
json.put("username", username);
|
||||
json.put("vatRatio", vatRatio);
|
||||
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/get_balance_sheet_new";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_balancesheet_levers_values() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/get_balancesheet_levers_values/" + username);
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get_default_slider_values() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
response = RestAssured.get(baseUrl + "/get_default_slider_values" );
|
||||
// System.out.println(response.statusCode());
|
||||
// System.out.println(response.getBody().asString());
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void new_slider_value_change() throws JSONException {
|
||||
|
||||
String costOfSalesChangeValue = properties.getProperty("costOfSalesChangeValue");
|
||||
String costOfSalesLastYear = properties.getProperty("costOfSalesLastYear");
|
||||
String costOfSalesReduction = properties.getProperty("costOfSalesReduction");
|
||||
String costOfSalesYTD = properties.getProperty("costOfSalesYTD");
|
||||
String currentCostOfSales = properties.getProperty("currentCostOfSales");
|
||||
String currentOverheads = properties.getProperty("currentOverheads");
|
||||
String currentPayroll = properties.getProperty("currentPayroll");
|
||||
String currentPrice = properties.getProperty("currentPrice");
|
||||
String currentSales = properties.getProperty("currentSales");
|
||||
String noOfMonthsLastYear = properties.getProperty("noOfMonthsLastYear");
|
||||
String noOfMonthsThisYear = properties.getProperty("noOfMonthsThisYear");
|
||||
String overheadChangeValue = properties.getProperty("overheadChangeValue");
|
||||
String overheadCostsLastYear = properties.getProperty("overheadCostsLastYear");
|
||||
String overheadCostsYTD = properties.getProperty("overheadCostsYTD");
|
||||
String overheadReduction = properties.getProperty("overheadReduction");
|
||||
String payrollChangeValue = properties.getProperty("payrollChangeValue");
|
||||
String payrollCostLastYear = properties.getProperty("payrollCostLastYear");
|
||||
String payrollReduction = properties.getProperty("payrollReduction");
|
||||
String payrollYTD = properties.getProperty("payrollYTD");
|
||||
String priceIncrease = properties.getProperty("priceIncrease");
|
||||
String revisedCostOfSalesPercentageValue = properties.getProperty("revisedCostOfSalesPercentageValue");
|
||||
String revisedCostOfSalesValue = properties.getProperty("revisedCostOfSalesValue");
|
||||
String revisedOverheadPercentageValue = properties.getProperty("revisedOverheadPercentageValue");
|
||||
String revisedOverheadValue = properties.getProperty("revisedOverheadValue");
|
||||
String revisedPayrollPercentageValue = properties.getProperty("revisedPayrollPercentageValue");
|
||||
String revisedPayrollValue = properties.getProperty("revisedPayrollValue");
|
||||
String revisedSaleValue = properties.getProperty("revisedSaleValue");
|
||||
String revisedSalesPercentageValue = properties.getProperty("revisedSalesPercentageValue");
|
||||
String salesChangeValue = properties.getProperty("salesChangeValue");
|
||||
String salesGrowth = properties.getProperty("salesGrowth");
|
||||
String salesLastYear = properties.getProperty("salesLastYear");
|
||||
String salesYTD = properties.getProperty("salesYTD");
|
||||
String sliderKeyword = properties.getProperty("sliderKeyword");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("costOfSalesChangeValue", costOfSalesChangeValue);
|
||||
json.put("costOfSalesLastYear", costOfSalesLastYear);
|
||||
json.put("costOfSalesReduction", costOfSalesReduction);
|
||||
json.put("costOfSalesYTD", costOfSalesYTD);
|
||||
json.put("currentCostOfSales", currentCostOfSales);
|
||||
json.put("currentOverheads", currentOverheads);
|
||||
json.put("currentPayroll", currentPayroll);
|
||||
json.put("currentPrice", currentPrice);
|
||||
json.put("currentSales", currentSales);
|
||||
json.put("noOfMonthsLastYear", noOfMonthsLastYear);
|
||||
json.put("noOfMonthsThisYear", noOfMonthsThisYear);
|
||||
json.put("overheadChangeValue", overheadChangeValue);
|
||||
json.put("overheadCostsLastYear", overheadCostsLastYear);
|
||||
json.put("overheadCostsYTD", overheadCostsYTD);
|
||||
json.put("overheadReduction", overheadReduction);
|
||||
json.put("payrollChangeValue", payrollChangeValue);
|
||||
json.put("payrollCostLastYear", payrollCostLastYear);
|
||||
json.put("payrollReduction", payrollReduction);
|
||||
json.put("payrollYTD", payrollYTD);
|
||||
json.put("priceIncrease", priceIncrease);
|
||||
json.put("revisedCostOfSalesPercentageValue", revisedCostOfSalesPercentageValue);
|
||||
json.put("revisedCostOfSalesValue", revisedCostOfSalesValue);
|
||||
json.put("revisedOverheadPercentageValue", revisedOverheadPercentageValue);
|
||||
json.put("revisedOverheadValue", revisedOverheadValue);
|
||||
json.put("revisedPayrollPercentageValue", revisedPayrollPercentageValue);
|
||||
json.put("revisedPayrollValue", revisedPayrollValue);
|
||||
json.put("revisedSaleValue", revisedSaleValue);
|
||||
json.put("revisedSalesPercentageValue", revisedSalesPercentageValue);
|
||||
json.put("salesChangeValue", salesChangeValue);
|
||||
json.put("salesGrowth", salesGrowth);
|
||||
json.put("salesLastYear", salesLastYear);
|
||||
json.put("salesYTD", salesYTD);
|
||||
json.put("sliderKeyword", sliderKeyword);
|
||||
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/new_slider_value_change";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
package com.magnifyb.api.taskmanagementcontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class TaskManagementController {
|
||||
private static Properties properties;
|
||||
RequestSpecification requestSpecification;
|
||||
Response response;
|
||||
ValidatableResponse validatableResponse;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_task_management() throws JSONException {
|
||||
|
||||
|
||||
String chapterId = properties.getProperty("TaskChapterId");
|
||||
String date = properties.getProperty("TaskDate");
|
||||
String id = properties.getProperty("TaskID");
|
||||
String moduleId = properties.getProperty("TaskModuleId");
|
||||
String subChapterId = properties.getProperty("TaskSubChapterId");
|
||||
String username = properties.getProperty("username");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("chapterId", chapterId);
|
||||
json.put("date", date);
|
||||
json.put("id", id);
|
||||
json.put("moduleId", moduleId);
|
||||
json.put("subChapterId", subChapterId);
|
||||
json.put("username", username);
|
||||
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_task_management";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void save_task_management_android() throws JSONException {
|
||||
|
||||
|
||||
String chapterId = properties.getProperty("TaskChapterId");
|
||||
String date = properties.getProperty("TaskDate");
|
||||
String id = properties.getProperty("TaskID");
|
||||
String moduleId = properties.getProperty("TaskModuleId");
|
||||
String subChapterId = properties.getProperty("TaskSubChapterId");
|
||||
String username = properties.getProperty("username");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("chapterId", chapterId);
|
||||
json.put("date", date);
|
||||
json.put("id", id);
|
||||
json.put("moduleId", moduleId);
|
||||
json.put("subChapterId", subChapterId);
|
||||
json.put("username", username);
|
||||
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/save_task_management_android";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void task_management() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
String username = properties.getProperty("username");
|
||||
response = RestAssured.get(baseUrl + "/task_management/" + username);
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.magnifyb.api.usermanagementcontroller;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class UserManagementController {
|
||||
private static Properties properties;
|
||||
RequestSpecification requestSpecification;
|
||||
Response response;
|
||||
ValidatableResponse validatableResponse;
|
||||
|
||||
static {
|
||||
try {
|
||||
properties = new Properties();
|
||||
String userDir = System.getProperty("user.dir");
|
||||
FileInputStream input = new FileInputStream(userDir + "/src/test/java/properties/config.properties");
|
||||
properties.load(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void company_list() {
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
response = RestAssured.get(baseUrl + "/company_list");
|
||||
int statusCode = response.getStatusCode();
|
||||
Assert.assertEquals(statusCode, 200);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void reset_password_user_mgmt() throws JSONException {
|
||||
|
||||
String newPassword = properties.getProperty("newPassword");
|
||||
String password = properties.getProperty("password");
|
||||
String username = properties.getProperty("username");
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("newPassword", newPassword);
|
||||
json.put("password", password);
|
||||
json.put("userName", username);
|
||||
|
||||
|
||||
// Convert JSONObject to a string
|
||||
String jsonString = json.toString();
|
||||
|
||||
String baseUrl = properties.getProperty("base_url");
|
||||
RestAssured.baseURI = baseUrl + "/reset_password_user_mgmt";
|
||||
|
||||
// Create a request specification
|
||||
requestSpecification = RestAssured.given();
|
||||
|
||||
// Setting content type to specify the format in which the request payload will
|
||||
// be sent.
|
||||
requestSpecification.contentType(ContentType.JSON);
|
||||
|
||||
// Adding body as a string
|
||||
requestSpecification.body(jsonString); // Use the jsonString here
|
||||
|
||||
// Calling POST method
|
||||
response = requestSpecification.post();
|
||||
|
||||
// Print the entire response body
|
||||
System.out.println(response.body().asString());
|
||||
|
||||
/*
|
||||
* To perform validation on the response, we need to get ValidatableResponse
|
||||
* type of response
|
||||
*/
|
||||
validatableResponse = response.then();
|
||||
|
||||
// Check status code
|
||||
validatableResponse.statusCode(200);
|
||||
}
|
||||
}
|
74
src/test/java/com/magnifyb/base/BaseClass.java
Normal file
74
src/test/java/com/magnifyb/base/BaseClass.java
Normal file
|
@ -0,0 +1,74 @@
|
|||
package com.magnifyb.base;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.edge.EdgeDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
import org.openqa.selenium.firefox.FirefoxOptions;
|
||||
import org.testng.annotations.AfterTest;
|
||||
|
||||
import io.github.bonigarcia.wdm.WebDriverManager;
|
||||
|
||||
public class BaseClass {
|
||||
public static WebDriver driver;
|
||||
|
||||
public static WebDriver launchBrowser(String browserType, String appURL) throws Exception {
|
||||
switch (browserType) {
|
||||
case "Chrome":
|
||||
initChromeDriver(appURL);
|
||||
break;
|
||||
|
||||
case "Firefox":
|
||||
initFirefoxDriver(appURL);
|
||||
break;
|
||||
|
||||
case "InternetExplorer":
|
||||
initInternetExplorer(appURL);
|
||||
break;
|
||||
|
||||
default:
|
||||
System.out.println("browser : " + browserType + " is invalid");
|
||||
}
|
||||
return driver;
|
||||
}
|
||||
|
||||
public static void initChromeDriver(String appURL) throws Exception {
|
||||
System.out.println("Launching google chrome with new profile..");
|
||||
WebDriverManager.chromedriver().setup();
|
||||
// Set up ChromeOptions for headless mode
|
||||
// ChromeOptions chromeOptions = new ChromeOptions();
|
||||
// chromeOptions.addArguments("--headless"); // Run in headless mode
|
||||
driver = new ChromeDriver();
|
||||
driver.manage().window().maximize();
|
||||
driver.get(appURL);
|
||||
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
|
||||
}
|
||||
|
||||
public static void initFirefoxDriver(String appURL) throws Exception {
|
||||
System.out.println("Launching Firefox browser..");
|
||||
WebDriverManager.firefoxdriver().setup();
|
||||
FirefoxOptions fo = new FirefoxOptions();
|
||||
fo.setBinary("/path/to/firefox/binary");
|
||||
driver = new FirefoxDriver(fo);
|
||||
// driver = new FirefoxDriver();
|
||||
driver.manage().window().maximize();
|
||||
driver.get(appURL);
|
||||
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
|
||||
}
|
||||
|
||||
public static void initInternetExplorer(String appURL) throws Exception {
|
||||
System.out.println("Launching InternetExplorer browser..");
|
||||
WebDriverManager.edgedriver().setup();
|
||||
driver = new EdgeDriver();
|
||||
driver.manage().window().maximize();
|
||||
driver.get(appURL);
|
||||
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
|
||||
}
|
||||
|
||||
@AfterTest
|
||||
public void Close() {
|
||||
driver.quit();
|
||||
}
|
||||
}
|
59
src/test/java/com/magnifyb/comparingcmsapi/AboutUs1.java
Normal file
59
src/test/java/com/magnifyb/comparingcmsapi/AboutUs1.java
Normal file
|
@ -0,0 +1,59 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class AboutUs1 {
|
||||
@Test
|
||||
public void aboutUs() {
|
||||
|
||||
String devApiUrl = "https://magnifytest.machint.com/about_us";
|
||||
String testApiUrl = "https://magnifyservice.machint.com/about_us";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
// Extracting response bodies
|
||||
String devResponseBody = devResponse.getBody().asString();
|
||||
String testResponseBody = testResponse.getBody().asString();
|
||||
|
||||
// Compare JSON responses
|
||||
try {
|
||||
if (compareJsonObjects(devResponseBody, testResponseBody)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
System.out.println("Response Differences:");
|
||||
printDifferences(new JSONObject(devResponseBody), new JSONObject(testResponseBody));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean compareJsonObjects(String json1, String json2) throws JSONException {
|
||||
// Compare JSON objects
|
||||
JSONObject jsonObj1 = new JSONObject(json1);
|
||||
JSONObject jsonObj2 = new JSONObject(json2);
|
||||
return jsonObj1.equals(jsonObj2);
|
||||
}
|
||||
|
||||
private static void printDifferences(JSONObject jsonObj1, JSONObject jsonObj2) throws JSONException {
|
||||
// Print differences between two JSON objects
|
||||
Iterator<String> keys = jsonObj1.keys();
|
||||
while (keys.hasNext()) {
|
||||
String key = keys.next();
|
||||
if (!jsonObj2.has(key) || !jsonObj1.get(key).equals(jsonObj2.get(key))) {
|
||||
System.out.println(
|
||||
"Key: " + key + ",\n Dev Value: " + jsonObj1.get(key) + ",\n Test Value: " + jsonObj2.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class ClearAllCaches {
|
||||
|
||||
@Test
|
||||
public void clearAllCaches() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/clearAllCaches";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/clearAllCaches";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
42
src/test/java/com/magnifyb/comparingcmsapi/GetAboutUs.java
Normal file
42
src/test/java/com/magnifyb/comparingcmsapi/GetAboutUs.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetAboutUs {
|
||||
|
||||
@Test
|
||||
public void aboutUs() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/about_us";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/about_us";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetAccessCode {
|
||||
|
||||
@Test
|
||||
public void accessCode() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/access_code";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/access_code";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetBalanceSheet {
|
||||
@Test
|
||||
public void balanceSheet() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/balance_sheet";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/balance_sheet";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetBusinessArea {
|
||||
|
||||
@Test
|
||||
public void businessArea() {
|
||||
|
||||
String devApiUrl = "https://magnifyservice.machint.com/business_area";
|
||||
String testApiUrl = "https://magnifytest.machint.com/business_area";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
// System.out.println("Differences:");
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetChapterCount {
|
||||
|
||||
@Test
|
||||
public void chapterCount() {
|
||||
String moduleId = "Finance"; // Replace with the actual chapterId value
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/get_subchapters_count?moduleId=" + moduleId;
|
||||
String devApiUrl = "https://magnifyservice.machint.com/get_subchapters_count?moduleId=" + moduleId;
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetCompanyDashboard {
|
||||
|
||||
@Test
|
||||
public void companyDashboard() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/company_dashboard";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/company_dashboard";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetConfirmPassword {
|
||||
|
||||
@Test
|
||||
public void confirmPassword() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/confirm_password";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/confirm_password";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetContacDetails {
|
||||
|
||||
|
||||
@Test
|
||||
public void contacDetails() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/contactUs";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/contactUs";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetCustomerStories {
|
||||
|
||||
@Test
|
||||
public void clearAllCaches() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/customer_stories";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/customer_stories";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetEmailVerification {
|
||||
@Test
|
||||
public void emailVerification() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/email-verification";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/email-verification";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetFinanceSystem {
|
||||
@Test
|
||||
public void financeSystem() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/finance_system_int";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/finance_system_int";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetFooterPages {
|
||||
|
||||
@Test
|
||||
public void footerPages() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/footer_page";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/footer_page";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetForgotPassword {
|
||||
@Test
|
||||
public void forgotPassword() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/forgot_password";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/forgot_password";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
38
src/test/java/com/magnifyb/comparingcmsapi/GetHomePages.java
Normal file
38
src/test/java/com/magnifyb/comparingcmsapi/GetHomePages.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetHomePages {
|
||||
@Test
|
||||
public void homePages() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/home-page";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/home-page";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetHowDoCompare {
|
||||
@Test
|
||||
public void howDoCompare() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/how_do_compare";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/how_do_compare";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetIntegrateFinance {
|
||||
@Test
|
||||
public void integrateFinance() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/integrate_finance";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/integrate_finance";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetLandingPage {
|
||||
@Test
|
||||
public void landingPage() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/landingPage";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/landingPage";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetMagnifybWorks {
|
||||
@Test
|
||||
public void magnifybWorks() {
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/magnifyb_video";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/magnifyb_video";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
39
src/test/java/com/magnifyb/comparingcmsapi/GetModules.java
Normal file
39
src/test/java/com/magnifyb/comparingcmsapi/GetModules.java
Normal file
|
@ -0,0 +1,39 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetModules {
|
||||
|
||||
@Test
|
||||
public void modules() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/module_master";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/module_master";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetPremiumSignupForm {
|
||||
@Test
|
||||
public void premiumSignupForm() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/premium_signup_form";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/premium_signup_form";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
38
src/test/java/com/magnifyb/comparingcmsapi/GetQuestions.java
Normal file
38
src/test/java/com/magnifyb/comparingcmsapi/GetQuestions.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetQuestions {
|
||||
@Test
|
||||
public void premiumSignupForm() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/questions";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/questions";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
38
src/test/java/com/magnifyb/comparingcmsapi/GetReadMore.java
Normal file
38
src/test/java/com/magnifyb/comparingcmsapi/GetReadMore.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetReadMore {
|
||||
@Test
|
||||
public void premiumSignupForm() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/read_more";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/read_more";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
38
src/test/java/com/magnifyb/comparingcmsapi/GetSector.java
Normal file
38
src/test/java/com/magnifyb/comparingcmsapi/GetSector.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetSector {
|
||||
@Test
|
||||
public void sector() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/get-sectors";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/get-sectors";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetSessionOut {
|
||||
@Test
|
||||
public void sessionOut() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/session_out";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/session_out";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
38
src/test/java/com/magnifyb/comparingcmsapi/GetSignIn.java
Normal file
38
src/test/java/com/magnifyb/comparingcmsapi/GetSignIn.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetSignIn {
|
||||
@Test
|
||||
public void signIn() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/signIn";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/signIn";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
38
src/test/java/com/magnifyb/comparingcmsapi/GetSignup.java
Normal file
38
src/test/java/com/magnifyb/comparingcmsapi/GetSignup.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetSignup {
|
||||
@Test
|
||||
public void signup() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/signup";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/signup";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetSignupInfo {
|
||||
@Test
|
||||
public void signupInfo() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/signup_info";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/signup_info";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetSubchapterCount {
|
||||
|
||||
@Test
|
||||
public void subchapterCount() {
|
||||
String chapterId = "Finance"; // Replace with the actual chapterId value
|
||||
|
||||
String testApiUrl = "https://magnifytest.machint.com/get_subchapters_count?chapterId=" + chapterId;
|
||||
String devApiUrl = "https://magnifyservice.machint.com/get_subchapters_count?chapterId=" + chapterId;
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetTaskManagement {
|
||||
@Test
|
||||
public void taskManagement() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/task_management";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/task_management";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetTermsConditions {
|
||||
@Test
|
||||
public void termsConditions() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/terms_conditions";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/terms_conditions";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetThankyouSignupContent {
|
||||
@Test
|
||||
public void thankyouSignupContent() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/thankyou_signup";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/thankyou_signup";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.response.Response;
|
||||
|
||||
public class GetWhatIfInputs {
|
||||
@Test
|
||||
public void whatIfInputs() {
|
||||
String testApiUrl = "https://magnifytest.machint.com/what_if_inputs";
|
||||
String devApiUrl = "https://magnifyservice.machint.com/what_if_inputs";
|
||||
|
||||
Response devResponse = RestAssured.get(devApiUrl);
|
||||
Response testResponse = RestAssured.get(testApiUrl);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
JsonNode devJson = objectMapper.readTree(devResponse.getBody().asString());
|
||||
JsonNode testJson = objectMapper.readTree(testResponse.getBody().asString());
|
||||
|
||||
if (devJson.equals(testJson)) {
|
||||
System.out.println("The responses are the same.");
|
||||
} else {
|
||||
System.out.println("The responses are different.");
|
||||
// Add logic to print or handle the differences as needed
|
||||
// For example, you can print the differing parts
|
||||
System.out.println("Dev Response: " + devJson);
|
||||
System.out.println("Test Response: " + testJson);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
47
src/test/java/com/magnifyb/comparingcmsapi/HomePage.java
Normal file
47
src/test/java/com/magnifyb/comparingcmsapi/HomePage.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
package com.magnifyb.comparingcmsapi;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.github.bonigarcia.wdm.WebDriverManager;
|
||||
|
||||
public class HomePage {
|
||||
|
||||
@Test
|
||||
public void homePage() throws Exception {
|
||||
WebDriverManager.chromedriver().setup();
|
||||
WebDriver driver = new ChromeDriver();
|
||||
driver.manage().window().maximize();
|
||||
String devHomePageURL = "https://magnify.machint.com/home";
|
||||
String testHomePageURL = "https://magnifynewtest.machint.com/home";
|
||||
driver.get(devHomePageURL);
|
||||
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
|
||||
|
||||
// identify element and input text inside it
|
||||
WebElement page1 = driver.findElement(By.tagName("body"));
|
||||
String page1Content = page1.getText();
|
||||
Thread.sleep(2000);
|
||||
driver.get(testHomePageURL);
|
||||
|
||||
WebElement page2 = driver.findElement(By.tagName("body"));
|
||||
String page2Content = page2.getText();
|
||||
|
||||
Thread.sleep(2000);
|
||||
|
||||
|
||||
if (page1Content.equals(page2Content)) {
|
||||
System.out.println("The content of both pages is identical.");
|
||||
} else {
|
||||
System.out.println("The content of the two pages is different.");
|
||||
// Print the differing content
|
||||
System.out.println("Content of Page 1:\n" + page1Content);
|
||||
System.out.println("Content of Page 2:\n" + page2Content);
|
||||
}
|
||||
driver.quit();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package com.magnifyb.pageobjects;
|
||||
|
||||
import com.magnifyb.base.BaseClass;
|
||||
|
||||
public class FinanceQuestionsPageObjects extends BaseClass {
|
||||
|
||||
// sign in
|
||||
public static String signup = "(//div[contains(text(), 'Sign up')])[1]";
|
||||
public static String YouremailPleaselogin = "(//div[contains(text(), 'Your email already exists. Please login')])";
|
||||
public static String okButton = "//div[contains(text(), 'Ok')]";
|
||||
public static String Logintext = "(//div[contains(text(), 'LOGIN')])[1]";
|
||||
public static String loginButton = "//button[@type='button']//div[text()='Login']";
|
||||
public static String loginText = "//div[text()='LOGIN']";
|
||||
public static String emailIDTextField = "//input[@name='username']";
|
||||
public static String passwordTextField = "//input[@name='password']";
|
||||
public static String signinButton = "//div[text()='Sign in']";
|
||||
public static String MyCompanyDashboard = "//div[contains(text(), 'My Company Dashboard')]";
|
||||
public static String questionnaire = "(//span[text()='Questionnaire'])[1]";
|
||||
public static String questionnaireDropdown = "(//*[local-name()='svg'])[6]";
|
||||
public static String moveBusinessAreas = "(//span[@class='MuiTouchRipple-root'])[12]";
|
||||
public static String businessareas = "(//span[text()='Business Areas'])[2]";
|
||||
public static String finance = "//div[contains(text(), 'Finance')]";
|
||||
|
||||
// Finance questions
|
||||
public static String FQ001 = "//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Disagree']";
|
||||
public static String FQ002 = "//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Disagree']";
|
||||
public static String FQ003 = "//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Agree']";
|
||||
public static String FQ004 = "//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Agree']";
|
||||
public static String FQ005 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Agree'])[2]";
|
||||
public static String nextButton = "//div[contains(text(), 'Next')]";
|
||||
|
||||
|
||||
//Sales business development
|
||||
public static String SalesBusinessDevelopment = "//div[contains(text(), 'Sales & Business Development')]";
|
||||
public static String SB001 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Disagree'])";
|
||||
public static String SB002 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Disagree'])[2]";
|
||||
public static String SB003 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Disagree'])[3]";
|
||||
public static String SB004 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Disagree'])[4]";
|
||||
public static String SB005 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Disagree'])[5]";
|
||||
|
||||
//Marketing & Branding
|
||||
public static String marketingAndBranding = "//div[contains(text(), 'Marketing & Branding')]";
|
||||
public static String MB001 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Disagree'])";
|
||||
public static String MB002 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Disagree'])[2]";
|
||||
public static String MB003 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Disagree'])[3]";
|
||||
public static String MB004 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Disagree'])[4]";
|
||||
public static String MB005 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Disagree'])[5]";
|
||||
|
||||
//Product & Service Development
|
||||
public static String productAndServiceDevelopment = "//div[contains(text(), 'Product & Service Development')]";
|
||||
public static String PS001 = "//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Agree'][1]";
|
||||
public static String PS002 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Agree'])[2]";
|
||||
public static String PS003 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Agree'])[3]";
|
||||
public static String PS004 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Agree'])[4]";
|
||||
public static String PS005 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Agree'])[5]";
|
||||
|
||||
//Investment & Exit
|
||||
public static String investmentAndExit = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Disagree'])";
|
||||
public static String IE001 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Disagree'])";
|
||||
public static String IE002 = "(//span[contains(@class, 'MuiSlider-thumbColorPrimary')]//span[text()='Strongly Disagree'])[2]";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
57
src/test/java/com/magnifyb/restassured/LoginPostAPI.java
Normal file
57
src/test/java/com/magnifyb/restassured/LoginPostAPI.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
package com.magnifyb.restassured;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.response.Response;
|
||||
import io.restassured.response.ValidatableResponse;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
|
||||
public class LoginPostAPI {
|
||||
|
||||
@Test
|
||||
public void login() {
|
||||
|
||||
String body = "{\n" + " \"password\": \"Machint@123\",\n" + " \"username\": \"ramanjeneyulu.j@machint.com\"\n"
|
||||
+ "}";
|
||||
|
||||
// Create a request specification
|
||||
RequestSpecification request = RestAssured.given();
|
||||
|
||||
request.contentType(ContentType.JSON);
|
||||
|
||||
request.baseUri("https://magnifytest.machint.com/login");
|
||||
// Adding body as string
|
||||
request.body(body);
|
||||
|
||||
// Calling POST method on URI. After hitting we get Response
|
||||
Response response = request.post();
|
||||
|
||||
// Printing Response as string
|
||||
System.out.println(response.asString());
|
||||
|
||||
// Get Validatable response to perform validation
|
||||
ValidatableResponse validatableResponse = response.then();
|
||||
|
||||
// Validate status code as 200
|
||||
validatableResponse.statusCode(200);
|
||||
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void UserRegistrationSuccessful()
|
||||
// {
|
||||
// RestAssured.baseURI ="https://magnifytest.machint.com";
|
||||
// RequestSpecification request = RestAssured.given();
|
||||
// JSONObject requestParams = new JSONObject();
|
||||
// requestParams.put("username", "ramanjeneyulu.j@machint.com");
|
||||
// requestParams.put("password", "Machint@123");
|
||||
// request.body(requestParams.toJSONString());
|
||||
// Response response = request.put("/login");
|
||||
// ResponseBody body = response.getBody();
|
||||
// System.out.println(response.getStatusLine());
|
||||
// System.out.println(body.asString());
|
||||
//
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.magnifyb.testcases;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.magnifyb.base.BaseClass;
|
||||
import com.magnifyb.webpages.BusinessAreas;
|
||||
import com.magnifyb.webpages.Login;
|
||||
|
||||
public class BusinessAreasTestcase {
|
||||
|
||||
WebDriver driver;
|
||||
Login login;
|
||||
BusinessAreas businessAreas;
|
||||
|
||||
@BeforeTest
|
||||
public void setup() throws Exception {
|
||||
driver = BaseClass.launchBrowser("Chrome", "https://magnifywebtest.machint.com/");
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
|
||||
@Test(priority = 1)
|
||||
public void navigate_to_dashboard() throws Exception {
|
||||
login = new Login(driver);
|
||||
login.loginApplication();
|
||||
}
|
||||
|
||||
@Test(priority = 2)
|
||||
public void businessareas() throws Exception {
|
||||
businessAreas = new BusinessAreas(driver);
|
||||
businessAreas.navigateBusinessAreas();
|
||||
businessAreas.navigateStartFinanceQuestionnaire();
|
||||
businessAreas.managementInformation(0, 3, 2, 3, 2, 1, 0, 3);
|
||||
businessAreas.forecasting(3, 1, 3, 2);
|
||||
businessAreas.debtorManagement(0, 1, 2, 3, 3, 3, 3, 3, 3);
|
||||
businessAreas.creditorManagement(2, 2, 2, 3, 3, 3);
|
||||
businessAreas.payroll(3, 3, 2, 2, 3);
|
||||
businessAreas.stockManagement(3, 3, 3, 3, 3);
|
||||
businessAreas.hmrc(2, 2, 2);
|
||||
businessAreas.fixedAssets(1, 1, 2, 2, 2, 3, 3);
|
||||
businessAreas.finance(1, 3, 0);
|
||||
businessAreas.businessOverview();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.magnifyb.testcases;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.magnifyb.base.BaseClass;
|
||||
import com.magnifyb.webpages.AccessCode;
|
||||
|
||||
public class GetAccessCodeTestcase {
|
||||
|
||||
WebDriver driver;
|
||||
AccessCode accessCode;
|
||||
|
||||
@BeforeTest
|
||||
public void setup() throws Exception {
|
||||
driver = BaseClass.launchBrowser("InternetExplorer", "https://magnifynewtest.machint.com/home");
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
|
||||
@Test(priority = 1)
|
||||
public void getAccessCode() throws Exception {
|
||||
accessCode = new AccessCode(driver);
|
||||
accessCode.generateAccessCode();
|
||||
accessCode.getAccessCode();
|
||||
}
|
||||
}
|
BIN
src/test/java/com/magnifyb/testdata/testdata.xlsx
vendored
Normal file
BIN
src/test/java/com/magnifyb/testdata/testdata.xlsx
vendored
Normal file
Binary file not shown.
115
src/test/java/com/magnifyb/utils/Excel.java
Normal file
115
src/test/java/com/magnifyb/utils/Excel.java
Normal file
|
@ -0,0 +1,115 @@
|
|||
package com.magnifyb.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.DataFormatter;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
public class Excel {
|
||||
|
||||
public static XSSFWorkbook workbook;
|
||||
public static XSSFSheet sheet;
|
||||
public static XSSFRow row;
|
||||
public static XSSFCell cell;
|
||||
public static int i, j, rowCount, colCount, totalSheet, rCnt, cCnt;
|
||||
public static String cellValue, celldata;
|
||||
|
||||
public static void readExcel(String filepath, String sheetName) throws Exception {
|
||||
File file = new File(filepath);
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
workbook = new XSSFWorkbook(fis);
|
||||
sheet = workbook.getSheet(sheetName);
|
||||
}
|
||||
|
||||
public static int getRowCount() {
|
||||
rowCount = sheet.getLastRowNum();
|
||||
// System.out.println(rowCount);
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
public static int getColumnCount() {
|
||||
row = sheet.getRow(0);
|
||||
colCount = row.getLastCellNum();
|
||||
// System.out.println(colCount);
|
||||
return colCount;
|
||||
}
|
||||
|
||||
public static String getCellContentAsString(Cell cell) throws Exception {
|
||||
switch (cell.getCellType()) {
|
||||
case Cell.CELL_TYPE_BLANK:
|
||||
celldata = "";
|
||||
break;
|
||||
|
||||
case Cell.CELL_TYPE_STRING:
|
||||
celldata = cell.getStringCellValue();
|
||||
break;
|
||||
|
||||
case Cell.CELL_TYPE_NUMERIC:
|
||||
DataFormatter df = new DataFormatter();
|
||||
celldata = df.formatCellValue(cell);
|
||||
break;
|
||||
|
||||
case Cell.CELL_TYPE_FORMULA:
|
||||
celldata = String.valueOf(cell.getNumericCellValue());
|
||||
break;
|
||||
|
||||
case Cell.CELL_TYPE_BOOLEAN:
|
||||
celldata = String.valueOf(cell.getBooleanCellValue());
|
||||
break;
|
||||
|
||||
default:
|
||||
celldata = cell.getStringCellValue();
|
||||
break;
|
||||
}
|
||||
return celldata;
|
||||
}
|
||||
|
||||
public static String getCellData(int colNum, int rowNum) throws Exception {
|
||||
String result = null;
|
||||
cell = sheet.getRow(rowNum).getCell(colNum);
|
||||
result = getCellContentAsString(cell);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String testDataFromExcel(String columnName) throws Exception {
|
||||
for (i = 1; i <= getRowCount(); i++) {
|
||||
row = sheet.getRow(i);
|
||||
cell = row.getCell(0);
|
||||
String actionvalue = cell.getStringCellValue();
|
||||
if (actionvalue.equalsIgnoreCase(columnName)) {
|
||||
cell = sheet.getRow(i).getCell(1);
|
||||
cellValue = getCellContentAsString(cell);
|
||||
}
|
||||
}
|
||||
return cellValue;
|
||||
}
|
||||
|
||||
public static void writeDataToExcel(String filepath, String sheetName, String columnName, String value)
|
||||
throws Exception {
|
||||
File myFile = new File(filepath);
|
||||
FileInputStream fis = new FileInputStream(myFile);
|
||||
XSSFWorkbook workbook = new XSSFWorkbook(fis);
|
||||
XSSFSheet sheet = workbook.getSheet(sheetName);
|
||||
|
||||
for (i = 1; i <= getRowCount(); i++) {
|
||||
row = sheet.getRow(i);
|
||||
cell = row.getCell(0);
|
||||
String actionvalue = cell.getStringCellValue();
|
||||
if (actionvalue.equalsIgnoreCase(columnName)) {
|
||||
Cell textValue = sheet.getRow(i).createCell(1);
|
||||
textValue.setCellType(Cell.CELL_TYPE_STRING);
|
||||
textValue.setCellValue(value);
|
||||
FileOutputStream fos = new FileOutputStream(myFile);
|
||||
workbook.write(fos);
|
||||
fos.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
112
src/test/java/com/magnifyb/utils/ExcelData.java
Normal file
112
src/test/java/com/magnifyb/utils/ExcelData.java
Normal file
|
@ -0,0 +1,112 @@
|
|||
package com.magnifyb.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.DataFormatter;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
public class ExcelData {
|
||||
|
||||
public static XSSFWorkbook workbook;
|
||||
public static XSSFSheet sheet;
|
||||
public static XSSFRow row;
|
||||
public static XSSFCell cell;
|
||||
public static String FilePath = System.getProperty("user.dir") + "\\src\\test\\java\\testdata\\testdata.xlsx";
|
||||
public static String SheetName = "Sheet2";
|
||||
public static String cellValue;
|
||||
public static int rowCount, colCount;
|
||||
|
||||
public void setExcelFile(String excelFilePath, String sheetName) throws IOException {
|
||||
// Create an object of File class to open xlsx file
|
||||
File file = new File(excelFilePath);
|
||||
|
||||
// Create an object of FileInputStream class to read excel file
|
||||
FileInputStream inputStream = new FileInputStream(file);
|
||||
|
||||
// creating workbook instance that refers to .xlsx file
|
||||
workbook = new XSSFWorkbook(inputStream);
|
||||
|
||||
// creating a Sheet object
|
||||
sheet = workbook.getSheet(sheetName);
|
||||
}
|
||||
|
||||
// This method is to get the row count used of the excel sheet
|
||||
public static int getRowCount() {
|
||||
rowCount = sheet.getLastRowNum();
|
||||
System.out.println("last row is \t" + rowCount);
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
// This method is to get the column count used of the excel sheet
|
||||
public static int getColumnCount() {
|
||||
row = sheet.getRow(0);
|
||||
colCount = row.getLastCellNum();
|
||||
System.out.println("last column is \t" + colCount);
|
||||
return colCount;
|
||||
}
|
||||
|
||||
// This method is to get cell types used of the excel sheet
|
||||
public static String getCellContentAsString(Cell cell) throws Exception {
|
||||
switch (cell.getCellType()) {
|
||||
case Cell.CELL_TYPE_BLANK:
|
||||
cellValue = "";
|
||||
break;
|
||||
|
||||
case Cell.CELL_TYPE_STRING:
|
||||
cellValue = cell.getStringCellValue();
|
||||
break;
|
||||
|
||||
case Cell.CELL_TYPE_NUMERIC:
|
||||
DataFormatter df = new DataFormatter();
|
||||
cellValue = df.formatCellValue(cell);
|
||||
break;
|
||||
|
||||
case Cell.CELL_TYPE_FORMULA:
|
||||
cellValue = String.valueOf(cell.getNumericCellValue());
|
||||
break;
|
||||
|
||||
case Cell.CELL_TYPE_BOOLEAN:
|
||||
cellValue = String.valueOf(cell.getBooleanCellValue());
|
||||
break;
|
||||
|
||||
default:
|
||||
cellValue = cell.getStringCellValue();
|
||||
break;
|
||||
}
|
||||
return cellValue;
|
||||
}
|
||||
|
||||
public static String getCellData(int RowNum, int ColNum) {
|
||||
cell = sheet.getRow(RowNum).getCell(ColNum);
|
||||
DataFormatter formatter = new DataFormatter();
|
||||
return formatter.formatCellValue(cell);
|
||||
}
|
||||
|
||||
public int getNoOfRows() {
|
||||
return sheet.getPhysicalNumberOfRows();
|
||||
}
|
||||
|
||||
public int getNoOfColumns() {
|
||||
return sheet.getRow(0).getLastCellNum();
|
||||
}
|
||||
|
||||
public Object[][] to2DArray() throws Exception {
|
||||
int noOfRows = getNoOfRows() - 1;
|
||||
int noOfCells = getNoOfColumns();
|
||||
Object obj[][] = new Object[noOfRows][noOfCells];
|
||||
|
||||
for (int i = 0; i < noOfRows; i++) { // i = 0 1 2
|
||||
// row = sh.getRow(i);
|
||||
for (int j = 0; j < noOfCells; j++) {
|
||||
obj[i][j] = getCellData(i + 1, j); // i = 1 2 3
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
109
src/test/java/com/magnifyb/webpages/AccessCode.java
Normal file
109
src/test/java/com/magnifyb/webpages/AccessCode.java
Normal file
|
@ -0,0 +1,109 @@
|
|||
package com.magnifyb.webpages;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
|
||||
public class AccessCode {
|
||||
|
||||
private static WebDriver driver;
|
||||
|
||||
By accessCodeClickHere = By.xpath("//span[text()='CLICK HERE.']");
|
||||
By firstname = By.name("firstName");
|
||||
By lastname = By.name("lastName");
|
||||
By businessname = By.name("businessName");
|
||||
By email = By.name("email");
|
||||
By mobile = By.name("mobile");
|
||||
By termsAndConditions = By.xpath("//label//input[@name='termsAndConditions']//following::span[1]");
|
||||
By termsAndConditions2 = By.xpath("//label//input[@name='termsAndConditions2']//following::span[1]");
|
||||
By submitButton = By.xpath("//div[text()='Submit']");
|
||||
|
||||
By emailiD = By.xpath("//input[@type='email']");
|
||||
By nextButton = By.xpath("//span[contains(text(),'Next')]");
|
||||
By password = By.xpath("//input[@type='password']");
|
||||
By searchSubjectText = By.xpath("//input[@placeholder='Search in mail']");
|
||||
By clickonEmail = By.xpath("(//div[@class='nH ar4 B']//div[@class='Nr UI S2 vy'])[2]//table//tr[1]/td[@role='gridcell'][1]");
|
||||
By mailList = By.xpath("(//div[@role='listitem'])[last()]");
|
||||
By showButton = By.xpath("(//div[@aria-label='Show trimmed content'])[last()]");
|
||||
|
||||
public AccessCode(WebDriver driver) {
|
||||
AccessCode.driver = driver;
|
||||
}
|
||||
|
||||
public void generateAccessCode() throws Exception {
|
||||
WebElement accesscodeClickHere = driver.findElement(accessCodeClickHere);
|
||||
accesscodeClickHere.click();
|
||||
|
||||
WebElement firstName = driver.findElement(firstname);
|
||||
firstName.sendKeys("Durga");
|
||||
|
||||
WebElement lastName = driver.findElement(lastname);
|
||||
lastName.sendKeys("P");
|
||||
|
||||
WebElement businessName = driver.findElement(businessname);
|
||||
businessName.sendKeys("Machint");
|
||||
|
||||
WebElement emailID = driver.findElement(email);
|
||||
emailID.sendKeys("durga.ponnana@machint.com");
|
||||
|
||||
WebElement mobileNumber = driver.findElement(mobile);
|
||||
mobileNumber.sendKeys("06789678989");
|
||||
|
||||
WebElement termsAndconditions = driver.findElement(termsAndConditions);
|
||||
termsAndconditions.click();
|
||||
|
||||
WebElement termsAndconditions2 = driver.findElement(termsAndConditions2);
|
||||
termsAndconditions2.click();
|
||||
|
||||
WebElement submitbutton = driver.findElement(submitButton);
|
||||
submitbutton.click();
|
||||
}
|
||||
|
||||
public void getAccessCode() throws Exception {
|
||||
driver.get("https://mail.google.com/mail/u/0/#inbox");
|
||||
|
||||
WebElement email_ID = driver.findElement(emailiD);
|
||||
email_ID.sendKeys("durga.ponnana@machint.com");
|
||||
|
||||
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
|
||||
|
||||
WebElement nextbutton = wait.until(ExpectedConditions.elementToBeClickable(nextButton));
|
||||
nextbutton.click();
|
||||
Thread.sleep(5000);
|
||||
|
||||
WebElement password1 = driver.findElement(password);
|
||||
password1.sendKeys("ponnana@137");
|
||||
|
||||
Thread.sleep(5000);
|
||||
|
||||
WebElement nextbutton1 = wait.until(ExpectedConditions.elementToBeClickable(nextButton));
|
||||
nextbutton1.click();
|
||||
|
||||
Thread.sleep(10000);
|
||||
|
||||
WebElement searchsubjectText = wait.until(ExpectedConditions.presenceOfElementLocated(searchSubjectText));
|
||||
searchsubjectText.sendKeys("Access Code");
|
||||
searchsubjectText.sendKeys(Keys.ENTER);
|
||||
Thread.sleep(2000);
|
||||
|
||||
WebElement clickonemail = driver.findElement(clickonEmail);
|
||||
clickonemail.click();
|
||||
|
||||
WebElement maillist = driver.findElement(mailList);
|
||||
maillist.click();
|
||||
|
||||
try {
|
||||
WebElement showbutton = driver.findElement(showButton);
|
||||
showbutton.click();
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
1165
src/test/java/com/magnifyb/webpages/BusinessAreas.java
Normal file
1165
src/test/java/com/magnifyb/webpages/BusinessAreas.java
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,43 @@
|
|||
package com.magnifyb.webpages;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.magnifyb.base.BaseClass;
|
||||
|
||||
public class BusinessAreasTestcase {
|
||||
|
||||
WebDriver driver;
|
||||
Login login;
|
||||
BusinessAreas businessAreas;
|
||||
|
||||
@BeforeTest
|
||||
public void setup() throws Exception {
|
||||
driver = BaseClass.launchBrowser("Chrome", "https://magnifynewtest.machint.com/login");
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
|
||||
@Test(priority = 1)
|
||||
public void navigate_to_dashboard() throws Exception {
|
||||
login = new Login(driver);
|
||||
login.loginApplication();
|
||||
}
|
||||
|
||||
@Test(priority = 2)
|
||||
public void businessareas() throws Exception {
|
||||
businessAreas = new BusinessAreas(driver);
|
||||
businessAreas.navigateBusinessAreas();
|
||||
businessAreas.navigateStartFinanceQuestionnaire();
|
||||
businessAreas.managementInformation(0, 3, 2, 3, 2, 1, 0, 3);
|
||||
businessAreas.forecasting(3, 1, 3, 2);
|
||||
businessAreas.debtorManagement(0, 1, 2, 3, 3, 3, 3, 3, 0);
|
||||
businessAreas.creditorManagement(2, 2, 2, 3, 3, 3);
|
||||
businessAreas.payroll(3, 3, 2, 2, 3);
|
||||
businessAreas.stockManagement(3, 3, 3, 3, 3);
|
||||
businessAreas.hmrc(2, 2, 2);
|
||||
businessAreas.fixedAssets(1, 1, 2, 2, 2, 3, 3);
|
||||
businessAreas.finance(1, 3, 0);
|
||||
businessAreas.businessOverview();
|
||||
}
|
||||
}
|
121
src/test/java/com/magnifyb/webpages/FinanceQuestions.java
Normal file
121
src/test/java/com/magnifyb/webpages/FinanceQuestions.java
Normal file
|
@ -0,0 +1,121 @@
|
|||
package com.magnifyb.webpages;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.JavascriptExecutor;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.magnifyb.pageobjects.FinanceQuestionsPageObjects;
|
||||
import com.magnifyb.utils.Excel;
|
||||
|
||||
public class FinanceQuestions extends FinanceQuestionsPageObjects {
|
||||
public static String actual, expected;
|
||||
|
||||
public static String filepath = System.getProperty("user.dir") + "\\src\\test\\java\\com\\magnifyb\\testdata\\testdata.xlsx";
|
||||
public static String sheetname = "Signin";
|
||||
Excel excel = new Excel();
|
||||
|
||||
@Test
|
||||
public void financequestions() throws Throwable {
|
||||
Excel.readExcel(filepath, sheetname);
|
||||
|
||||
|
||||
// navigates to application
|
||||
launchBrowser(Excel.testDataFromExcel("BroswerType"), Excel.testDataFromExcel("Url"));
|
||||
|
||||
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
|
||||
|
||||
Thread.sleep(5000);
|
||||
|
||||
// Enter email address
|
||||
WebElement emailAddress = new WebDriverWait(driver, Duration.ofSeconds(30))
|
||||
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(emailIDTextField)));
|
||||
emailAddress.sendKeys(Excel.testDataFromExcel("Email Address"));
|
||||
|
||||
//Click on sign up button
|
||||
WebElement signupButton = new WebDriverWait(driver, Duration.ofSeconds(30))
|
||||
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(signup)));
|
||||
signupButton.click();
|
||||
|
||||
//Validate Your email already exists. Please login pop up text
|
||||
WebElement youremailalreadyexistsPleaselogin = new WebDriverWait(driver, Duration.ofSeconds(30))
|
||||
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(YouremailPleaselogin)));
|
||||
actual = youremailalreadyexistsPleaselogin.getText();
|
||||
expected = "Your email already exists. Please login.";
|
||||
Assert.assertEquals(actual, expected);
|
||||
|
||||
//Click on ok button
|
||||
WebElement OkButton = new WebDriverWait(driver, Duration.ofSeconds(30))
|
||||
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(okButton)));
|
||||
OkButton.click();
|
||||
Thread.sleep(3000);
|
||||
|
||||
//Validate login text
|
||||
WebElement Login = new WebDriverWait(driver, Duration.ofSeconds(30))
|
||||
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(Logintext)));
|
||||
actual = Login.getText();
|
||||
expected = "LOGIN";
|
||||
Assert.assertEquals(actual, expected);
|
||||
|
||||
|
||||
//Enter Password
|
||||
WebElement passwordField = new WebDriverWait(driver, Duration.ofSeconds(30))
|
||||
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(passwordTextField)));
|
||||
passwordField.sendKeys(Excel.testDataFromExcel("Password"));
|
||||
|
||||
|
||||
//Click on sign in button
|
||||
WebElement signInButton = new WebDriverWait(driver, Duration.ofSeconds(30))
|
||||
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(signinButton)));
|
||||
signInButton.click();
|
||||
|
||||
|
||||
//Validate my company dashboard
|
||||
WebElement Mycompanydashboard = new WebDriverWait(driver, Duration.ofSeconds(30))
|
||||
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(MyCompanyDashboard)));
|
||||
String mycompanydashboard = Mycompanydashboard.getText();
|
||||
Assert.assertEquals(mycompanydashboard, Excel.testDataFromExcel("My Company Dashboard"));
|
||||
|
||||
Thread.sleep(5000);
|
||||
|
||||
Actions action = new Actions(driver);
|
||||
JavascriptExecutor js = (JavascriptExecutor) driver;
|
||||
|
||||
|
||||
//Click on questionnaire drop down button
|
||||
WebElement questionnaireDropDown = new WebDriverWait(driver, Duration.ofSeconds(30))
|
||||
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(questionnaireDropdown)));
|
||||
action.moveToElement(questionnaireDropDown).click().perform();
|
||||
Thread.sleep(2000);
|
||||
|
||||
// Scrolling down the page till the business Areas is found
|
||||
WebElement movebusinessAreas = new WebDriverWait(driver, Duration.ofSeconds(30))
|
||||
.until(ExpectedConditions.elementToBeClickable(By.xpath(moveBusinessAreas)));
|
||||
js.executeScript("arguments[0].scrollIntoView();", movebusinessAreas);
|
||||
|
||||
|
||||
//click on Business Areas
|
||||
WebElement businessAreas = new WebDriverWait(driver, Duration.ofSeconds(30))
|
||||
.until(ExpectedConditions.elementToBeClickable(By.xpath(businessareas)));
|
||||
action.moveToElement(businessAreas).doubleClick().perform();
|
||||
Thread.sleep(5000);
|
||||
|
||||
//Validate finance text
|
||||
WebElement Finance = new WebDriverWait(driver, Duration.ofSeconds(30))
|
||||
.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(finance)));
|
||||
js.executeScript("arguments[0].scrollIntoView();", Finance);
|
||||
String financeText = Finance.getText();
|
||||
Assert.assertEquals(financeText, Excel.testDataFromExcel("Finance"));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
54
src/test/java/com/magnifyb/webpages/Login.java
Normal file
54
src/test/java/com/magnifyb/webpages/Login.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package com.magnifyb.webpages;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test
|
||||
public class Login {
|
||||
|
||||
private static WebDriver driver;
|
||||
// sign in
|
||||
By loginButton = By.xpath("//div[text()='Login']");
|
||||
By emailIDTextField = By.xpath("//input[@name='username']");
|
||||
By passwordTextField = By.xpath("//input[@name='password']");
|
||||
By signinButton = By.xpath("//div[text()='Sign in']");
|
||||
By MyCompanyDashboard = By.xpath("//div[contains(text(), 'My Company Dashboard')]");
|
||||
|
||||
public Login(WebDriver driver) {
|
||||
Login.driver = driver;
|
||||
}
|
||||
|
||||
public void loginApplication() throws Exception {
|
||||
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(100));
|
||||
|
||||
WebElement loginbutton = wait.until(ExpectedConditions.elementToBeClickable(loginButton));
|
||||
// WebElement loginbutton = driver.findElement(loginButton);
|
||||
// ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", loginButton);
|
||||
|
||||
loginbutton.click();
|
||||
|
||||
WebElement un = driver.findElement(emailIDTextField);
|
||||
un.sendKeys("durgaradha7@gmail.com");
|
||||
// un.sendKeys("ramanjeneyulu.j@machint.com");
|
||||
|
||||
WebElement pw = driver.findElement(passwordTextField);
|
||||
pw.sendKeys("Machint@123");
|
||||
|
||||
WebElement signinbutton = driver.findElement(signinButton);
|
||||
signinbutton.click();
|
||||
|
||||
Thread.sleep(30000);
|
||||
|
||||
WebElement dashboard = driver.findElement(MyCompanyDashboard);
|
||||
String dashboardText = dashboard.getText();
|
||||
Assert.assertEquals(dashboardText, "My Company Dashboard");
|
||||
}
|
||||
|
||||
}
|
194
src/test/java/properties/config.properties
Normal file
194
src/test/java/properties/config.properties
Normal file
|
@ -0,0 +1,194 @@
|
|||
base_url=https://magnifyservice.machint.com
|
||||
moduleId = Finance
|
||||
chapterId = Finance
|
||||
userId = 1464
|
||||
username = 1464
|
||||
id = 3
|
||||
email = ponnanadurgaparameswari@gmail.com
|
||||
password = Machint@123
|
||||
endMonth= 12
|
||||
costOfSalesLastYear = 219758
|
||||
costOfSalesYTD = 186911
|
||||
noOfMonthsLastYear = 12
|
||||
noOfMonthsThisYear = 10
|
||||
overheadCostsLastYear = 78017
|
||||
overheadCostsYTD = 67204
|
||||
payrollCostLastYear = 85492
|
||||
payrollYTD = 111941
|
||||
salesLastYear = 566086
|
||||
salesYTD = 331710
|
||||
answersText = Testing
|
||||
companyName = Machint
|
||||
name = Durga
|
||||
questions = haveQ
|
||||
changePercentage = 0
|
||||
cumulativePlMonths = 0
|
||||
cumulativePlValue = 0
|
||||
productName = Sales
|
||||
typeKeyword = Sales
|
||||
annualizedPlMonths = 0
|
||||
currentValue = 50
|
||||
thisYearValue = 40
|
||||
cashIn = 300
|
||||
cashOut = 400
|
||||
creditors = 7566
|
||||
debtors =7565
|
||||
informationFrom = SELF
|
||||
stock =7575
|
||||
storedDate = 23-10-2023
|
||||
todaysBalance = 77575
|
||||
creditorsBalanceSheet= 85757
|
||||
currentAssets = 95858
|
||||
currentLiabilities = 8585
|
||||
employees= 4
|
||||
fixedAssets = 55868
|
||||
monthAndYear = 2023-11-22T16:44:28.226Z
|
||||
monthEndBalance = 8575
|
||||
costOfSalesLastYear = 488595
|
||||
monthAndYearLastYear = 2023-11-22T16:44:28.226Z
|
||||
payrollLastYear = 6696
|
||||
salesAndRevenueLastYear =85696
|
||||
overheads =95858
|
||||
payroll = 8585
|
||||
salesAndRevenue =86868
|
||||
costOfSales = 8575
|
||||
status = To Do
|
||||
priority = New Sales
|
||||
chapterCode = MC1
|
||||
|
||||
chapterModuleCode = Finance
|
||||
chapterAnswerCode = M2C1Q1A1_Never
|
||||
chaptercode = M2C1_Management_Information
|
||||
chapterName= Management Information
|
||||
chapterQuestionCode =M2C1Q1_prepare_Management_Accounts
|
||||
chapterScore =1
|
||||
subChapterCount = 3
|
||||
weightage = 4
|
||||
|
||||
GenericmoduleId = Generic
|
||||
GenericAnswer = Full
|
||||
GenericAnswerCode =G7Q7A1
|
||||
GenericQuestionCode=G7Q7_Shareholder_Key_Staff_Insurance _in_place
|
||||
serialNumber=1
|
||||
questionId=G7Q7_Shareholder_Key_Staff_Insurance _in_place
|
||||
|
||||
GoalAnswer: null
|
||||
GoalCost = 7800
|
||||
GoalDate = 2023-11-23T00:00:00.000+00:00
|
||||
goal = Holiday
|
||||
goalStatus: null
|
||||
GoalID =609
|
||||
isPriority = 0
|
||||
overallCost = 0
|
||||
|
||||
PaidAnswerId =
|
||||
PaidModuleId = Finance
|
||||
PaidModuleName =Finance
|
||||
PaidQuestionId =B1Q1_understand_enough_about_your_companys_cashflow
|
||||
PaidScoring =1
|
||||
|
||||
QuizChapterCode =M2C1_Management_Information
|
||||
QuizChapterName =Management Information
|
||||
QuizAnswerCode =
|
||||
QuizQuestionCode =
|
||||
QuizSerialNumber = 0
|
||||
QuizSubChapterCode= M2C1S1_Why_prepare_a_budget
|
||||
QuizSubChapterName =Why prepare a budget?
|
||||
QuizValue = 1
|
||||
|
||||
newPassword = Machint@123
|
||||
|
||||
TaskChapterId = M2C2_Forecasting_P_and_L_and_cashflow
|
||||
TaskDate =
|
||||
TaskID =
|
||||
TaskModuleId = M2_Finance
|
||||
TaskSubChapterId =M2C2S4_PL_forecast_cost_of_sales_forecasting
|
||||
|
||||
BLcostOfSales= 903920
|
||||
currentBalanceSheetFigureInStock= 159957
|
||||
currentBalanceSheetFigureInTradeCreditors =26975
|
||||
currentBalanceSheetFigureInTradeDebtors= 527081
|
||||
increaseSTockTurnByPercentage= 10
|
||||
negotiate60DayTerms= 30
|
||||
noOfMonthsThisYear= 10
|
||||
sales= 1845257
|
||||
targetDebtorDays= 45
|
||||
vatRatio =20
|
||||
|
||||
|
||||
costOfSalesChangeValue= 1700598
|
||||
costOfSalesLastYear = 678654
|
||||
costOfSalesReduction=-152.3
|
||||
costOfSalesYTD=903920
|
||||
currentCostOfSales=48
|
||||
currentOverheads=43
|
||||
currentPayroll=52
|
||||
currentPrice=47
|
||||
currentSales=50
|
||||
noOfMonthsLastYear=12
|
||||
noOfMonthsThisYear=10
|
||||
overheadChangeValue=0
|
||||
overheadCostsLastYear=289450
|
||||
overheadCostsYTD=311317
|
||||
overheadReduction=0
|
||||
payrollChangeValue=374525
|
||||
payrollCostLastYear=332526
|
||||
payrollReduction=-63.1
|
||||
payrollYTD=600201
|
||||
priceIncrease=175.5
|
||||
revisedCostOfSalesPercentageValue=156.8
|
||||
revisedCostOfSalesValue=2785302
|
||||
revisedOverheadPercentageValue=0
|
||||
revisedOverheadValue=0
|
||||
revisedPayrollPercentageValue=52
|
||||
revisedPayrollValue=1094766
|
||||
revisedSaleValue=4882550
|
||||
revisedSalesPercentageValue=120.5
|
||||
salesChangeValue=2668241
|
||||
salesGrowth=140
|
||||
salesLastYear=1338984
|
||||
salesYTD=1845257
|
||||
sliderKeyword=overheads
|
||||
|
||||
businessName =
|
||||
firstName = Durga
|
||||
lastName = P
|
||||
marketingPermission = true
|
||||
mobileNumber =
|
||||
privacyNotice = true
|
||||
|
||||
issueOrEnquiryType =
|
||||
|
||||
passcode=Kk4E5
|
||||
|
||||
dashboardFlag=inprogress
|
||||
detailedQuestionFlag=pending
|
||||
earlyLaunchScreenFlag=completed
|
||||
emailVerificationScreenFlag=completed
|
||||
financeQuestionsFlag=pending
|
||||
financeSummaryFlag=pending
|
||||
financeSystemScreenFlag=completed
|
||||
genericScreenFlag=inprogress
|
||||
id=6
|
||||
mangnifybBenifitsFlag=completed
|
||||
progressScreenFlag=pending
|
||||
thankYouScreenFlag=completed
|
||||
|
||||
accessCode =Kk4E5
|
||||
useremail = ponnanadurgaparameswari@gmail.com
|
||||
|
||||
email2 = test87474@gmail.com
|
||||
addressLine = 12-14-8
|
||||
city = Vizag
|
||||
companyRegistrationNumber = 0087575875
|
||||
companyType= Sole Trader
|
||||
isAdmin = true
|
||||
isPremium = true
|
||||
phone = 0766487484
|
||||
postCode = 877577
|
||||
sector = Engineering Services
|
||||
streetAddress = 67-87-88
|
||||
subscriptionType = embrace
|
||||
termsAndConditions = true
|
||||
webAddress = test
|
||||
|
4
target/classes/META-INF/MANIFEST.MF
Normal file
4
target/classes/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,4 @@
|
|||
Manifest-Version: 1.0
|
||||
Build-Jdk-Spec: 17
|
||||
Created-By: Maven Integration for Eclipse
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#Generated by Maven Integration for Eclipse
|
||||
#Thu Nov 23 09:58:38 IST 2023
|
||||
m2e.projectLocation=/home/durga/Documents/GitHub/MagnifyBTest
|
||||
m2e.projectName=MagnifyB
|
||||
groupId=MagnifyB
|
||||
artifactId=MagnifyB
|
||||
version=0.0.1-SNAPSHOT
|
223
target/classes/META-INF/maven/MagnifyB/MagnifyB/pom.xml
Normal file
223
target/classes/META-INF/maven/MagnifyB/MagnifyB/pom.xml
Normal file
|
@ -0,0 +1,223 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>MagnifyB</groupId>
|
||||
<artifactId>MagnifyB</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>TestNG</name>
|
||||
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
|
||||
<dependency>
|
||||
<groupId>org.seleniumhq.selenium</groupId>
|
||||
<artifactId>selenium-java</artifactId>
|
||||
<version>4.12.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>7.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
|
||||
<dependency>
|
||||
<groupId>io.github.bonigarcia</groupId>
|
||||
<artifactId>webdrivermanager</artifactId>
|
||||
<version>5.5.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-scratchpad -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/openxml4j -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>openxml4j</artifactId>
|
||||
<version>1.0-beta</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/ooxml-schemas -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>ooxml-schemas</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<version>4.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-1.2-api -->
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-1.2-api</artifactId>
|
||||
<version>2.18.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
|
||||
<dependency>
|
||||
<groupId>io.rest-assured</groupId>
|
||||
<artifactId>rest-assured</artifactId>
|
||||
<version>5.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/io.rest-assured/json-schema-validator -->
|
||||
<dependency>
|
||||
<groupId>io.rest-assured</groupId>
|
||||
<artifactId>json-schema-validator</artifactId>
|
||||
<version>5.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.15.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JavaMail API -->
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Additional JavaMail IMAP Libraries -->
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>imap</artifactId>
|
||||
<version>1.6.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>smtp</artifactId>
|
||||
<version>1.6.7</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
https://mvnrepository.com/artifact/net.javacrumbs.json-unit/json-unit -->
|
||||
<dependency>
|
||||
<groupId>net.javacrumbs.json-unit</groupId>
|
||||
<artifactId>json-unit</artifactId>
|
||||
<version>3.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.skyscreamer</groupId>
|
||||
<artifactId>jsonassert</artifactId>
|
||||
<version>1.5.0</version> <!-- Use the latest version available -->
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
|
||||
<dependency>
|
||||
<groupId>com.aventstack</groupId>
|
||||
<artifactId>extentreports</artifactId>
|
||||
<version>5.0.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-text -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.11.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version> <!-- You can adjust the version as
|
||||
needed -->
|
||||
|
||||
<configuration>
|
||||
<source>11</source> <!-- Specify your desired source version -->
|
||||
<target>11</target> <!-- Specify your desired target version -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<!-- <build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
<configuration>
|
||||
<suiteXmlFiles>
|
||||
<suiteXmlFile>testng.xml</suiteXmlFile>
|
||||
</suiteXmlFiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build> -->
|
||||
|
||||
</project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/test-classes/com/magnifyb/base/BaseClass.class
Normal file
BIN
target/test-classes/com/magnifyb/base/BaseClass.class
Normal file
Binary file not shown.
BIN
target/test-classes/com/magnifyb/comparingcmsapi/AboutUs1.class
Normal file
BIN
target/test-classes/com/magnifyb/comparingcmsapi/AboutUs1.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user