0% found this document useful (0 votes)
1 views

TXT

The document outlines a script for verifying the BIP online messages notification feature for suppliers and collaboration members in a sourcing application. It includes details on creating and publishing an RFQ, sending messages to participants, and ensuring notifications are received via email and in-app. The script also contains various import statements and setup configurations necessary for execution.

Uploaded by

chandupusarla53
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

TXT

The document outlines a script for verifying the BIP online messages notification feature for suppliers and collaboration members in a sourcing application. It includes details on creating and publishing an RFQ, sending messages to participants, and ensuring notifications are received via email and in-app. The script also contains various import statements and setup configurations necessary for execution.

Uploaded by

chandupusarla53
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 32

CreateBid_HeaderLevelAttachment_ADFTable={{CreateBid}}/

web\:ADFTable[@absoluteLocator='*pt1\:_FOr1\:_FO*\:MA*:AP1\:a*\:popApplicationsTabl
e\:_ATp\:popAttachmentTable']
(old)CreateBid_HeaderLevelAttachment_ADFTable={{CreateBid}}/
web\:ADFTable[@absoluteLocator='*pt1\:_FOr1\:_FO*\:MA*\:AP1\:a2\:popApplicationsTab
le\:_ATp\:popAttachmentTable']

(old)SendMessage_Attachment_Add_CommandImageLink={{OnlineMessages}}/
web\:ADFCommandImageLink[@absoluteLocator='*pt1\:_FOr1\:_FO*\:MAt*\:r1\:AP1\:r1\:a1
\:clLAdds' or
@text='*pt1\:_FOr1\:0\:_FO*\:0\:MAt*\:1\:r1\:0\:AP1\:r1\:1\:a1\:clLAdds']

SendMessage_Attachment_Add_CommandImageLink={{OnlineMessages}}/
web\:ADFCommandImageLink[@absoluteLocator='*pt1\:_FOr1\:_FO*\:MAt*AP1\:r1\:a*\:clLA
dds' or @text='*pt1\:_FOr1\:0\:_FO*\:0\:MAt*AP1\:r1\:1\:a*\:clLAdds']

SendMessage_Attachment_AddIcon =
{{OnlineMessages}}/web:ADFCommandImageLink[@absoluteLocator='*pt1:_FOr1:_FO*:MA*:AP
1:r1:a*:clLAdds' or @text='*pt1:_FOr1:0:_FO*:0:MA*:3:AP1:r1:*:a*:clLAdds']

SendMessage_AttachmentsOkButton =
{{OnlineMessages}}/web:ADFCommandButton[@absoluteLocator='*pt1:_FOr1:_FO*:MA*:AP1:a
*:dc_cb1' or @text='OK']
SendMessage_MoreAttachmentsLink =
{{OnlineMessages}}/web:ADFCommandLink[@absoluteLocator='*pt1:_FOr1:_FO*:MA*:AP1:a2:
attachmentMoreLink' or @text='(* more...)']
SendMessage_MoreAttachmentsLink_Table =
{{OnlineMessages}}/web:ADFTable[@absoluteLocator='*pt1:_FOr1:_FO*:MA*:r1:AP1:a1:pop
ApplicationsTable:_ATp:popAttachmentTable']

///
SendMessage_Attachment_Add_CommandImageLink={{OnlineMessages}}/
web\:ADFCommandImageLink[@absoluteLocator='*pt1\:_FOr1\:_FO*\:MAt*\:r1\:AP1\:r1\:a*
\:clLAdds' or
@text='*pt1\:_FOr1\:0\:_FO*\:0\:MAt*\:*\:r1\:0\:AP1\:r1\:1\:a*\:clLAdds']

Negotiations - Supplier Portalafddvsddddvddvdvdvdvdvdvdvdvd


']/web:ADFCommandImageLink[@absoluteLocator='*pt1:_FOr1:_FO*:MA*:AP1:r1:a*:clLAdds'
or @text='*pt1:_FOr1:0:_FO*:0:MA*:3:AP1:r1:*:a*:clLAdds']

web\:ADFCommandImageLink[@absoluteLocator='*pt1\:_FOr1\:_FO*\:MAt*AP1\:r1\:a*\:clLA
dds' or @text='*pt1\:_FOr1\:0\:_FO*\:0\:MAt*AP1\:r1\:1\:a*\:clLAdds']

/*
* Script Name : PON_BIPONMSGS_Exchange
* Script Description : Verify the feature BIP online messages notification in
app and email for suppliers and collaboration members
* Create and publish an RFQ with BPA as outcome. RFQ should have collaboration
team members added and suppliers invited. (Add 2 members and 2 suppliers)
* Buyer sends a message to All participants, to All members
* Verify that BIP notification is sent to All participants and All members (Email
and in-app notification) – 2 members and 2 suppliers should receive the
notifications
* Internal member 1 replies to the message sent by the buyer
* Verify that buyer receives the BIP notification from the internal member (Email
and in-app notification)
* Script Version : 1.0
* Product : Sourcing
* Primary Author : Naresh.Katakam
* Secondary Author :
* Date Created : 28-12-2022
* Initial Conditions : BIP Optin is enabled or revision >=23D
* End Conditions :
* Jar files(if applicable):
* Assumptions : updateSourcingOptin script is passed.
* Review History :
* Review Version/Review date/Reviewer/Review status/Comments:
* Change History :
* Version/Date/Updated By/Detail Changes:
*/

// User defined import statements


import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.StringReader;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.StringReader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.charset.StandardCharsets;

import javax.json.Json;
import javax.json.JsonArray;
import javax.json.JsonObject;
import oracle.apps.prc.common.*;

// Import statements for OATS Modules


import oracle.oats.scripting.modules.basic.api.*;
import oracle.oats.scripting.modules.basic.api.exceptions.AbstractScriptException;
import oracle.oats.scripting.modules.browser.api.*;
import oracle.oats.scripting.modules.functionalTest.api.*;
import oracle.oats.scripting.modules.utilities.api.*;
import oracle.oats.scripting.modules.utilities.api.sql.*;
import oracle.oats.scripting.modules.utilities.api.xml.*;
import oracle.oats.scripting.modules.utilities.api.file.*;
import oracle.oats.scripting.modules.webdom.api.elements.DOMElement;
import oracle.oats.scripting.modules.webdom.api.*;
import oracle.oats.scripting.modules.adf.api.*;
import oracle.oats.scripting.modules.adf.api.elements.ADFCommandToolbarButton;
import oracle.oats.scripting.modules.adf.api.elements.ADFDialog;
import oracle.oats.scripting.modules.adf.api.elements.ADFTable;
import oracle.oats.scripting.modules.adf.api.elements.ADFTreeTable;
import oracle.oats.scripting.modules.adf.api.elements.AbstractADFComponent;
import lib.myCompany.myTeam.PrcEmailLibFunctions;
import lib.*;

public class script extends IteratingVUserScript { //NOPMD - prcWaitForPage is


intentionally taking snapshots at every sync to get a clarity on failure
point.Hence suppressing too many snapshot warning
// OATS Script Services
@ScriptService oracle.oats.scripting.modules.utilities.api.UtilitiesService
utilities;
@ScriptService oracle.oats.scripting.modules.browser.api.BrowserService
browser;
@ScriptService
oracle.oats.scripting.modules.functionalTest.api.FunctionalTestService ft;
@ScriptService oracle.oats.scripting.modules.webdom.api.WebDomService web;
@ScriptService oracle.oats.scripting.modules.adf.api.ADFService adf;
@ScriptService oracle.oats.scripting.modules.datatable.api.DataTableService
datatable;

// Script Level variables


String envFilePath; /* Path of the environment xml file
*/
PrcCommonFunctions prcObj; /* Object of PrcCommonFunctions class */
FileOperations fileObj; /* Object of FileOperations class */
PrcXmlParser xmlObj; /* Object of PrcXmlParser class */
Map<String,String> xmlMap; /* Map Object to store the parsed
environment xml file */
Integer v_sync; /* Sync time from environment xml
file */
Integer v_wait; /* Wait time from environment xml
file */
String envType; /* Environment type from
environment xml file */
String absPath; /* Absolute file path of the
current BAT */
String excelSheetPath; /* Path of the excel sheet */
String[] dataSheetArray; /* Array of worksheets present in the
excel sheet */
List <String> dataSheetlist; /* List of worksheets present in the excel
sheet */
String strRepositoryName;
String prodLibPath ;
String autogenPath;
String directoryPath;
String directoryPath1;
String negNumber="";
String negTitle;
String dataPath;
int result = -1, column=0,rowNumberCounterForFirstReply=0;
String procBU="";
String POST_URL;
String buyerUser1, buyerPwd1, supplierUser1, supplierUser2, supplierPwd;
String title = "";
String expectedToText = "PON00005, PRC";
String expectedReplyMessageTextForFirstRow ,actualToTextForFirstRowReply;
String attachmentName="";
public enum webType { B, SPAN, P, IMG, H1, A };

HashMap<String, String> supplierContacts = new HashMap<String, String>();


String ItSecurityManager,ItSecurityManagerPassword;
String postResponseContent, postResponseCode,AuctionHeaderID;
ADFTreeTable messageTable= null;

@FunctionLibrary("PonRRFCommonFunctions") lib.prc.pon.PonRRFCommonFunctions
ponRRFCommonFunctions;
@FunctionLibrary("AtkLoginFuncLib") lib.AtkLoginFuncLib atkLoginFuncLib;
@FunctionLibrary("PON_FunLib") lib.prc.pon.PON_FunLib pON_FunLib;
@FunctionLibrary("POCommonFunctions") lib.myCompany.myTeam.POCommonFunctions
pOCommonFunctions;
@FunctionLibrary("SaveDialogFuncLib") lib.common.oats.SaveDialogFuncLib
saveDialogFuncLib;
@FunctionLibrary("PrcLibFunctions") lib.myCompany.myTeam.PrcLibFunctions
prcLibFunctions;
@FunctionLibrary("PrcEmailLibFunctions")
lib.myCompany.myTeam.PrcEmailLibFunctions prcEmailLibFunctions;
@FunctionLibrary("Prc_Oats_RestServices") lib.Prc_Oats_RestServices
prc_Oats_RestServices;
@FunctionLibrary("PrcHCMUsersAction") lib.myCompany.myTeam.PrcHCMUsersAction
prcHCMUsersAction;
public void initialize() throws Exception {

/******************Get the xml file path************/


envFilePath = getSettings().get("env_file");
if(envFilePath == null)
{
//envFilePath = "F:\\FA_PROV_ENV\\dte_env\\
2023415204838_4387_60470773\\fusionapps_url_prc_ef_rrf_2_108253.xml";
envFilePath = "F:\\prc\\puschand\\optin.xml";
}
info("Environment File Used : "+envFilePath);

/******************Update playback settings************/


VUserSettings vus = getSettings();
UpdatePlaybackSettings ups = new
UpdatePlaybackSettings(web,vus,browser,envFilePath);

/******************Create objects for PRC Common Functions, XML Parser


and File Operations************/

prcObj = new PrcCommonFunctions(utilities,browser,ft,web,adf);


xmlObj = new PrcXmlParser(envFilePath);
fileObj = new FileOperations();

/******************Get v_sync and v_wait values from xml************/


xmlMap = xmlObj.urlmap;
info(xmlMap.get("atk_login_url"));

v_sync = Integer.parseInt(xmlMap.get("adfsync"))/1000; // as the


adfsync in xml is in milliseconds.
v_wait = Integer.parseInt(xmlMap.get("v_wait"));
envType = xmlMap.get("env_type");

/******************Import Data Sheet************/


absPath = getAbsolutePath();
excelSheetPath = absPath+"data\\"+envType.toLowerCase()+".xls";
dataSheetArray = new String[]{"dataSheet"};
dataSheetlist = Arrays.asList(dataSheetArray);
datatable.importSheets(excelSheetPath, dataSheetlist, true, false);
/******************Get curent repository name************/

strRepositoryName= getScriptPackage().getRepositoryName();
prodLibPath = xmlMap.get("FSM_PRODUCT_FUNCTION_LIBRARY");
/****************** existing browsers and launch a new one************/
browser.closeAllBrowsers();
browser.launch();

setErrorRecovery(WebErrorRecovery.ERR_WAIT_FOR_PAGE_TIMEOUT_ERROR,
ErrorRecoveryAction.Ignore);
}

public void run() throws Exception {

/*----- Optional Code for timestamp string to append to data being


created : START ------*/
/*----- DELETE THIS BLOCK IF NOT REQUIRED ----*/
// Get unique runInstance to append to the data created
getVariables().set("timeStamp", "{{@timestampsecs}}",
Variables.Scope.GLOBAL);
String runInstance = getVariables().get("timeStamp").toString();
info ("The runInstance for this run is : "+runInstance);

//To store PDF file


FileOperations f1 = new FileOperations();
autogenPath = f1.getAutogeneratedFilePath("PON_BIPONM_Exchange");
info("Autogenerated files are stored in the path : " + autogenPath);

String parentDirectoryPath = "F:\\PRC\\AutomationAssets\\


AutoGeneratedFiles\\PON\\PON_BIPONM_Exchange";
directoryPath = parentDirectoryPath+"\\"+runInstance+"\\";
File index = new File(directoryPath);

if (!index.exists())
{
index.mkdirs();
info("Negotiation Auto Generated Files Directory Path
"+index.getAbsolutePath());
}

directoryPath1 = parentDirectoryPath+"\\"+runInstance+"A\\";
File index1 = new File(directoryPath1);

if (!index.exists())
{
index.mkdirs();
info("Negotiation Auto Generated Files Directory Path
"+index.getAbsolutePath());
}

ItSecurityManager=datatable.getValue("dataSheet", 3 , "A").toString();
ItSecurityManagerPassword=datatable.getValue("dataSheet", 3 ,
"B").toString();
String atkUrl = xmlMap.get("atk_login_url");
HashMap<String, String> postResponse = new HashMap<String, String>();

//Buyer details
buyerUser1 = datatable.getValue("dataSheet", 2 , "A").toString();
buyerPwd1 = datatable.getValue("dataSheet", 2 , "B").toString();

//Rest credentials
String sPRCIntegrationUser=datatable.getValue("dataSheet", 4 ,
"A").toString();
String strPwd=datatable.getValue("dataSheet", 4 , "B").toString();

//Supplier details
supplierUser1=datatable.getValue("dataSheet", 5 , "A").toString();
supplierPwd=datatable.getValue("dataSheet", 5 , "B").toString();
supplierUser2=datatable.getValue("dataSheet", 6 , "A").toString();

//Procurement BU
procBU = datatable.getValue("dataSheet", 11 , "A").toString();

String dataFilePath1 = "F:\\PRC\\AutomationAssets\\Common\\


DO_NOT_DELETE\\brittle_setups.txt";
String emailPassword = fileObj.readData(dataFilePath1,
"PRC_Email_Password");

String Supplier1 = datatable.getValue("dataSheet", 16, "B").toString();

//String Supplier1Contact1ATK = datatable.getValue("dataSheet", 21,


"C").toString();
String Supplier1Contact1ATKLoginEmail = datatable.getValue("dataSheet",
16, "G").toString();

String CollaborationMember1 = datatable.getValue("dataSheet", 7,


"A").toString();
//String CollaborationMember1Contact1ATK =
datatable.getValue("dataSheet", 22, "C").toString();

String CollaborationMember2 = datatable.getValue("dataSheet", 8,


"A").toString();
String CollaborationMember2Contact1ATKLoginEmail =
datatable.getValue("dataSheet", 17, "G").toString();

String buyerContact1ATKLoginEmail = datatable.getValue("dataSheet", 18,


"G").toString();

dataPath=absPath + "data\\";
String closeDate;
JsonObject outPost, outGet;

String fileContentExpected="";
info("Reading data from txt file");
byte[] fileByteData =Files.readAllBytes(Paths.get(absPath+"data\\
NegHeader.csv"));
fileContentExpected = new
String(fileByteData,StandardCharsets.US_ASCII);

String[][]
strMsgData=pON_FunLib.fnGetDataFromExcel("PRC_PON_CreateNegotiation:Negotiation:Onl
ineMessages", "dataSheet", "RFQ1", excelSheetPath);

String attachmentProc="PRC_PON_CreateNegotiation:Attachments";

info("set email for Supplier Contact, Collaboration member, Buyer to


receive FYI BIP notification emails");
beginStep("Step 1: Set the email id from security console for
"+supplierUser1+ " , "+CollaborationMember2+", "+buyerUser1+" to receive FYI BIP
notification emails using REST");
{
String strProcedureName =
"PRC_POZ_Suppliers:CorrectSupplierContactEmail";
int
intNoOfIDRows=ponRRFCommonFunctions.fn_GetDataFromProcedure(strProcedureName,
"dataSheet", "ATK_UserContact", supplierContacts, excelSheetPath);
for (int i = 1; i <= intNoOfIDRows; i++){

String[] arrTempValues=strProcedureName.split(":");
String strPrefix = arrTempValues[arrTempValues.length - 1];
int intstrPostfix = i;

String SupplierID = strPrefix + "_" + "SupplierID" + "_" +


intstrPostfix;
String ContactID = strPrefix + "_" + "ContactID" + "_" + intstrPostfix;
String UserEmail = strPrefix + "_" + "UserEmail" + "_" + intstrPostfix;
String Supplier = strPrefix + "_" + "Supplier" + "_" + intstrPostfix;
String ContactName = strPrefix + "_" + "ContactName" + "_" +
intstrPostfix;

Supplier = supplierContacts.containsKey(Supplier) ?
supplierContacts.get(Supplier) : supplierContacts.get(null);
ContactName = supplierContacts.containsKey(ContactName) ?
supplierContacts.get(ContactName) : supplierContacts.get(null);
UserEmail = supplierContacts.containsKey(UserEmail) ?
supplierContacts.get(UserEmail) : supplierContacts.get(null);

boolean result= prcHCMUsersAction.updateEmailAddress(atkUrl,


ContactName,UserEmail);
if(!result)
{
reportFailure("Email Id of user " + ContactName + " is not
updated for supplier/collaboration member " +Supplier);
}
else {
info("Updated the email id of Supplier/Collaboration member
"+Supplier+" contact " + ContactName + " to " + UserEmail + " in the Security
Console");
}
}

}endStep();

info("Create RFQ draft negotiation using REST with a line, two


suppliers and two Collaboration members");
beginStep("Step 2: Create draft negotiation via Rest post service with
buyer "+buyerUser1+ " with collaboration members "+CollaborationMember1+" ,
"+CollaborationMember2);
{
POST_URL=prc_Oats_RestServices.fnRestUrl(atkUrl,
"/fscmRestApi/resources/latest/supplierNegotiations");
info("URL used to invoke POST for Negotiations REST service is: "
+ POST_URL);
HashMap<String, String> postInputData=new HashMap<String,
String>();
postInputData.put("url", POST_URL);
postInputData.put("userName", sPRCIntegrationUser);
postInputData.put("password",strPwd);
postInputData.put("operation", "POST");
String payLoadFilePath=absPath+"data\\CreateNegotiation.txt";

String reqPayload = pON_FunLib.readFile(payLoadFilePath);


postInputData.put("payload",reqPayload);

postResponse=prc_Oats_RestServices.prc_RestOperations(postInputData);
postResponseContent=postResponse.get("responseContent");
postResponseCode=postResponse.get("responseCode");
info("The response code is "+postResponseCode);
if(postResponseCode.equals("201"))
{
info("Rest POST Invocation is successful");
}
else
fail("Rest POST Invocation is failed, Expected is 201.
Actual Response code: "+postResponseCode);

outPost=prc_Oats_RestServices.fnGetJsonObject(postResponseContent, new
HashMap<String, String>());
negNumber =
outPost.get("Negotiation").toString().replaceAll("\"", "");
negTitle =
outPost.get("NegotiationTitle").toString().replaceAll("\"", "");
AuctionHeaderID =
outPost.get("AuctionHeaderId").toString().replaceAll("\"", "");
info("Negotiation Number is "+negNumber+", Negotiation Title is
"+negTitle+", Auction Header ID is "+AuctionHeaderID);

}endStep();

info("Buyer provides negotiation details for draft negotiation - Close


Date and publish");
beginStep("Step 3: Login with Buyer "+ buyerUser1+" and Navigate to
Negotiations" );
{
browser.launch();

setErrorRecovery(WebErrorRecovery.ERR_WAIT_FOR_PAGE_TIMEOUT_ERROR,
ErrorRecoveryAction.Ignore);
atkLoginFuncLib.atkLogin(buyerUser1 , buyerPwd1 , "Negotiations",
envFilePath);
info("Logged in as buyer: " +buyerUser1);
}
endStep();

beginStep("Step 4: Navigate to Manage Negotiations - Search for draft


Negotiation: "+negNumber);
{
//Search for Negotiation created in step2 using web service
ponRRFCommonFunctions.fnManageNegotiation(negNumber, procBU);

}
endStep();
beginStep("Step 5: Navigate to Overview train stop, Publish Negotiation
- "+negNumber+" and Verify Status");
{
//Click on the Negotiation Number hyperlink in Search Results

adf.table("{{obj.ManageNegotiations.SearchResults_Table}}").rowSelectByIndex(0); //
NOPMD Common function call
prcObj.prcWaitForPage(0,"*Negotiation*",v_sync);

adf.commandToolbarButton("{{obj.ManageNegotiations.Edit_CommandToolbarButton}}").cl
ickButton();
prcObj.prcWaitForPage(0,v_sync);

//Click on Overview train

adf.train("{{obj.EditNegTempOverview.VistedOrUnvisited_Train}}").clickNode("Unvisit
ed Step: Overview"); //NOPMD
prcObj.prcWaitForPage(v_sync);

//Click on Publish button


ponRRFCommonFunctions.fnPublishNegotiation(negNumber, procBU,
"Active");
prcObj.prcWaitForPage(0,v_sync);
}
endStep();

beginStep("Step 6: Category Manager Navigate to Negotiation summary and


Clicks on Messages");
{
//Navigate to Negotiation summary

ponRRFCommonFunctions.fnBuyerPortalNavigateToNegotiatonSummary(negNumber,
procBU);
prcObj.prcWaitForPage(0,v_sync);

//Click on Messages button

adf.commandButton("{{obj.Messages.NegotiationSummary_Messages_CommandButton}}").cli
ck(); //NOPMD function call
prcObj.prcWaitForPage(0,v_sync);
}
endStep();

String[] user={"Collaboration members - PON00006, PON00007", "Suppliers


- CVSuppA05, CV_SuppA03"} ;

for(int i=1;i<=2;i++)
{
beginStep("Step "+(7+(i-1))+": Send a Online message to "+user[i-1]);
{

title = "Online Messages: RFQ.*";


//Click on create message button

adf.commandToolbarButton("{{obj.Messages.Messages_Create_CommandToolbarButton}}").c
lickButton();
prcObj.prcWaitForPage(0,v_sync);

//select type as internal

adf.selectOneChoice("{{obj.Messages.SendMessage_MessageType_SelectOneChoice}}").sel
ect(strMsgData[i][0]);
prcObj.prcWaitForPage(0,title, v_sync);

//select To - All members=<Check>

adf.selectManyChoice("{{obj.Messages.SendMessage_To_SelectManyChoice}}").select(str
MsgData[i][1]);
prcObj.prcWaitForPage(0,title, v_sync);

//Enter subject

adf.inputText("{{obj.Messages.SendMessage_Subject_InputText}}").setValue(strMsgData
[i][3]);
prcObj.prcWaitForPage(0,title, v_sync);

//Enter Message content

adf.richTextEditor("{{obj.Messages.SendMessage_Message_RichTextEditor}}").setValue(
strMsgData[i][4]);
prcObj.prcWaitForPage(0,title, v_sync);

//Click on '+' icon beside attachments


info("Add Attachments in the Online message");

adf.commandImageLink(54,"{{obj.Messages.SendMessage_Attachment_Add_CommandImageLink
}}").click();
think(v_wait);
prcObj.prcWaitForPage(v_sync);
//Attach all required attachments
pON_FunLib.fnAddAttachments("H1", excelSheetPath,
attachmentProc);

//click on send button

adf.commandButton("{{obj.Messages.SendMessage_Send_CommandButton}}").click();
prcObj.prcWaitForPage(0,title,v_sync);

//Verify added message by verifying subject


String
strCellValue=pON_FunLib.fnGetCellValue(adf.treeTable("{{obj.Messages.Messages_TreeT
able}}"), 0, "Subject");
info(strCellValue);
if(strCellValue.contains(strMsgData[i][3]))
{
info("The online message is successfully submitted by the
Category manager to "+user[i-1]);
}
else
{
fail("The online message is not successfully submitted by
the Category manager to "+user[i+1]);
}
}
endStep();
}

beginStep("Step 9: Buyer LogOut - " + buyerUser1);


{
//Logout
prcObj.oracleSsoSignout();
browser.closeAllBrowsers();
}endStep();

info("Verify if supplier "+supplierUser2+" receives online message and


Attachment from buyer - In APP Online BIP message verification");
beginStep("Step 10: Login with Supplier " + supplierUser2);
{
browser.launch();

setErrorRecovery(WebErrorRecovery.ERR_WAIT_FOR_PAGE_TIMEOUT_ERROR,
ErrorRecoveryAction.Ignore);
atkLoginFuncLib.atkLogin(supplierUser2, supplierPwd, "Worklist*",
envFilePath);

}
endStep();

beginStep("Step 11: Verify Attachments in ONM BIP notification for the


supplier " + supplierUser2);
{
beginStep("Step 11a: Verifying All the Attachments in the BIP
Notification");
{
//**QANote=Verify that a notification is received with the
Subject "Online Message for Negotiation RFQ #RFQ1 (PONONMRFQ05_Sealed Neg
Communication) Was Received".
String searchText = "Online Message for Negotiation RFQ " +
negNumber + " ("+ negTitle +") Was Received%";
if (prcObj.worklistNotificationAction(searchText, "View",
envFilePath))
info("Notification: " + searchText + " is received");
else
reportFailure("Notification: " + searchText + " is not
displayed");

info("Verifying Attachments in the BIP Notification ");


verifyBIPAttachments("H1",
"PRC_PON_Negotiation:VerifyAttachments", excelSheetPath, null);
}
endStep();

beginStep("Step 11b: Verify Content of the Attachment - NegHeader.csv


in the ONM BIP notification");
{
String negAttachment = "NegHeader.csv";
boolean actionStatus = false;

//Verify Attachment Content


if
(web.element("/web:window[@index='1']/web:document[@index='0']/web:a[@text='*.csv']
").exists(v_sync, TimeUnit.SECONDS)) {
String actNegAttachment =
web.element("/web:window[@index='1']/web:document[@index='0']/web:a[@text='*.csv']"
).getDisplayText().trim();
prcLibFunctions.verifyCheckpoint("Verify '" + negAttachment
+ "' is present in the BIP In-App notification", negAttachment, actNegAttachment,
"a_contains_e");
}
else reportFailure("'Negotiation Attachment' is not present in
the BIP In-App notification ");

web.link("/web:window[@index='1']/web:document[@index='0']/web:a[@text='*.csv']").c
lick();
prcObj.prcWaitForPage(v_sync);

//Downloading the Attachment from the email


info("Downloading the Attachment from the email");
String filedownloadPath = directoryPath +
"NegHeaderDownloaded.csv";
info("Download path is "+filedownloadPath);
saveDialogFuncLib.saveFile(filedownloadPath, 0);
info("Text downloaded to location: "+filedownloadPath);
think(v_wait);
String csvContent="";
info("Reading data from downloaded csv file");
byte[] fileByte
=Files.readAllBytes(Paths.get(filedownloadPath));
csvContent = new
String(fileByte,StandardCharsets.US_ASCII);
info("textContent is :"+csvContent);

if(csvContent.contains(fileContentExpected)){
info("Expected text is displayed correctly in text file");
}
else{
reportFailure("Expected text is NOT displayed correctly in
text file");
}

web.window("/web:window[@index='1']").close();
prcObj.oracleSsoSignout();
}
endStep();

}
endStep();
beginStep("Step 12: Verify Received Online Message from the buyer - In
App");
{
atkLoginFuncLib.atkLogin(supplierUser2, supplierPwd, "Supplier
Portal", envFilePath);
//Navigate to View Active Negotiations
ponRRFCommonFunctions.fnViewActiveNegotiations(negNumber);

//Click on Negotiation Number

column=ponRRFCommonFunctions.fnGetColumnNumber("{{obj.ViewActiveNegotiations.Table}
}", "Negotiation");
((DOMElement)
(adf.table("{{obj.ViewActiveNegotiations.Table}}").getCellElement(0,
column).getElementsByTagName("a").get(0))).click();

//Click Button: Messages

adf.commandButton("{{obj.ViewActiveNegotiations.Messages_CommandButton}}").click();
prcObj.prcWaitForPage(0,v_sync);

//**QANote=Verify that When a negotiation is paused , a message


is created and sent to All participants
//**QANote=Verify that for the system generated online messages
when Pause/Resume happens, the date/time in the subject should have the time zone
as well.[CR # 107809]

adf.treeTable("{{obj.ViewActiveNegotiations.Messages_TreeTable}}").scrollToRow(2);
prcObj.prcWaitForPage(0,v_sync);
String strSubject =
ponRRFCommonFunctions.fnGetCellValue("{{obj.ViewActiveNegotiations.Messages_TreeTab
le}}", 1, "Subject", -1);

String strTo =
ponRRFCommonFunctions.fnGetCellValue("{{obj.ViewActiveNegotiations.Messages_TreeTab
le}}", 1, "To", -1);

if(strSubject.contains("Negotiation is Open for Bidding") &&


strTo.equalsIgnoreCase("All participants"))
info("Subject is verified , a message is sent to All
participants");
else
reportFailure("Subject is not verified");

//**Verify Message Content


String strMsgContent =
adf.richTextEditor("{{obj.ViewActiveNegotiations.Messages_Content_RichTextEditor}}"
).getAttribute("value").toString();
if(strMsgContent.contains("Please start placing your bid"))
info("Message Content is verified");
else
reportFailure("Message Content displayed incorrectly");

}
endStep();
beginStep("Step 13: Verify Online Message Attachments sent by the buyer
- In App ");
{
//*Verify Attachments
adf.commandLink("/web:window[@index='0' or @title='*View Active
Negotiations*']/web:document[@index='0' or
@name='uq7hp85vh']/web:ADFCommandLink[@absoluteLocator='*pt1:_FOr1:_FONSr2:MA*:AP1:
a2:attachmentMoreLink' or @text='(* more...)']").click();
prcObj.prcWaitForPage(0,v_sync);

ADFTable tb = adf.table("/web:window[@index='0' or @title='View


Active Negotiations*']/web:document[@index='0' or
@name='uq7hp85vh']/web:ADFTable[@absoluteLocator='*pt1:_FOr1:_FONSr2:MA*:AP1:a2:pop
ApplicationsTable:_ATp:popAttachmentTable']");

pON_FunLib.verifyAddedAttachments("H1","PRC_PON_Negotiation:VerifyAttachments",tb,e
xcelSheetPath);

//Click OK button in attachments window


adf.commandButton(188,"/web:window[@index='0' or @title='View
Active Negotiations*']/web:document[@index='0' or
@name='uq7hp85vh']/web:ADFCommandButton[@absoluteLocator='*pt1:_FOr1:_FONSr2:MA*:AP
1:a*:dc_cb1' or @text='OK']").click();
prcObj.prcWaitForPage(v_sync);

}
endStep();

beginStep("Step 14: Signout and close browser");


{
prcObj.oracleSsoSignout();
browser.closeAllBrowsers();
}
endStep();

info("Verify if supplier "+Supplier1+" receives online message and


Attachment from buyer - Email Online BIP message verification");

beginStep("Step 15: Login to Exchange Mail Account for - " +


Supplier1);
{
browser.launch();

setErrorRecovery(WebErrorRecovery.ERR_WAIT_FOR_PAGE_TIMEOUT_ERROR,
ErrorRecoveryAction.Ignore);

prcEmailLibFunctions.loginEmailMSExchange(Supplier1Contact1ATKLoginEmail,
emailPassword);
}
endStep();

beginStep("Step 16: Supplier Bidder ("+Supplier1+"): Receives email


notification");
{
String Subject = "FYI: Online Message for Negotiation RFQ " +
negNumber + " ("+ negTitle +") Was Received";
if(prcEmailLibFunctions.searchMailMSExchange(Subject)!=0)
{
info("Mail found. Email has been sent for online message .
[BR # 73228]");
}
else
{
reportFailure("Mail not found.User Should receive email
with the subject 'Online Message for Negotiation RFQ #RFQ1(Negotiation is Open for
Bidding) Was Received'. [BR # 73228]");
}

prcEmailLibFunctions.openEmailByIndexMSExchange(1);

String EmailContent =
prcEmailLibFunctions.getEmailContentByIndexMSExchange(0);
//Remove unneccessary data from the extracted email content
String[] splitEmailContent = EmailContent.split(">");
String actualEmailContent =
splitEmailContent[1].toString().trim();
info("actualEmailContent is : "+ actualEmailContent);
String expectedEmailContent="(.*)Online Message(.*)Subject
Negotiation is Open for BiddingRFQ(.*)PON_BIPONMSGS_AttachmentClose Date (.*)Reply
to MessagePlease start placing your bid(.*)Submitted(.*)PON00005(.*)Reply to
Message";

int dot=Pattern.DOTALL;
Pattern p=Pattern.compile(expectedEmailContent, dot);
Matcher mt=p.matcher(actualEmailContent);
boolean emailContentVerification= mt.matches();

if(emailContentVerification)
{
info("Message subject and content in the email is verified.
[BR # 73226] ");
}
else
{
reportFailure("Message subject and content in the email are
not as expected. Actual:" + actualEmailContent +" Expected : " +
expectedEmailContent);
}

web.window("/web:window[@index='1']").capturePage(); // NOPMD
Capturing screenshot
}
endStep();

beginStep("Step 17: Supplier Bidder ("+Supplier1+"): Receives


Attachments in the email notification)");
{
info("Verifying Attachments in the BIP Notification");
verifyBIPAttachments("H1",
"PRC_PON_Negotiation:VerifyAttachments", excelSheetPath, null);

info("Verifying Content of the Attachment - NegHeader.csv in the


Email Notification");
String fileName =
prcEmailLibFunctions.getAttachmentNameMSExchange();
String fNameSplitted = fileName.split("csv")[0];
fNameSplitted=fNameSplitted+"csv";
System.out.println("filename to validate from Email :
"+fNameSplitted);
prcEmailLibFunctions.getEmailAttachmentMSExchange(fNameSplitted,
parentDirectoryPath, runInstance);
String downloadPath = directoryPath+fNameSplitted;
info("csv file downloaded to location: " + downloadPath);

//
String fileContentFromEmail="";
info("Reading data from csv file");
byte[] fileByteData1
=Files.readAllBytes(Paths.get(downloadPath));
fileContentFromEmail = new
String(fileByteData1,StandardCharsets.US_ASCII);

info("Validating the file content");


if(fileContentFromEmail.equals(fileContentExpected))
{
info("Downloaded file : "+fNameSplitted+" content is as
expected");
}
else fail("File content is not matched or corrupted ");

prcEmailLibFunctions.emailActionMSExchange("Reply to Message",
"");
}
endStep();

beginStep("Step 18: Logout from Exchange Email Client");


{
info("Logging out of Exchange and closing the tab");
web.window("/web:window[@index='0']").capturePage(); //
NOPMD Capturing screenshot
web.window("/web:window[@index='0']").close();// NOPMD -
Webobject. Used waitForObject
web.window("/web:window[@index='0']").close();// NOPMD -
Webobject. Used waitForObject
browser.closeAllBrowsers();
}
endStep();

info("Verify if Collaboration member "+CollaborationMember1+" receives


online message and Attachment from buyer - In App Online message verification");

beginStep("Step 19: Login with Team Member "+CollaborationMember1 , 0);


{
browser.launch();

setErrorRecovery(WebErrorRecovery.ERR_WAIT_FOR_PAGE_TIMEOUT_ERROR,
ErrorRecoveryAction.Ignore);
//String
collabarationMember1="PON00006",collabarationMember2="PON00007";
//Login to ATK
atkLoginFuncLib.atkLogin(CollaborationMember1, buyerPwd1,
"Negotiations", envFilePath);
}
endStep();

beginStep("Step 20: Navigate to negotiation Summary " +negNumber, 0);


{

//Navigate to negotiation summary

ponRRFCommonFunctions.fnBuyerPortalNavigateToNegotiatonSummary(negNumber,
"Vision Operations");

//click on messages button

adf.commandButton("{{obj.Messages.NegotiationSummary_Messages_CommandButton}}").cli
ck();
prcObj.prcWaitForPage(0,v_sync);
}
endStep();

beginStep("Step 21:Verify Collaboration member :


"+CollaborationMember1+" received online message sent by Category Manager - In
App");
{
title="Online Messages: RFQ.*";

messageTable=adf.treeTable("{{obj.Messages.Messages_TreeTable}}");

messageTable.expandCollapse("Expand", "2");
prcObj.prcWaitForPage(0,title,v_sync); //NOPMD table Object

//select the second message(to All members)


messageTable.rowSelect("3");
prcObj.prcWaitForPage(0,title,v_sync); //NOPMD table Object

boolean isSubjectPresent, isStatusPresent, isFromPresent;

String expectedSubjectTextForCollaborationMember =
strMsgData[1][3];
info("Expected subject text for Collaboration Member
"+expectedSubjectTextForCollaborationMember);

String expectedFromTextForCollaborationMember = strMsgData[1][5];


info("Expected From text for Collaboration Member
"+expectedFromTextForCollaborationMember);

//String expectedStatusTextForSecondRow = strMsgData[1][6];


String expectedStatusTextForCollaborationMember = strMsgData[1]
[6];
info("Expected status text for Collaboration Member
"+expectedStatusTextForCollaborationMember);

String expectedContentForCollaborationMember = strMsgData[1][4];


info("Expected content of the Collaboration Member message
received from category manager is : "+expectedContentForCollaborationMember);
//Verify message content for second message(to All members)
web.assertText("Message Content",
expectedContentForCollaborationMember, Source.DisplayContent,
TextPresence.PassIfPresent, MatchOption.Exact);

//Verify Msg Subject for second message(to All members)


String
actualSubjectTextForCollaborationMember=pON_FunLib.fnGetCellValue(messageTable, 3,
"Subject");
info("Actual Subject Text for Collaboration Member message :
"+actualSubjectTextForCollaborationMember);

isSubjectPresent=actualSubjectTextForCollaborationMember.contains(expectedSubjectTe
xtForCollaborationMember);

//Verify Msg Status for second message(to All members)

actualSubjectTextForCollaborationMember=pON_FunLib.fnGetCellValue(messageTable, 3,
"Status");
info("Actual status Text for Collaboration Member :
"+actualSubjectTextForCollaborationMember);

isStatusPresent=
actualSubjectTextForCollaborationMember.contains(expectedStatusTextForCollaboration
Member);

//Verify Msg From for second message(to All members)

actualSubjectTextForCollaborationMember=pON_FunLib.fnGetCellValue(messageTable, 3,
"From");
info("Actual From Text for Collaboration Member :
"+actualSubjectTextForCollaborationMember);

isFromPresent=
actualSubjectTextForCollaborationMember.contains(expectedFromTextForCollaborationMe
mber);

if(isSubjectPresent && isStatusPresent && isFromPresent)


{
info("The internal user is able to view the second message
sent by the category manager");
}
else
{
info("isSubjectPresent: "+isSubjectPresent);
info("isStatusPresent: "+isStatusPresent);
info("isFromPresent: "+isFromPresent);
reportFailure("The internal user is not able to view the
second message sent by the category manager");
}
}
endStep();

beginStep("Step 22: Verify Collaboration member :


"+CollaborationMember1+" Received the ONM Attachments - In App");
{
//*Verify Attachments
adf.commandLink("/web:window[@index='0' or @title='*View Active
Negotiations*']/web:document[@index='0' or
@name='uq7hp85vh']/web:ADFCommandLink[@absoluteLocator='*pt1:_FOr1:_FONSr2:MA*:AP1:
a2:attachmentMoreLink' or @text='(* more...)']").click();
prcObj.prcWaitForPage(0,v_sync);

ADFTable tb = adf.table("/web:window[@index='0' or @title='Online


Messages*']/web:document[@index='0' or
@name='clyd6c1jq']/web:ADFTable[@absoluteLocator='*pt1:_FOr1:_FONSr2:MA*:r1:AP1:a1:
popApplicationsTable:_ATp:popAttachmentTable']");

pON_FunLib.verifyAddedAttachments("H1","PRC_PON_Negotiation:VerifyAttachments",tb,e
xcelSheetPath);

}
endStep();

beginStep("Step 23: "+ CollaborationMember1 +" - Sign Out");


{
prcObj.oracleSsoSignout();
browser.closeAllBrowsers();
}
endStep();

info("Verify if Collaboration member : "+CollaborationMember2+"


receives online message and Attachment from buyer - Email Online BIP message
verification");
beginStep("Step 24: Login to Exchange Mail Account " +
CollaborationMember2);
{

browser.launch();

setErrorRecovery(WebErrorRecovery.ERR_WAIT_FOR_PAGE_TIMEOUT_ERROR,
ErrorRecoveryAction.Ignore);

prcEmailLibFunctions.loginEmailMSExchange(CollaborationMember2Contact1ATKLoginEmail
, emailPassword);

}
endStep();

beginStep("Step 25: Verify Collaboration member


"+CollaborationMember2+" : Receives email notification");
{
String Subject = "FYI: Online Message for Negotiation RFQ "
+ negNumber + " ("+ negTitle +") Was Received";

if(prcEmailLibFunctions.searchMailMSExchange(Subject)!=0)
{
info("Mail found. Email has been sent for online
message .[BR # 73228]");
}
else
{
reportFailure("Mail not found.User Should receive
email with the subject 'Online Message for Negotiation RFQ #RFQ1(Team,Please check
if i missed inviting any other suppliers.Regards,PRC PON00005) Was Received'. [BR #
73228]");
}

prcEmailLibFunctions.openEmailByIndexMSExchange(1);
String EmailContent =
prcEmailLibFunctions.getEmailContentByIndexMSExchange(0);
//Remove unneccessary data from the extracted email content
String[] splitEmailContent = EmailContent.split(">");
String actualEmailContent =
splitEmailContent[1].toString().trim();
info("actualEmailContent is : "+ actualEmailContent);
String expectedEmailContent="(.*)Online Message(.*)Subject
Review the list of Invited SuppliersRFQ(.*)PON_BIPONMSGS_AttachmentClose Date
(.*)Reply to MessageTeam,Please check if i missed inviting any other
suppliers.Regards,PRC PON00005(.*)Submitted(.*)PON00005(.*)Reply to Message(.*)";
int dot=Pattern.DOTALL;
Pattern p=Pattern.compile(expectedEmailContent, dot);
Matcher mt=p.matcher(actualEmailContent);
boolean emailContentVerification= mt.matches();

if(emailContentVerification)
{
info("Message subject and content in the email is
verified.[BR # 73226] ");
}
else
{
reportFailure("Message subject and content in the
email are not as expected. Actual:" + actualEmailContent +" Expected : " +
expectedEmailContent);
}

web.window("/web:window[@index='1']").capturePage(); //
NOPMD Capturing screenshot
}
endStep();

beginStep("Step 26: Verify "+CollaborationMember2+" : Receives


Attachments in the email notification");
{
info("Verifying Attachments in the BIP Notification");
verifyBIPAttachments("H1",
"PRC_PON_Negotiation:VerifyAttachments", excelSheetPath, null);

info("Verifying Content of the Attachment - NegHeader.csv in the


Email Notification");
String fileName =
prcEmailLibFunctions.getAttachmentNameMSExchange();
String fNameSplitted = fileName.split("csv")[0];
fNameSplitted=fNameSplitted+"csv";
System.out.println("filename to validate from Email :
"+fNameSplitted);
prcEmailLibFunctions.getEmailAttachmentMSExchange(fNameSplitted,
parentDirectoryPath, runInstance+"A");
String downloadPath = directoryPath1+fNameSplitted;
info("csv file downloaded to location: " + downloadPath);
//
String fileContentFromEmail="";
info("Reading data from csv file");
byte[] fileByteData1 =
Files.readAllBytes(Paths.get(downloadPath));
fileContentFromEmail = new
String(fileByteData1,StandardCharsets.US_ASCII);

info("Validating the file content");


if(fileContentFromEmail.equals(fileContentExpected))
{
info("Downloaded file : "+fNameSplitted+" content is as
expected");
}
else fail("File content is not matched or corrupted ");

prcEmailLibFunctions.emailActionMSExchange("Reply to Message",
"");

}
endStep();

beginStep("Step 27: Logout from Exchange Email Client");


{
info("Logging out of Exchange and closing the tab");
web.window("/web:window[@index='0']").capturePage(); // NOPMD
Capturing screenshot
web.window("/web:window[@index='0']").close();// NOPMD -
Webobject. Used waitForObject
web.window("/web:window[@index='0']").close();// NOPMD -
Webobject. Used waitForObject
think(60);
}
endStep();

info("Verify if Collaboration member : "+CollaborationMember2+" reply


with online message and Attachment to the buyer ");

beginStep("Step 28: Login as CollaborationMember


("+CollaborationMember2+"): and clicking on Message details link");
{

//atkLoginFuncLib.atkLogin(CollaborationMember2, buyerPwd1,
"Negotiations", envFilePath);

web.textBox("/web:window[@index='0' or @title='Sign
In']/web:document[@index='0' or @name='_afr_init_']/web:form[@id='Login' or
@name='loginForm' or @index='0']/web:input_text[@id='userid' or @name='userid' or
@index='0']") // NOPMD -Webobject. Used waitForObject
.click();
web.waitForObject("/web:window[@index='0' or @title='Sign
In']/web:document[@index='0' or @name='_afr_init_']/web:form[@id='Login' or
@name='loginForm' or @index='0']/web:input_text[@id='userid' or @name='userid' or
@index='0']", v_sync);
web.textBox("/web:window[@index='0' or @title='Sign
In']/web:document[@index='0' or @name='_afr_init_']/web:form[@id='Login' or
@name='loginForm' or @index='0']/web:input_text[@id='userid' or @name='userid' or
@index='0']") // NOPMD -Webobject. Used waitForObject
.setText(CollaborationMember2);// NOPMD -Webobject. Used
waitForObject
web.waitForObject("/web:window[@index='0' or @title='Sign
In']/web:document[@index='0' or @name='_afr_init_']/web:form[@id='Login' or
@name='loginForm' or @index='0']/web:input_text[@id='userid' or @name='userid' or
@index='0']", v_sync);
web.textBox("/web:window[@index='0' or @title='Sign
In']/web:document[@index='0' or @name='_afr_init_']/web:form[@id='Login' or
@name='loginForm' or @index='0']/web:input_password[@id='password' or
@name='password' or @index='0']") // NOPMD -Webobject. Used waitForObject
.click();// NOPMD -Webobject. Used waitForObject
web.waitForObject("/web:window[@index='0' or @title='Sign
In']/web:document[@index='0' or @name='_afr_init_']/web:form[@id='Login' or
@name='loginForm' or @index='0']/web:input_text[@id='userid' or @name='userid' or
@index='0']", v_sync);
web.window("/web:window[@index='0']").capturePage();
web.textBox("/web:window[@index='0' or @title='Sign
In']/web:document[@index='0' or @name='_afr_init_']/web:form[@id='Login' or
@name='loginForm' or @index='0']/web:input_password[@id='password' or
@name='password' or @index='0']") // NOPMD -Webobject. Used waitForObject
.setPassword(deobfuscate("K87dmNfs7WidxZ7WgOniWw=="));// NOPMD -
Webobject. Used waitForObject
web.waitForObject("/web:window[@index='0' or @title='Sign
In']/web:document[@index='0' or @name='_afr_init_']/web:form[@id='Login' or
@name='loginForm' or @index='0']/web:input_text[@id='userid' or @name='userid' or
@index='0']", v_sync);
web.button("/web:window[@index='0' or @title='Sign
In']/web:document[@index='0' or @name='_afr_init_']/web:form[@id='Login' or
@name='loginForm' or @index='0']/web:button[@name='btnActive' or @index='0']") //
NOPMD -Webobject. Used waitForObject
.click();// NOPMD -Webobject. Used waitForObject
web.window("/web:window[@index='0']").capturePage();
think(60);
String PageTitle=web.window("/web:window[@index='0' or
@title='*Oracle*']").getTitle().toString();
info("");
String ExpTitle = "Online Messages: RFQ " + negNumber;

if (PageTitle.contains(ExpTitle))
{
info("After clicking on Message details link a new tab is
opened with appropriate title[BR # 73223]");
}
else
{
reportFailure("After clicking on Message details link a new
tab should be opened with appropriate title[BR # 73223]. Expected: " + ExpTitle + "
Actual: " + PageTitle);
}
}
endStep();

beginStep("Step 29: "+CollaborationMember2+" : Replies with Attachments to


the message received");
{

adf.commandButton("{{obj.Messages.Details_Reply_CommandButton}}").click();//
NOPMD -Webobject. Used waitForObject
prcObj.prcWaitForPage(0,v_sync);

String Message1="I have received your invite.";

//ponRRFCommonFunctions.SendMessage("", "", Message1);


//prcObj.prcWaitForPage(0,v_sync);

String
ExistingText=adf.richTextEditor("{{obj.ViewActiveNegotiations.Message_RichTextEdito
r}}").getAttribute("value").toString();
if(ExistingText!="")
{
Message1=Message1.concat(ExistingText);
}

adf.richTextEditor("{{obj.ViewActiveNegotiations.Message_RichTextEditor}}").setValu
e(Message1);
prcObj.prcWaitForPage(0,v_sync);

//Click on '+' icon beside attachments

adf.commandImageLink(54,"{{obj.Messages.SendMessage_Attachment_Add_CommandImageLink
}}").click();
think(v_wait);
prcObj.prcWaitForPage(v_sync);
//Attach all required attachments
pON_FunLib.fnAddAttachments("L1", excelSheetPath,
"PRC_PON_TMtoBuyer:Attachments");

adf.commandButton("{{obj.ViewActiveNegotiations.MessagesPopup_Send_CommandButton}}"
).click();
prcObj.prcWaitForPage(0,v_sync);

}
endStep();

beginStep("Step 25: Signout");


{
prcObj.oracleSsoSignout();
browser.closeAllBrowsers();
}
endStep();

info("Verify if Buyer receives reply message and ONM Attachment from


collaboration member - In App BIP reply message verification");
beginStep("Step 30: Login with Category manager "+buyerUser1 , 0);
{

browser.launch();

setErrorRecovery(WebErrorRecovery.ERR_WAIT_FOR_PAGE_TIMEOUT_ERROR,
ErrorRecoveryAction.Ignore);
//String
collabarationMember1="PON00006",collabarationMember2="PON00007";
//Login to ATK
atkLoginFuncLib.atkLogin(buyerUser1, buyerPwd1, "Worklist*",
envFilePath);
}
endStep();

beginStep("Step 31: Verify Attachment in ONM BIP notification for the


buyer : "+buyerUser1);
{
beginStep("Step 31a: Verify All the Attachments in ONM BIP
notification for the buyer : "+buyerUser1);
{
//**QANote=Verify that a notification is received with the
Subject "Online Message for Negotiation RFQ #RFQ1 (PONONMRFQ05_Sealed Neg
Communication) Was Received".
String searchText = "Online Message for Negotiation RFQ " +
negNumber + " ("+ negTitle +") Was Received%";
if (prcObj.worklistNotificationAction(searchText, "View",
envFilePath))
info("Notification: " + searchText + " is received");
else
reportFailure("Notification: " + searchText + " is
not displayed");

info("Verifying All the Attachments in the BIP Notification


");
verifyBIPAttachments("L1", "PRC_PON_TMtoBuyer:Attachments",
excelSheetPath, null);

}
endStep();

beginStep("Step 31b: Verify Content of the Attachment in the ONM


BIP notification");
{
String negAttachment = "Text_Attachment.txt";

boolean actionStatus = false;


//Verify Attachment Content
if
(web.element("/web:window[@index='1']/web:document[@index='0']/web:a[@text='*.txt']
").exists(v_sync, TimeUnit.SECONDS)) {
String actNegAttachment =
web.element("/web:window[@index='1']/web:document[@index='0']/web:a[@text='*.txt']"
).getDisplayText().trim();
prcLibFunctions.verifyCheckpoint("Verify '" + negAttachment
+ "' is present in the BIP In-App notification", negAttachment, actNegAttachment,
"a_contains_e");
}
else reportFailure("'Negotiation Attachment' is not present
in the BIP In-App notification ");

web.link("/web:window[@index='1']/web:document[@index='0']/web:a[@text='*.txt']").c
lick();
prcObj.prcWaitForPage(v_sync);

//Downloading the Attachment from the email


info("Downloading the Attachment from the email");
String filedownloadPath = directoryPath +
"Text_AttachmentDownloaded.txt";
info("Download path is "+filedownloadPath);
saveDialogFuncLib.saveFile(filedownloadPath, 0);
info("csv downloaded to location: "+filedownloadPath);
think(v_wait);
String textContent="";
info("Reading data from downloaded csv file");
byte[] fileByte
=Files.readAllBytes(Paths.get(filedownloadPath));
textContent = new
String(fileByte,StandardCharsets.US_ASCII);
info("textContent is :"+textContent);

if(textContent.contains("Testing text file")){


info("Expected text is displayed correctly in text
file");
}
else{
reportFailure("Expected text is NOT displayed
correctly in text file");
}

web.window("/web:window[@index='1']").close();

}
endStep();

}
endStep();

beginStep("Step 32: Navigate to negotiation Summary "+negNumber, 0);


{
atkLoginFuncLib.loadWorkArea("Negotiations");
//Navigate to negotiation summary

ponRRFCommonFunctions.fnBuyerPortalNavigateToNegotiatonSummary(negNumber,
"Vision Operations");

//click on messages button

adf.commandButton("{{obj.Messages.NegotiationSummary_Messages_CommandButton}}").cli
ck();
prcObj.prcWaitForPage(0,v_sync);
}
endStep();

beginStep("Step 33: Verify/View the received message sent by team


member to Category Manager");
{
title="Online Messages: RFQ.*";

messageTable=adf.treeTable("{{obj.Messages.Messages_TreeTable}}");
messageTable.expandCollapse("Expand", "1");
prcObj.prcWaitForPage(0,title,v_sync); //NOPMD table Object

//select the second message(to All members)


messageTable.rowSelect("1");
prcObj.prcWaitForPage(0,title,v_sync); //NOPMD table Object

boolean isSubjectPresent, isStatusPresent, isFromPresent;

String expectedSubjectTextForSecondRow = strMsgData[3][3];


info("Expected Subject text for reply message
"+expectedSubjectTextForSecondRow);

String expectedFromTextForSecondRow = strMsgData[3][5];


info("Expected From text for reply message
"+expectedFromTextForSecondRow);

//String expectedStatusTextForSecondRow = strMsgData[1][6];


String expectedStatusTextForSecondRow = strMsgData[3][6];
info("Expected status text for reply message
"+expectedStatusTextForSecondRow);

String expectedContentForSecondRow = strMsgData[3][4];


info("Expected content of the reply message received from category
manager is : "+expectedContentForSecondRow);
//Verify message content for second message(to All members)
web.assertText("Message Content", expectedContentForSecondRow,
Source.DisplayContent, TextPresence.PassIfPresent, MatchOption.Exact);

//Verify Msg Subject for second message(to All members)


String
actualSubjectTextForSecondMessage=pON_FunLib.fnGetCellValue(messageTable, 1,
"Subject");
info("Actual Subject Text for reply message :
"+actualSubjectTextForSecondMessage);

isSubjectPresent=actualSubjectTextForSecondMessage.contains(expectedSubjectTextForS
econdRow);

//Verify Msg Status for second message(to All members)

actualSubjectTextForSecondMessage=pON_FunLib.fnGetCellValue(messageTable, 1,
"Status");
info("Actual status Text for reply message :
"+actualSubjectTextForSecondMessage);

isStatusPresent=
actualSubjectTextForSecondMessage.contains(expectedStatusTextForSecondRow);

//Verify Msg From for second message(to All members)

actualSubjectTextForSecondMessage=pON_FunLib.fnGetCellValue(messageTable, 1,
"From");
info("Actual From Text for reply message :
"+actualSubjectTextForSecondMessage);

isFromPresent=
actualSubjectTextForSecondMessage.contains(expectedFromTextForSecondRow);

if(isSubjectPresent && isStatusPresent && isFromPresent)


{
info("The category manager is able to view the reply
message sent by the collaboration member");
}
else
{
info("isSubjectPresent: "+isSubjectPresent);
info("isStatusPresent: "+isStatusPresent);
info("isFromPresent: "+isFromPresent);
reportFailure("The category manager is not able to view the
reply message sent by the collaboration member");
}
}
endStep();

beginStep("Step 34: Buyer LogOut - " + buyerUser1);


{
//Logout
prcObj.oracleSsoSignout();
browser.closeAllBrowsers();
}endStep();

info("Verify if buyer " + buyerUser1+" receives reply online message


and ONM Attachment from colloboration member - Email Online BIP message
verification");
beginStep("Step 35: Login to Exchange Mail Account for - " +
buyerUser1+" with "+buyerContact1ATKLoginEmail);
{

browser.launch();

setErrorRecovery(WebErrorRecovery.ERR_WAIT_FOR_PAGE_TIMEOUT_ERROR,
ErrorRecoveryAction.Ignore);

prcEmailLibFunctions.loginEmailMSExchange(buyerContact1ATKLoginEmail,
emailPassword);
}
endStep();

beginStep("Step 36: Verify Buyer ("+buyerContact1ATKLoginEmail+"):


Receives email notification");
{
String Subject = "FYI: Online Message for Negotiation RFQ " +
negNumber + " ("+ negTitle +") Was Received";
if(prcEmailLibFunctions.searchMailMSExchange(Subject)!=0)
{
info("Mail found. Email has been sent for online message .
[BR # 73228]");
}
else
{
reportFailure("Mail not found.User Should receive email
with the subject 'Online Message for Negotiation RFQ #RFQ1(Negotiation is Open for
Bidding) Was Received'. [BR # 73228]");
}
prcEmailLibFunctions.openEmailByIndexMSExchange(1);
String EmailContent =
prcEmailLibFunctions.getEmailContentByIndexMSExchange(0);
//Remove unneccessary data from the extracted email content
String[] splitEmailContent = EmailContent.split(">");
String actualEmailContent =
splitEmailContent[1].toString().trim();
info("actualEmailContent is : "+ actualEmailContent);
String expectedEmailContent="(.*)Online Message(.*)Subject Re:
Review the list of Invited SuppliersRFQ(.*)PON_BIPONMSGS_AttachmentClose Date
(.*)Reply to MessageI have received your invite.On(.*)PRC PON00005 wrote
Team,Please check if i missed inviting any other suppliers.Regards,PRC
PON00005(.*)Submitted(.*)PON00007(.*)Reply to Message(.*)";

int dot=Pattern.DOTALL;
Pattern p=Pattern.compile(expectedEmailContent, dot);
Matcher mt=p.matcher(actualEmailContent);
boolean emailContentVerification= mt.matches();

if(emailContentVerification)
{
info("Message subject and content in the email is verified.
[BR # 73226] ");
}
else
{
reportFailure("Message subject and content in the email are
not as expected. Actual:" + actualEmailContent +" Expected : " +
expectedEmailContent);
}

web.window("/web:window[@index='1']").capturePage(); // NOPMD
Capturing screenshot
}
endStep();

beginStep("Step 37: Verify Buyer "+buyerContact1ATKLoginEmail+"):


Receives Attachments in the email notification)");
{
info("Verifying All the Attachments in the Email Notification");
verifyBIPAttachments("L1", "PRC_PON_TMtoBuyer:Attachments",
excelSheetPath, null);

info("Verifying content of the Attachment - Supplier.txt");


String fileName =
prcEmailLibFunctions.getAttachmentNameMSExchange();
String fNameSplitted = fileName.split("pdf")[0];
fNameSplitted=fNameSplitted+"pdf";
System.out.println("filename to validate from Email :
"+fNameSplitted);
prcEmailLibFunctions.getEmailAttachmentMSExchange(fNameSplitted,
parentDirectoryPath, runInstance);
String downloadPath = directoryPath+fNameSplitted;
info("Pdf downloaded to location: " + downloadPath);

String PdfContent =
pOCommonFunctions.getPdfContent(downloadPath).replace("\n", "").replace("\r", "");
info("PdfContent " + PdfContent);
if(PdfContent.trim().contains("PON_BIPONMSGS"))
{
info("PDF contains title of negotiation");
}
else
reportFailure("PDF does not contain title of negotiation");

}
endStep();

beginStep("Step 38: Logout from Exchange Email Client");


{
info("Logging out of Exchange and closing the tab");
web.window("/web:window[@index='0']").capturePage(); //
NOPMD Capturing screenshot
web.window("/web:window[@index='0']").close();// NOPMD -
Webobject. Used waitForObject
web.window("/web:window[@index='0']").close();// NOPMD -
Webobject. Used waitForObject
//browser.closeAllBrowsers();
}
endStep();

}
public void finish() throws Exception {
// Capture screenshot before closing the browser

web.window("/web:window[@index='0']").capturePage();
//prcObj.oracleSsoSignout();
//browser.closeAllBrowsers();

//Updating emails of supplier contacts email ID's to discard email


String contact1=datatable.getValue("dataSheet", 16 , "C").toString();
String contact2=datatable.getValue("dataSheet", 17 , "C").toString();
String contact3=datatable.getValue("dataSheet", 18 , "C").toString();
String atkUrl = xmlMap.get("atk_login_url");

beginStep("Step 33: Final: Login as "+ItSecurityManager+" , navigate to


Security Console and update the email ID to discard email - to avoid flush of
mails");
{

boolean result1 =
prcHCMUsersAction.updateEmailAddressToSendMailTestDiscard(atkUrl,contact1);
if(!result1)
{
reportFailure("Email Id of " + contact1 + " is not
updated");
}

boolean result2 =
prcHCMUsersAction.updateEmailAddressToSendMailTestDiscard(atkUrl,contact2);
if(!result2)
{
reportFailure("Email Id of " + contact2 + " is not
updated");
}

boolean result3 =
prcHCMUsersAction.updateEmailAddressToSendMailTestDiscard(atkUrl,contact3);
if(!result3)
{reportFailure("Email Id of " + contact3 + " is not updated");
}

endStep();

public String getAbsolutePath() {


String strAbsolutePath=getScriptPackage().getScriptPath();
String strScriptName=getScriptPackage().getScriptName();
int strIndex=strAbsolutePath.lastIndexOf(strScriptName);
if(strIndex!=-1) {
strAbsolutePath=strAbsolutePath.substring(0, strIndex);
return(strAbsolutePath);
}
else {
return(null);
}
}

public void verifyBIPAttachments(String ID, String strProcedureName, String


excelSheetPath, String buyerPDFContents) throws Exception{
beginStep("Verify Added Attachments in BIP notification");
{
HashMap <String, String> P1=new HashMap<String, String>() ;
String strSheetName="dataSheet";

int
intNoOfIDRows=ponRRFCommonFunctions.fn_GetDataFromProcedure(strProcedureName,strShe
etName,ID,P1, excelSheetPath);

for(int intIterationCounter = 1;
intIterationCounter<=intNoOfIDRows; intIterationCounter++)
{
String[] arrTempValues=strProcedureName.split(":");
String strPrefix=arrTempValues[arrTempValues.length-1];
int intstrPostfix=intIterationCounter;

String name=strPrefix+"_"+"File
Name/URL"+"_"+intstrPostfix;
String title=strPrefix+"_"+"Title"+"_"+intstrPostfix;
String type=strPrefix+"_"+"Type"+"_"+intstrPostfix;

type=P1.containsKey(type) ? P1.get(type) : P1.get(null);


name=P1.containsKey(name) ? P1.get(name) : P1.get(null);
title=P1.containsKey(title) ? P1.get(title) : P1.get(null);

if (buyerPDFContents != null){
prcLibFunctions.verifyCheckpoint("Attachment included
in BIP Notification BuyerPDF ", title, buyerPDFContents, "a_contains_e");
} else {
//Verify to award approver attachment (0)
//Update post customer bug fix. Ref Bug #33689815
if(type.equals("Text"))
{
attachmentName= title + ".txt";
}
else if (type.equals("File")) {
attachmentName= name;
}
else if (type.equals("URL")) {
attachmentName= title;
}
else {
reportFailure("Please provide valid attachment
type");
}
verifyValueFromBIPNotification("Verify attachment",
attachmentName, "*" + attachmentName, webType.A);
}
}endStep();
}
}

public void verifyValueFromBIPNotification(String checkpointName, String


expectedValue, String searchElementValue, webType type) throws Exception{
if(expectedValue != ""){
String currentValue = "";
switch(type){
case A:
currentValue =
web.element("{{obj.WorkList.BIP_AwardApproval_Document}}" + "/web:a[@text='" +
searchElementValue + "']").getDisplayText();
break;
case B:
currentValue =
web.element("{{obj.WorkList.BIP_AwardApproval_Document}}" + "/web:b[@text='" +
searchElementValue + "']").getDisplayText();
break;
case SPAN:
currentValue =
web.element("{{obj.WorkList.BIP_AwardApproval_Document}}" + "/web:span[@text='" +
searchElementValue + "']").getDisplayText();
break;
case P:
currentValue =
web.element("{{obj.WorkList.BIP_AwardApproval_Document}}" + "/web:p[@text='" +
searchElementValue + "']").getDisplayText();
break;
case IMG:
// In this case we need to update expected value
since 'Alternate Line' text from excel can't be used
expectedValue = "data:image/png";
currentValue =
web.element("{{obj.WorkList.BIP_AwardApproval_Document}}" + "//web:img[@src='" +
searchElementValue + "']").getAttribute("src").toLowerCase();
break;
case H1:
currentValue =
web.element("{{obj.WorkList.BIP_AwardApproval_Document}}" + "/web:h1[@text='" +
searchElementValue + "']").getDisplayText();
break;
default:
fail("Provided type: " + type.toString() + " is not
part of the expected values");
}
prcLibFunctions.verifyCheckpoint(checkpointName, expectedValue,
currentValue, "a_contains_e");
}
}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy