public void verifyAllPDFCategoriesAppearOnPDFTemplates() { string[] username = null; string[] password = null; XMLParse oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSettings.xml"); username = oXMLData.getData("settings/Credentials", "username_corp"); password = oXMLData.getData("settings/Credentials", "password"); // Initializing the objects var executionLog = new ExecutionLog(); var loginHelper = new LoginHelper(GetWebDriver()); var corp_PDFTemplate_PDFCategoriesHelper = new CorpPDFTemplate_CategoriesHelper(GetWebDriver()); var corpPDFTemplate_TemplateHelper = new CorpPDFTemplate_TemplateHelper(GetWebDriver()); // Variable random String name = "Test" + GetRandomNumber(); String JIRA = ""; String Status = "Pass"; //try //{ executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Login with valid username and password"); Login(username[0], password[0]); Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Verify Page title"); VerifyTitle("Dashboard"); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Redirect To Categories"); VisitCorp("pdf_templates/categories"); corp_PDFTemplate_PDFCategoriesHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Verify page title"); VerifyTitle("PDF Categories"); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Click on Click create button"); corp_PDFTemplate_PDFCategoriesHelper.ClickJS("Create"); corp_PDFTemplate_PDFCategoriesHelper.WaitForWorkAround(1000); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Enter Name"); corp_PDFTemplate_PDFCategoriesHelper.TypeText("EnterName", name); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Click on Save Button"); corp_PDFTemplate_PDFCategoriesHelper.ClickJS("Save"); corp_PDFTemplate_PDFCategoriesHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Verify text present"); corp_PDFTemplate_PDFCategoriesHelper.WaitForText("Category Created Successfully", 5); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Redirect To PDF templates page"); VisitCorp("pdf_templates"); corpPDFTemplate_TemplateHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Verify category present in drop down"); corpPDFTemplate_TemplateHelper.VerifyText("SearchCategory", name); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Redirect To PDF templates page"); VisitCorp("pdf_templates/categories"); corp_PDFTemplate_PDFCategoriesHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Search and delete pdf."); corp_PDFTemplate_PDFCategoriesHelper.SearchAndClick(name); //corp_PDFTemplate_PDFCategoriesHelper.WaitForWorkAround(3000); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Select category to be replaced with."); corp_PDFTemplate_PDFCategoriesHelper.SelectDropDownByText("//*[@id='CategoryReplaceCategory']", "Other"); //corp_PDFTemplate_PDFCategoriesHelper.WaitForWorkAround(2000); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Click on save button."); corp_PDFTemplate_PDFCategoriesHelper.ClickDisplayed("//a[@title='Save']"); executionLog.Log("VerifyAllPDFCategoriesAppearOnPDFTemplates", "Category Replaced Successfully."); corp_PDFTemplate_PDFCategoriesHelper.WaitForText("Category Replaced Successfully.", 10); //} //catch (Exception e) //{ // executionLog.Log("Error", e.StackTrace); // Status = "Fail"; // String counter = executionLog.readLastLine("counter"); // String Description = executionLog.GetAllTextFile("VerifyAllPDFCategoriesAppearOnPDFTemplates"); // String Error = executionLog.GetAllTextFile("Error"); // Console.WriteLine(Error); // if (counter == "") // { // counter = "0"; // } // bool result = loginHelper.CheckExstingIssue("Verify All PDF Categories Appear On PDF Templates"); // if (!result) // { // if (Int16.Parse(counter) < 9) // { // executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); // loginHelper.CreateIssue("Verify All PDF Categories Appear On PDF Templates", "Bug", "Medium", "PDF Category page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); // string id = loginHelper.getIssueID("Verify All PDF Categories Appear On PDF Templates"); // TakeScreenshot("VerifyAllPDFCategoriesAppearOnPDFTemplates"); // string directoryName = loginHelper.GetnewDirectoryName(GetPath()); // var location = directoryName + "\\VerifyAllPDFCategoriesAppearOnPDFTemplates.png"; // loginHelper.AddAttachment(location, id); // } // } // else // { // if (Int16.Parse(counter) < 9) // { // executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); // TakeScreenshot("VerifyAllPDFCategoriesAppearOnPDFTemplates"); // string id = loginHelper.getIssueID("Verify All PDF Categories Appear On PDF Templates"); // string directoryName = loginHelper.GetnewDirectoryName(GetPath()); // var location = directoryName + "\\VerifyAllPDFCategoriesAppearOnPDFTemplates.png"; // loginHelper.AddAttachment(location, id); // loginHelper.AddComment(loginHelper.getIssueID("Verify All PDF Categories Appear On PDF Templates"), "This issue is still occurring"); // } // } // JIRA = loginHelper.getIssueID("Verify All PDF Categories Appear On PDF Templates"); // // executionLog.DeleteFile("Error"); // throw; //} //finally //{ // executionLog.DeleteFile("VerifyAllPDFCategoriesAppearOnPDFTemplates"); // executionLog.WriteInExcel("Verify All PDF Categories Appear On PDF Templates", Status, JIRA, "Corp PDF Templates"); //} }
public void createPDFCategories() { string[] username = null; string[] password = null; XMLParse oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSettings.xml"); // Initializing the objects var executionLog = new ExecutionLog(); var loginHelper = new LoginHelper(GetWebDriver()); var corpPDFTemplate_CategoriesHelper = new CorpPDFTemplate_CategoriesHelper(GetWebDriver()); username = oXMLData.getData("settings/Credentials", "username_corp"); password = oXMLData.getData("settings/Credentials", "password"); // Variable random String name = "Test" + GetRandomNumber(); String JIRA = ""; String Status = "Pass"; try { executionLog.Log("CreatePDFCategories", "Login with valid credential"); Login(username[0], password[0]); executionLog.Log("CreatePDFCategories", "Verify Page title"); VerifyTitle("Dashboard"); Console.WriteLine("Redirected at Dashboard screen."); executionLog.Log("CreatePDFCategories", "Click on Click On Partner Agent"); VisitCorp("pdf_templates/categories"); executionLog.Log("CreatePDFCategories", "Verify Page title"); VerifyTitle("PDF Categories"); executionLog.Log("CreatePDFCategories", "Click on Click create button"); corpPDFTemplate_CategoriesHelper.ClickElement("Create"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(2000); executionLog.Log("CreatePDFCategories", "Enter Name"); corpPDFTemplate_CategoriesHelper.TypeText("EnterName", name); executionLog.Log("CreatePDFCategories", "Click on Save Button"); corpPDFTemplate_CategoriesHelper.ClickElement("Save"); executionLog.Log("CreatePDFCategories", "Verify text present"); corpPDFTemplate_CategoriesHelper.WaitForText("PDF Categories", 10); } catch (Exception e) { executionLog.Log("Error", e.StackTrace); Status = "Fail"; String counter = executionLog.readLastLine("counter"); String Description = executionLog.GetAllTextFile("CreatePDFCategories"); String Error = executionLog.GetAllTextFile("Error"); Console.WriteLine(Error); if (counter == "") { counter = "0"; } bool result = loginHelper.CheckExstingIssue("Create PDF Categories"); if (!result) { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); loginHelper.CreateIssue("Create PDF Categories", "Bug", "Medium", "Pdf page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); string id = loginHelper.getIssueID("Create PDF Categories"); TakeScreenshot("CreatePDFCategories"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\CreatePDFCategories.png"; loginHelper.AddAttachment(location, id); } } else { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); TakeScreenshot("CreatePDFCategories"); string id = loginHelper.getIssueID("Create PDF Categories"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\CreatePDFCategories.png"; loginHelper.AddAttachment(location, id); loginHelper.AddComment(loginHelper.getIssueID("Create PDF Categories"), "This issue is still occurring"); } } JIRA = loginHelper.getIssueID("Create PDF Categories"); // executionLog.DeleteFile("Error"); throw; } finally { executionLog.DeleteFile("CreatePDFCategories"); executionLog.WriteInExcel("Create PDF Categories", Status, JIRA, "Corp PDF Template"); } }
public void pDFImpotWizard() { string[] username = null; string[] username1 = null; string[] password = null; var oXMLData = new XMLParse(); oXMLData.LoadXML("../../Config/ApplicationSettings.xml"); username = oXMLData.getData("settings/Credentials", "username_corp"); username1 = oXMLData.getData("settings/Credentials", "username_office"); password = oXMLData.getData("settings/Credentials", "password"); // Initializing the objects var executionLog = new ExecutionLog(); var loginHelper = new LoginHelper(GetWebDriver()); var pDFTemplate_ImportWizardHelper = new PDFTemplate_ImportWizardHelper(GetWebDriver()); var pDFTemplate_PDFTemplateHelper = new PDFTemplate_PDFTemplateHelper(GetWebDriver()); var corpPDFTemplate_ImportWizardHelper = new CorpPDFTemplate_ImportWizardHelper(GetWebDriver()); var corpPDFTemplate_CategoriesHelper = new CorpPDFTemplate_CategoriesHelper(GetWebDriver()); // Variable random var Category = "Category" + RandomNumber(1, 99999); var name = "TestMerchant" + GetRandomNumber(); var FilePth = GetPathToFile() + "real.pdf"; var InvalidFilePath = GetPathToFile() + "clientsamples(2).csv"; String JIRA = ""; String Status = "Pass"; try { executionLog.Log("PDFImpotWizard", "Login with valid username and password"); Login(username[0], password[0]); executionLog.Log("PDFImpotWizard", "Verify Page title"); VerifyTitle("Dashboard"); executionLog.Log("PDFImpotWizard", "Redirect at pdf categories pge."); VisitCorp("pdf_templates/categories"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Click Create PDF Template"); corpPDFTemplate_CategoriesHelper.ClickElement("Create"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Enter PDF NAME"); corpPDFTemplate_CategoriesHelper.TypeText("EnterName", Category); executionLog.Log("PDFImpotWizard", "Click on Save"); corpPDFTemplate_CategoriesHelper.ClickElement("Save"); executionLog.Log("PDFImpotWizard", "Wait for Confirmation"); corpPDFTemplate_CategoriesHelper.WaitForText("Category Created Successfully", 10); executionLog.Log("PDFImpotWizard", "Visit pdf Template import page"); VisitCorp("pdf_templates/import"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Select Module."); corpPDFTemplate_ImportWizardHelper.SelectByText("SelectModule", "Clients"); executionLog.Log("PDFImpotWizard", "Uplaod File"); corpPDFTemplate_ImportWizardHelper.UploadFile("//*[@id='PdfTemplatePdfFile']", FilePth); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(1000); executionLog.Log("PDFImpotWizard", "Click on Import"); corpPDFTemplate_ImportWizardHelper.ClickElement("Import"); executionLog.Log("PDFImpotWizard", "Wait for next button to appear."); corpPDFTemplate_ImportWizardHelper.WaitForElementPresent("ClickNextbtn", 10); executionLog.Log("PDFImpotWizard", "Click on Next"); corpPDFTemplate_ImportWizardHelper.ClickDisplayed("//button[@title='Next']"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Wait for Confirmation"); corpPDFTemplate_ImportWizardHelper.WaitForText("PDF fields mapped successfully.", 05); executionLog.Log("PDFImpotWizard", "Wait for next button to appear."); corpPDFTemplate_ImportWizardHelper.WaitForElementPresent("ClickNextBtn2", 10); executionLog.Log("PDFImpotWizard", "Click on Next button again"); corpPDFTemplate_ImportWizardHelper.ClickElement("ClickNextBtn2"); executionLog.Log("PDFImpotWizard", "Verify confirmation"); corpPDFTemplate_ImportWizardHelper.WaitForText("Signature Options saved successfully.", 10); executionLog.Log("PDFImpotWizard", "Select Category"); corpPDFTemplate_ImportWizardHelper.SelectByText("SelectCatory", "Card Service Agreements"); executionLog.Log("PDFImpotWizard", "Click on Save"); corpPDFTemplate_ImportWizardHelper.ClickElement("Save"); executionLog.Log("PDFImpotWizard", "Verif Confirmation"); corpPDFTemplate_ImportWizardHelper.WaitForText("PDF Template options saved successfully.", 10); executionLog.Log("PDFImpotWizard", "Visit pdf Template import page"); VisitCorp("pdf_templates/import"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Click Import"); corpPDFTemplate_ImportWizardHelper.ClickElement("Import"); //corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Wait for validation text."); corpPDFTemplate_ImportWizardHelper.WaitForText("This field is required.", 10); executionLog.Log("PDFImpotWizard", "Click on cancel."); corpPDFTemplate_ImportWizardHelper.ClickDisplayed("//a[@title='Cancel']"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Verify text on page."); corpPDFTemplate_ImportWizardHelper.VerifyText("VerifyTextPDFTemplatesHeader", "PDF Templates"); executionLog.Log("PDFImpotWizard", "Visit pdf Template import page"); VisitCorp("pdf_templates/import"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Select Module"); corpPDFTemplate_ImportWizardHelper.SelectByText("SelectModule", "Clients"); executionLog.Log("PDFImpotWizard", "Uplaod File"); corpPDFTemplate_ImportWizardHelper.UploadFile("//*[@id='PdfTemplatePdfFile']", InvalidFilePath); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(1000); executionLog.Log("PDFImpotWizard", "Click Import"); corpPDFTemplate_ImportWizardHelper.ClickElement("Import"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Accept alert message."); corpPDFTemplate_ImportWizardHelper.AcceptAlert(); executionLog.Log("PDFImpotWizard", "Logout from the application."); VisitCorp("logout"); executionLog.Log("PDFImpotWizard", "Login to the office module."); Login(username1[0], password[0]); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(2000); executionLog.Log("PDFImpotWizard", "Goto PDF Categories"); VisitOffice("pdf_templates/categories"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(4000); executionLog.Log("PDFImpotWizard", "Click Create PDF Template"); pDFTemplate_PDFTemplateHelper.ClickElement("ClickCreatePDFImp"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(1000); executionLog.Log("PDFImpotWizard", "Enter PDF Category Name"); pDFTemplate_PDFTemplateHelper.TypeText("EnterPDFCategoryName", Category); executionLog.Log("PDFImpotWizard", "Click on Save"); pDFTemplate_PDFTemplateHelper.ClickElement("PDFImportSave"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Goto pdf template import"); VisitOffice("pdf_templates/import"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Select Module"); pDFTemplate_ImportWizardHelper.SelectByText("SelectModule", "Clients"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(1000); executionLog.Log("PDFImpotWizard", "Upload file."); pDFTemplate_ImportWizardHelper.UploadFile("//*[@id='PdfTemplatePdfFile']", FilePth); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(1000); executionLog.Log("PDFImpotWizard", "Click Import PDF"); pDFTemplate_ImportWizardHelper.ClickElement("Import"); executionLog.Log("PDFImpotWizard", "Wait for next button to appear."); pDFTemplate_ImportWizardHelper.WaitForElementPresent("ClickNextbtn", 10); executionLog.Log("PDFImpotWizard", "Click Next button"); pDFTemplate_ImportWizardHelper.ClickElement("Next"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Verify Confirmation"); pDFTemplate_ImportWizardHelper.WaitForText("PDF fields mapped successfully.", 10); executionLog.Log("PDFImpotWizard", "Wait for next button to appear."); pDFTemplate_ImportWizardHelper.WaitForElementPresent("ClickNextBtn2", 10); executionLog.Log("PDFImpotWizard", "Click Next button"); pDFTemplate_ImportWizardHelper.ClickElement("ClickNextBtn2"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(3000); executionLog.Log("PDFImpotWizard", "Select Category."); pDFTemplate_ImportWizardHelper.SelectByText("Category", "Card Service Agreements"); corpPDFTemplate_CategoriesHelper.WaitForWorkAround(1000); executionLog.Log("PDFImpotWizard", "Click on Save"); pDFTemplate_ImportWizardHelper.ClickElement("Save"); executionLog.Log("PDFImpotWizard", "Wait for Confirmation"); pDFTemplate_ImportWizardHelper.WaitForText("PDF Template options saved successfully.", 10); } catch (Exception e) { executionLog.Log("Error", e.StackTrace); Status = "Fail"; String counter = executionLog.readLastLine("counter"); String Description = executionLog.GetAllTextFile("PDFImpotWizard"); String Error = executionLog.GetAllTextFile("Error"); Console.WriteLine(Error); if (counter == "") { counter = "0"; } bool result = loginHelper.CheckExstingIssue("PDF Impot Wizard"); if (!result) { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); loginHelper.CreateIssue("PDF Impot Wizard", "Bug", "Medium", "PDF page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error); string id = loginHelper.getIssueID("PDF Impot Wizard"); TakeScreenshot("PDFImpotWizard"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\PDFImpotWizard.png"; loginHelper.AddAttachment(location, id); } } else { if (Int16.Parse(counter) < 9) { executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString()); TakeScreenshot("PDFImpotWizard"); string id = loginHelper.getIssueID("PDF Impot Wizard"); string directoryName = loginHelper.GetnewDirectoryName(GetPath()); var location = directoryName + "\\PDFImpotWizard.png"; loginHelper.AddAttachment(location, id); loginHelper.AddComment(loginHelper.getIssueID("PDF Impot Wizard"), "This issue is still occurring"); } } JIRA = loginHelper.getIssueID("PDF Impot Wizard"); // executionLog.DeleteFile("Error"); throw; } finally { executionLog.DeleteFile("PDFImpotWizard"); executionLog.WriteInExcel("PDF Impot Wizard", Status, JIRA, "PDF Import"); } }