Skip to content

Instantly share code, notes, and snippets.

@githubuserdlpprod
Created December 22, 2025 06:22
Show Gist options
  • Select an option

  • Save githubuserdlpprod/4831ec2bedf7f05dd10161ac05bef44e to your computer and use it in GitHub Desktop.

Select an option

Save githubuserdlpprod/4831ec2bedf7f05dd10161ac05bef44e to your computer and use it in GitHub Desktop.
{\rtf1\ansi\ansicpg1252\cocoartf1348\cocoasubrtf170
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\f0\fs24 \cf0 @@ -1,331 +0,0 @@\
package com.elastica.tests.dropbox;\
\
import static org.testng.Assert.assertTrue;\
\
import java.util.HashMap;\
import java.util.Map;\
import java.util.UUID;\
\
import org.openqa.selenium.WebDriver;\
import org.testng.Assert;\
import org.testng.Reporter;\
import org.testng.annotations.AfterTest;\
import org.testng.annotations.Test;\
\
import com.elastica.common.CommonTest;\
import com.elastica.gateway.GatewayTestConstants;\
import com.elastica.listeners.Priority;\
import com.elastica.logger.Logger;\
\
public class DropboxTests extends CommonTest \{\
Map <String, Object> expectedDataMap = new HashMap<String, Object>();\
String fromTime=null;\
String title;\
@Priority(1)\
@Test(groups =\{"SANITY", "MINI_SANITY", "UPLOAD1"\})\
public void loginToCloudSocAppAndSetupSSO() throws Exception \{\
fromTime=backend.getCurrentTime();\
Reporter.log("Starting performing SSO setup", true);\
login.loginCloudSocPortal(getWebDriver(), suiteData);\
Reporter.log("Finished performing SSO setup", true);\
\}\
\
@Priority(2)\
@Test(groups =\{"SANITY", "MINI_SANITY", "UPLOAD1"\}) \
public void ValidateDropboxLogin() throws Exception \{\
fromTime=backend.getCurrentTime();\
Logger.info("==================================================================================");\
Logger.info("Verifying the login event");\
Logger.info("==================================================================================");\
\
expectedDataMap.clear();\
Logger.info("==================================================================================");\
Logger.info("Perfroming dropbox SaasApp login operation");\
Logger.info("==================================================================================");\
\
dba.login(getWebDriver(), suiteData);\
String fileName=GatewayTestConstants.DROPBOX_FILESHARE;\
Reporter.log(" completed SaasApp login operation ",true);\
expectedDataMap.clear();\
expectedDataMap.put(GatewayTestConstants.ACTIVITY_TYPE, "Login");\
expectedDataMap.put(GatewayTestConstants.MESSAGE, "User logged in"); \
expectedDataMap.put(GatewayTestConstants.ACCOUNT_TYPE,suiteData.getAccountType());\
expectedDataMap.put(GatewayTestConstants.DOMAIN, suiteData.getTenantDomainName());\
expectedDataMap.put(GatewayTestConstants.ELASTICA_USER, suiteData.getTestUsername());\
expectedDataMap.put(GatewayTestConstants.IS_ANONYMOUS_PROXY, "false");\
expectedDataMap.put(GatewayTestConstants.OBJECT_TYPE, "Session");\
expectedDataMap.put(GatewayTestConstants.REQ_URI, GatewayTestConstants.DROPBOX_REQ_URI_LOGIN);\
expectedDataMap.put(GatewayTestConstants.SEVERITY, "informational");\
expectedDataMap.put(GatewayTestConstants.USER, suiteData.getTestUsername());\
Assert.assertTrue(backend.validateLog(client, suiteData, fromTime, expectedDataMap),"Logs does not match");\
Logger.info("==================================================================================");\
Logger.info("Verify login event -successful");\
Logger.info("==================================================================================");\
\
\}\
\
@Priority(3)\
@Test(groups =\{"SANITY", "MINI_SANITY", "UPLOAD"\}) \
public void ValidatePublicFileShare() throws Exception \{\
fromTime=backend.getCurrentTime();\
\
Logger.info("==================================================================================");\
Logger.info("Verifying the Public file share event");\
Logger.info("==================================================================================");\
\
Reporter.log("Verifying the public share event", true);\
String fileName=GatewayTestConstants.DROPBOX_FILESHARE;\
expectedDataMap.clear();\
Logger.info("==================================================================================");\
Logger.info("Perfroming dropbox SaasApp Public file share operation");\
Logger.info("==================================================================================");\
\
dba.publicShare(getWebDriver(), fileName);\
Logger.info("==================================================================================");\
Logger.info("Completed dropbox SaasApp Public file share operation");\
Logger.info("==================================================================================");\
Thread.sleep(5000);\
dba.publicUnshare(getWebDriver(), fileName);\
expectedDataMap.clear();\
expectedDataMap.put(GatewayTestConstants.ACTIVITY_TYPE, "Share");\
expectedDataMap.put(GatewayTestConstants.MESSAGE, "User clicked on get link for "+fileName); \
expectedDataMap.put(GatewayTestConstants.ACCOUNT_TYPE,suiteData.getAccountType());\
expectedDataMap.put(GatewayTestConstants.DOMAIN, suiteData.getTenantDomainName());\
expectedDataMap.put(GatewayTestConstants.ELASTICA_USER, suiteData.getTestUsername());\
expectedDataMap.put(GatewayTestConstants.IS_ANONYMOUS_PROXY, "false");\
expectedDataMap.put(GatewayTestConstants.OBJECT_TYPE, "Links");\
expectedDataMap.put(GatewayTestConstants.REQ_URI, GatewayTestConstants.DROPBOX_REQ_URI_SHARE);\
expectedDataMap.put(GatewayTestConstants.SEVERITY, "informational");\
expectedDataMap.put(GatewayTestConstants.USER, suiteData.getTestUsername());\
Assert.assertTrue(backend.validateLog(client, suiteData, fromTime, expectedDataMap),"Logs does not match");\
Logger.info("==================================================================================");\
Logger.info("Verifying the Public file share event -successful");\
Logger.info("==================================================================================");\
\
\}\
\
@Priority(3)\
@Test(groups =\{"REGRESSION", "MINI_SANITY", "UPLOAD"\}) \
public void ValidatePublicFileUnshare() throws Exception \{\
fromTime=backend.getCurrentTime();\
Logger.info("==================================================================================");\
Logger.info("Verifying the Public file Unshare event");\
Logger.info("==================================================================================");\
expectedDataMap.clear();\
String fileName=GatewayTestConstants.DROPBOX_FILESHARE;\
Logger.info("==================================================================================");\
Logger.info("Perfroming dropbox SaasApp Public file share operation");\
Logger.info("==================================================================================");\
dba.publicUnshare(getWebDriver(), fileName);\
Logger.info("==================================================================================");\
Logger.info("Completed dropbox SaasApp Public file share operation");\
Logger.info("==================================================================================");\
expectedDataMap.clear();\
expectedDataMap.put(GatewayTestConstants.ACTIVITY_TYPE, "Unshare");\
expectedDataMap.put(GatewayTestConstants.MESSAGE, "User removed link for "+fileName); \
expectedDataMap.put(GatewayTestConstants.ACCOUNT_TYPE,suiteData.getAccountType());\
expectedDataMap.put(GatewayTestConstants.DOMAIN, suiteData.getTenantDomainName());\
expectedDataMap.put(GatewayTestConstants.ELASTICA_USER, suiteData.getTestUsername());\
expectedDataMap.put(GatewayTestConstants.IS_ANONYMOUS_PROXY, "false");\
expectedDataMap.put(GatewayTestConstants.OBJECT_TYPE, "Link");\
expectedDataMap.put(GatewayTestConstants.SEVERITY, "informational");\
expectedDataMap.put(GatewayTestConstants.USER, suiteData.getTestUsername());\
Assert.assertTrue(backend.validateLog(client, suiteData, fromTime, expectedDataMap),"Logs does not match");\
Logger.info("==================================================================================");\
Logger.info("Verifying the Public file Unshare event -successful");\
Logger.info("==================================================================================");\
\}\
@Priority(4)\
@Test(groups =\{"SANITY", "MINI_SANITY", "UPLOAD"\}) \
public void ValidateDownload() throws Exception \{\
fromTime=backend.getCurrentTime();\
Logger.info("==================================================================================");\
Logger.info("Verifying the file Download event");\
Logger.info("==================================================================================");\
String fileName=GatewayTestConstants.DROPBOX_FILESHARE;\
Logger.info("==================================================================================");\
Logger.info("Perfroming dropbox SaasApp Public file share operation");\
Logger.info("==================================================================================");\
dba.download(getWebDriver(), fileName);\
Logger.info("==================================================================================");\
Logger.info("Completed dropbox SaasApp Public file share operation");\
Logger.info("==================================================================================");\
expectedDataMap.clear();\
expectedDataMap.put(GatewayTestConstants.ACTIVITY_TYPE, "Download");\
expectedDataMap.put(GatewayTestConstants.MESSAGE, "User downloaded file "+fileName); \
expectedDataMap.put(GatewayTestConstants.ACCOUNT_TYPE,suiteData.getAccountType());\
expectedDataMap.put(GatewayTestConstants.DOMAIN, suiteData.getTenantDomainName());\
expectedDataMap.put(GatewayTestConstants.ELASTICA_USER, suiteData.getTestUsername());\
expectedDataMap.put(GatewayTestConstants.IS_ANONYMOUS_PROXY, "false");\
expectedDataMap.put(GatewayTestConstants.OBJECT_TYPE, "File");\
//expectedDataMap.put(GatewayTestConstants.FILE_SIZE, "692088");\
//expectedDataMap.put(GatewayTestConstants.RESP_CODE, "200");\
expectedDataMap.put(GatewayTestConstants.REQ_URI, GatewayTestConstants.DROPBOX_REQ_URI_DOWNLOAD);\
expectedDataMap.put(GatewayTestConstants.SEVERITY, "informational");\
expectedDataMap.put(GatewayTestConstants.USER, suiteData.getTestUsername());\
Assert.assertTrue(backend.validateLog(client, suiteData, fromTime, expectedDataMap),"Logs does not match");\
Logger.info("==================================================================================");\
Logger.info("Verifying the file download event -successful");\
Logger.info("==================================================================================");\
\}\
\
@Priority(5)\
//@Test(groups =\{"SANITY", "MINI_SANITY", "UPLOAD1"\}) \
public void ValidateDecryptDownload() throws Exception \{\
fromTime=backend.getCurrentTime();\
Logger.info("==================================================================================");\
Logger.info("Verifying the file decrypt Download event");\
Logger.info("==================================================================================");\
String fileName=GatewayTestConstants.DROPBOX_DOWNLOAD_DECRYPTED_FILE;\
policy.deleteEncryptionDecryptionPolicy(GatewayTestConstants.ENCRY_DECRYPT_POLICY_NAME+getSaasAppUserName(), suiteData, backend.getHeaders(suiteData));\
policy.createEnableEncryptionDecryptionPolicy(GatewayTestConstants.ENCRY_DECRYPT_POLICY_NAME+getSaasAppUserName(), suiteData, backend.getHeaders(suiteData));\
Logger.info("==================================================================================");\
Logger.info("Perfroming dropbox SaasApp decrypt Download operation");\
Logger.info("==================================================================================");\
dba.download(getWebDriver(), fileName);\
Logger.info("==================================================================================");\
Logger.info("Completed dropbox SaasApp decrypt Download operation");\
Logger.info("==================================================================================");\
expectedDataMap.clear();\
expectedDataMap.put(GatewayTestConstants.ACTIVITY_TYPE, "File Decryption");\
expectedDataMap.put(GatewayTestConstants.MESSAGE, "File "+fileName+" decrypted on download for user "+suiteData.getTestUsername()); \
expectedDataMap.put(GatewayTestConstants.ACCOUNT_TYPE,suiteData.getAccountType());\
expectedDataMap.put(GatewayTestConstants.POLICY_TYPE, GatewayTestConstants.FILE_TRANSFER_POLICY);\
expectedDataMap.put(GatewayTestConstants.FILE_SIZE, "60234");\
expectedDataMap.put(GatewayTestConstants.POLICY_ACTION, GatewayTestConstants.POLICY_ACTION_ALERT);\
expectedDataMap.put(GatewayTestConstants.ACTION_TAKEN, GatewayTestConstants.ACTION_TAKEN_DECRYPT );\
expectedDataMap.put(GatewayTestConstants.CRYPTO_KEY_VERSION, GatewayTestConstants.CRYPTO_KEY_VERSION_USED);\
expectedDataMap.put(GatewayTestConstants.DOMAIN, suiteData.getTenantDomainName());\
expectedDataMap.put(GatewayTestConstants.ELASTICA_USER, suiteData.getTestUsername());\
expectedDataMap.put(GatewayTestConstants.IS_ANONYMOUS_PROXY, "false");\
expectedDataMap.put(GatewayTestConstants.REQ_URI, GatewayTestConstants.DROPBOX_REQ_URI_DOWNLOAD+"/"+fileName);\
expectedDataMap.put(GatewayTestConstants.SEVERITY, "informational");\
expectedDataMap.put(GatewayTestConstants.USER, suiteData.getTestUsername());\
expectedDataMap.put(GatewayTestConstants.BROWSER, GatewayTestConstants.BROWSER_NAME);\
Assert.assertTrue(backend.validateLog(client, suiteData, fromTime, expectedDataMap),"Logs does not match");\
Logger.info("==================================================================================");\
Logger.info("Verifying the file decryped download event -successful");\
Logger.info("==================================================================================");\
\}\
\
@Priority(4)\
@Test(groups =\{"SANITY", "MINI_SANITY", "UPLOAD"\}) \
public void ValidateUpload() throws Exception \{\
fromTime=backend.getCurrentTime();\
Logger.info("==================================================================================");\
Logger.info("Verifying the file upload event");\
Logger.info("=================================================================================="); \
policy.deleteEncryptionDecryptionPolicy(GatewayTestConstants.ENCRY_DECRYPT_POLICY_NAME+getSaasAppUserName(), suiteData, backend.getHeaders(suiteData));\
Logger.info("==================================================================================");\
Logger.info("Perfroming dropbox SaasApp file upload operation");\
Logger.info("==================================================================================");\
dba.uploadFile(getWebDriver(), GatewayTestConstants.GDRIVE_ORIGINAL_FILE_PATH + GatewayTestConstants.GDRIVE_UPLOAD_ORIGINAL_FILE );\
Logger.info("==================================================================================");\
Logger.info("Completed dropbox SaasApp file upload operation");\
Logger.info("==================================================================================");\
Thread.sleep(5000);\
dba.deleteFile(getWebDriver(),GatewayTestConstants.GDRIVE_UPLOAD_ORIGINAL_FILE );\
expectedDataMap.clear();\
expectedDataMap.put(GatewayTestConstants.ACTIVITY_TYPE, "Upload");\
expectedDataMap.put(GatewayTestConstants.MESSAGE, "User uploaded file "+GatewayTestConstants.GDRIVE_UPLOAD_ORIGINAL_FILE); \
expectedDataMap.put(GatewayTestConstants.ACCOUNT_TYPE,suiteData.getAccountType());\
expectedDataMap.put(GatewayTestConstants.DOMAIN, suiteData.getTenantDomainName());\
expectedDataMap.put(GatewayTestConstants.ELASTICA_USER, suiteData.getTestUsername());\
expectedDataMap.put(GatewayTestConstants.IS_ANONYMOUS_PROXY, "false");\
expectedDataMap.put(GatewayTestConstants.OBJECT_TYPE, "File");\
expectedDataMap.put(GatewayTestConstants.REQ_URI, GatewayTestConstants.DROPBOX_REQ_URI_UPLOAD);\
expectedDataMap.put(GatewayTestConstants.SEVERITY, "informational");\
// expectedDataMap.put(GatewayTestConstants.FILE_SIZE, "59932");\
expectedDataMap.put(GatewayTestConstants.USER, suiteData.getTestUsername());\
Assert.assertTrue(backend.validateLog(client, suiteData, fromTime, expectedDataMap),"Logs does not match");\
Logger.info("==================================================================================");\
Logger.info("Verifying the file upload event -successful");\
Logger.info("==================================================================================");\
\}\
\
@Priority(5)\
//@Test(groups =\{"SANITY", "MINI_SANITY", "UPLOAD"\}) \
public void ValidateEncryptUpload() throws Exception \{\
fromTime=backend.getCurrentTime();\
Logger.info("==================================================================================");\
Logger.info("Verifying the encryped file upload event");\
Logger.info("=================================================================================="); \
policy.deleteEncryptionDecryptionPolicy(GatewayTestConstants.ENCRY_DECRYPT_POLICY_NAME+getSaasAppUserName(), suiteData, backend.getHeaders(suiteData));\
policy.createEnableEncryptionDecryptionPolicy(GatewayTestConstants.ENCRY_DECRYPT_POLICY_NAME+getSaasAppUserName(), suiteData, backend.getHeaders(suiteData));\
Logger.info("==================================================================================");\
Logger.info("Perfroming dropbox SaasApp encryped file upload operation");\
Logger.info("==================================================================================");\
dba.uploadFile(getWebDriver(), GatewayTestConstants.GDRIVE_ORIGINAL_FILE_PATH + GatewayTestConstants.GDRIVE_ORGINAL_FILE );\
Thread.sleep(5000);\
Logger.info("==================================================================================");\
Logger.info("Completed dropbox SaasApp encryped file upload operation");\
Logger.info("==================================================================================");\
dba.deleteFile(getWebDriver(),GatewayTestConstants.GDRIVE_ORGINAL_FILE+".eef" );\
expectedDataMap.clear(); \
expectedDataMap.put(GatewayTestConstants.MESSAGE, "File "+GatewayTestConstants.GDRIVE_ORGINAL_FILE +" encrypted on upload for user "+suiteData.getSaasAppUsername()+".");\
expectedDataMap.put(GatewayTestConstants.POLICY_ACTION, GatewayTestConstants.POLICY_ACTION_ALERT);\
expectedDataMap.put(GatewayTestConstants.ACTION_TAKEN, GatewayTestConstants.ACTION_TAKEN_ENCRYPT );\
expectedDataMap.put(GatewayTestConstants.CRYPTO_KEY_VERSION, GatewayTestConstants.CRYPTO_KEY_VERSION_USED);\
expectedDataMap.put(GatewayTestConstants.DOMAIN, suiteData.getTenantDomainName());\
expectedDataMap.put(GatewayTestConstants.ELASTICA_USER, suiteData.getTestUsername());\
expectedDataMap.put(GatewayTestConstants.IS_ANONYMOUS_PROXY, "false");\
expectedDataMap.put(GatewayTestConstants.FILE_SIZE, "60030");\
expectedDataMap.put(GatewayTestConstants.REQ_URI, GatewayTestConstants.DROPBOX_REQ_URI_UPLOAD);\
expectedDataMap.put(GatewayTestConstants.SEVERITY, "informational");\
expectedDataMap.put(GatewayTestConstants.USER, suiteData.getTestUsername());\
expectedDataMap.put(GatewayTestConstants.BROWSER, GatewayTestConstants.BROWSER_NAME);\
Assert.assertTrue(backend.validateLog(client, suiteData, fromTime, expectedDataMap),"Expected log: "+expectedDataMap.get(GatewayTestConstants.MESSAGE)+" does not exist");\
\
Logger.info("==================================================================================");\
Logger.info("Verifying the encryped file upload event -successful");\
Logger.info("==================================================================================");\
\}\
\
\
@Priority(6)\
@Test(groups =\{"REGRESSION","MINI_SANITY", "UPLOAD"\}) \
public void ValidateLogout() throws Exception \{\
fromTime=backend.getCurrentTime();\
Logger.info("==================================================================================");\
Logger.info("Verifying the logout event");\
Logger.info("==================================================================================");\
\
Logger.info("==================================================================================");\
Logger.info("Perfroming dropbox SaasApp logout operation");\
Logger.info("==================================================================================");\
dba.logout(getWebDriver());\
\
Logger.info("==================================================================================");\
Logger.info("Completed dropbox SaasApp logout operation");\
Logger.info("==================================================================================");\
\
expectedDataMap.clear();\
expectedDataMap.put(GatewayTestConstants.ACTIVITY_TYPE, "Logout");\
expectedDataMap.put(GatewayTestConstants.MESSAGE, "User logged out"); \
expectedDataMap.put(GatewayTestConstants.ACCOUNT_TYPE,suiteData.getAccountType());\
expectedDataMap.put(GatewayTestConstants.DOMAIN, suiteData.getTenantDomainName());\
expectedDataMap.put(GatewayTestConstants.ELASTICA_USER, suiteData.getTestUsername());\
expectedDataMap.put(GatewayTestConstants.IS_ANONYMOUS_PROXY, "false");\
expectedDataMap.put(GatewayTestConstants.OBJECT_TYPE, "Session");\
expectedDataMap.put(GatewayTestConstants.RESP_CODE, "302");\
//expectedDataMap.put(GatewayTestConstants.REQ_URI, GatewayTestConstants.DROPBOX_REQ_URI_HOME);\
expectedDataMap.put(GatewayTestConstants.SEVERITY, "informational");\
expectedDataMap.put(GatewayTestConstants.USER, suiteData.getTestUsername());\
Assert.assertTrue(backend.validateLog(client, suiteData, fromTime, expectedDataMap),"Logs does not match");\
Logger.info("==================================================================================");\
Logger.info("Verifying the logout event -successful");\
Logger.info("==================================================================================");\
\}\
@AfterTest\
public void cleanup() throws Exception \{\
Reporter.log("inside cleanup method", true);\
dba.deleteFile(getWebDriver(),GatewayTestConstants.GDRIVE_UPLOAD_ORIGINAL_FILE );\
\}\
\
public String getSaasAppUserName()\{\
return suiteData.getSaasAppUsername().replaceAll("@", "_");\
\}\
\
\}\
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment