Exemplo n.º 1
0
        public void clientPDFInactive()
        {
            string[] username = null;
            string[] password = null;
            string[] log      = null;
            var      oXMLData = new XMLParse();

            oXMLData.LoadXML("../../Config/ApplicationSettings.xml");

            username = oXMLData.getData("settings/Credentials", "username_office");
            password = oXMLData.getData("settings/Credentials", "password");
            log      = oXMLData.getData("settings/URL", "logout");

            // Initializing the objects
            var executionLog = new ExecutionLog();
            var loginHelper  = new LoginHelper(GetWebDriver());
            var pDFTemplate_PDFTemplateHelper = new PDFTemplate_PDFTemplateHelper(GetWebDriver());
            var office_ClientsHelper          = new Office_ClientsHelper(GetWebDriver());

            // Variables
            string VerifyInactive = "//table[@id='list1']/tbody/tr[2]/td/a/i[contains(@class,'thumbs-o-up')]";
            string text           = "//table[@id='list1']/tbody/tr[2]/td/a[contains(@href,'view')]";
            String JIRA           = "";
            String Status         = "Pass";


            try
            {
                executionLog.Log("ClientPDFInactive", "Login with valid username and password");
                Login(username[0], password[0]);

                executionLog.Log("ClientPDFInactive", "Verify Page title");
                VerifyTitle("Dashboard");

                executionLog.Log("ClientPDFInactive", "Visit to PDF template page");
                VisitOffice("pdf_templates");

                executionLog.Log("ClientPDFInactive", "Verify title");
                VerifyTitle("PDF Templates");

                string PdfName = pDFTemplate_PDFTemplateHelper.GetText(text);
                if (!pDFTemplate_PDFTemplateHelper.IsElementPresent(VerifyInactive))
                {
                    executionLog.Log("ClientPDFInactive", "Make inactive pDF");
                    pDFTemplate_PDFTemplateHelper.ClickElement("InActivateSign");

                    executionLog.Log("ClientPDFInactive", "Accept alert message.");
                    pDFTemplate_PDFTemplateHelper.AcceptAlert();
                    pDFTemplate_PDFTemplateHelper.WaitForWorkAround(3000);
                }

                executionLog.Log("ClientPDFInactive", "Go to client page");
                VisitOffice("clients");

                executionLog.Log("ClientPDFInactive", "verify title");
                VerifyTitle();

                executionLog.Log("ClientPDFInactive", "Open client");
                office_ClientsHelper.ClickElement("Client1");

                executionLog.Log("ClientPDFInactive", "verify title");
                VerifyTitle(" - Details");

                executionLog.Log("ClientPDFInactive", "click on pdf tab");
                office_ClientsHelper.ClickElement("PDFTab");

                executionLog.Log("ClientPDFInactive", "verify title");
                VerifyTitle(" - Pdfs");

                executionLog.Log("ClientPDFInactive", "verify pdf not available");
                office_ClientsHelper.VerifyTextNotPresent(PdfName + ".pdf");

                executionLog.Log("ClientPDFInactive", "Log out from the application");
                VisitOffice("logout");
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("ClientPDFInactive");
                String Error       = executionLog.GetAllTextFile("Error");
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Client PDF Inactive");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Client PDF Inactive", "Bug", "Medium", "Partner page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Client PDF Inactive");
                        TakeScreenshot("ClientPDFInactive");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\ClientPDFInactive.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("ClientPDFInactive");
                        string id            = loginHelper.getIssueID("Client PDF Inactive");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\ClientPDFInactive.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Client PDF Inactive"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Client PDF Inactive");
                //      executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("ClientPDFInactive");
                executionLog.WriteInExcel("Client PDF Inactive", Status, JIRA, "PDF Import");
            }
        }
Exemplo n.º 2
0
        public void makeStatusActivePDFTemplate()
        {
            string[] username = null;
            string[] password = null;

            var oXMLData = new XMLParse();

            oXMLData.LoadXML("../../Config/ApplicationSettings.xml");

            username = 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_PDFTemplateHelper = new PDFTemplate_PDFTemplateHelper(GetWebDriver());


            // Variable random
            String Status = "Pass";
            String JIRA   = "";

            try
            {
                executionLog.Log("MakeStatusActivePDFTemplate", "Login with valid username and password");
                Login(username[0], password[0]);
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

                executionLog.Log("MakeStatusActivePDFTemplate", "Verify Page title");
                VerifyTitle("Dashboard");
                Console.WriteLine("Redirected at Dashboard screen.");

                executionLog.Log("MakeStatusActivePDFTemplate", "Redirect To pdf template");
                VisitOffice("pdf_templates");
                pDFTemplate_PDFTemplateHelper.WaitForWorkAround(3000);

                executionLog.Log("MakeStatusActivePDFTemplate", "Enter PDF TO sEARCH");
                pDFTemplate_PDFTemplateHelper.TypeText("EnterPDFToSearch", "2.pdf");
                pDFTemplate_PDFTemplateHelper.WaitForWorkAround(2000);

                executionLog.Log("MakeStatusActivePDFTemplate", "SelectModuleToSearch");
                pDFTemplate_PDFTemplateHelper.Select("SelectModuleToSearch", "merchants");
                pDFTemplate_PDFTemplateHelper.WaitForWorkAround(2000);

                var loc = "//table[@id='list1']/tbody/tr[2]";
                if (pDFTemplate_PDFTemplateHelper.IsElementPresent(loc))
                {
                    executionLog.Log("MakeStatusActivePDFTemplate", "Click on edit icon");
                    pDFTemplate_PDFTemplateHelper.ClickElement("ClickOnEdit");
                    pDFTemplate_PDFTemplateHelper.WaitForWorkAround(2000);

                    executionLog.Log("MakeStatusActivePDFTemplate", "Select status as Inactive.");
                    pDFTemplate_PDFTemplateHelper.Select("SelectStatusDeactive", "0");
                    pDFTemplate_PDFTemplateHelper.WaitForWorkAround(2000);

                    executionLog.Log("MakeStatusActivePDFTemplate", "Click Save button");
                    pDFTemplate_PDFTemplateHelper.ClickElement("SaveEdit");

                    executionLog.Log("MakeStatusActivePDFTemplate", "Verify message");
                    pDFTemplate_PDFTemplateHelper.WaitForText("PDF Template Updated Successfully.", 10);
                }
                else
                {
                    executionLog.Log("MakeStatusActivePDFTemplate", "Redirect To Import");
                    VisitOffice("pdf_templates/import");
                    pDFTemplate_PDFTemplateHelper.WaitForWorkAround(2000);

                    executionLog.Log("MakeStatusActivePDFTemplate", "ChooseModule");
                    pDFTemplate_PDFTemplateHelper.Select("SelectModule", "20");
                    pDFTemplate_PDFTemplateHelper.WaitForWorkAround(2000);

                    var path = GetPathToFile() + "2.pdf";
                    executionLog.Log("MakeStatusActivePDFTemplate", "Upload a pdf file.");
                    pDFTemplate_PDFTemplateHelper.UploadFile("//*[@id='PdfTemplatePdfFile']", path);

                    executionLog.Log("MakeStatusActivePDFTemplate", "Click import");
                    pDFTemplate_PDFTemplateHelper.ClickElement("Import");
                    pDFTemplate_PDFTemplateHelper.WaitForWorkAround(4000);

                    executionLog.Log("MakeStatusActivePDFTemplate", "ClickOnNext");
                    pDFTemplate_PDFTemplateHelper.ClickElement("ClickOnNext");

                    executionLog.Log("MakeStatusActivePDFTemplate", "Select Category");
                    pDFTemplate_PDFTemplateHelper.SelectByText("SelectCategory", "Other");

                    executionLog.Log("MakeStatusActivePDFTemplate", "Save");
                    pDFTemplate_PDFTemplateHelper.ClickElement("Save");

                    executionLog.Log("MakeStatusActivePDFTemplate", "Verify message");
                    pDFTemplate_PDFTemplateHelper.WaitForText("PDF Template options saved successfully.", 10);

                    executionLog.Log("MakeStatusActivePDFTemplate", "Enter PDF TO sEARCH");
                    pDFTemplate_PDFTemplateHelper.TypeText("EnterPDFToSearch", "2.pdf");
                    pDFTemplate_PDFTemplateHelper.WaitForWorkAround(2000);

                    executionLog.Log("MakeStatusActivePDFTemplate", "SelectModuleToSearch");
                    pDFTemplate_PDFTemplateHelper.Select("SelectModuleToSearch", "merchants");
                    pDFTemplate_PDFTemplateHelper.WaitForWorkAround(2000);

                    executionLog.Log("MakeStatusActivePDFTemplate", "Click on pdf");
                    pDFTemplate_PDFTemplateHelper.ClickElement("EditFirstTemplate");
                    pDFTemplate_PDFTemplateHelper.WaitForWorkAround(2000);

                    executionLog.Log("MakeStatusActivePDFTemplate", "Select status as active.");
                    pDFTemplate_PDFTemplateHelper.Select("SelectStatusDeactive", "1");

                    executionLog.Log("MakeStatusActivePDFTemplate", "Click on save button.");
                    pDFTemplate_PDFTemplateHelper.ClickElement("SaveEdit");

                    executionLog.Log("MakeStatusActivePDFTemplate", "Verify message");
                    pDFTemplate_PDFTemplateHelper.WaitForText("PDF Template Updated Successfully.", 10);
                }
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";
                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("MakeStatusActivePDFTemplate");
                String Error       = executionLog.GetAllTextFile("Error");
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Make Status Active PDF Template");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Make Status Active PDF Template", "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("Make Status Active PDF Template");
                        TakeScreenshot("MakeStatusActivePDFTemplate");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\MakeStatusActivePDFTemplate.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("MakeStatusActivePDFTemplate");
                        string id            = loginHelper.getIssueID("Make Status Active PDF Template");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\MakeStatusActivePDFTemplate.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Make Status Active PDF Template"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Make Status Active PDF Template");
                //    executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("MakeStatusActivePDFTemplate");
                executionLog.WriteInExcel("Make Status Active PDF Template", Status, JIRA, "PDF Template.");
            }
        }