public void permanentlyDeleteDocumentNewSkin()
        {
            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 officeActivities_DocumentHelper = new OfficeActivities_DocumentHelper(GetWebDriver());


            // Variable random
            var    name   = "TESTCLIENT" + RandomNumber(1, 999);
            String JIRA   = "";
            String Status = "Pass";

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

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

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Redirect To Document");
                VisitOffice("documents");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Click On Create");
                officeActivities_DocumentHelper.ClickElement("ClickOnDoc");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "ClickOnCreate");
                officeActivities_DocumentHelper.TypeText("Name", "DELETE DOCUMENT");
                string pathtofile = GetPathToFile() + "index.jpg";

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Attach File");
                officeActivities_DocumentHelper.UploadFile("//*[@id='DocumentFile']", pathtofile);

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Click on Save");
                officeActivities_DocumentHelper.ClickElement("Save");

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Verify message");
                officeActivities_DocumentHelper.WaitForText("Document saved successfully.", 05);
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Search Documet ");
                officeActivities_DocumentHelper.TypeText("SearchDocumet", "DELETE DOCUMENT");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Select All in owner field");
                officeActivities_DocumentHelper.SelectByText("OwnerField", "All");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Click on Checkbox");
                officeActivities_DocumentHelper.ClickElement("ClickOnCheckBox");

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Click On delete");
                officeActivities_DocumentHelper.ClickElement("ClickOndelete");

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Accept alert messsage.");
                officeActivities_DocumentHelper.AcceptAlert();

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Verify Document deleted successfully.");
                officeActivities_DocumentHelper.WaitForText("Document deleted successfully.", 10);

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Click on Recycle bin");
                officeActivities_DocumentHelper.ClickElement("ClickOnReycleBin");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Search Documet ");
                officeActivities_DocumentHelper.TypeText("SearchDocumet", "DELETE DOCUMENT");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Select All in owner field");
                officeActivities_DocumentHelper.SelectByText("OwnerField", "All");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "ClickOnDeletePer");
                officeActivities_DocumentHelper.ClickElement("ClickOnDeletePer");

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "Accept alert messsage.");
                officeActivities_DocumentHelper.AcceptAlert();
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("PermanentlyDeleteDocumentNewSkin", "verify Document Permanently Deleted.");
                officeActivities_DocumentHelper.WaitForText("Document Permanently Deleted.", 10);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

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

            XMLParse 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    officeActivities_DocumentHelper = new OfficeActivities_DocumentHelper(GetWebDriver());
            String JIRA   = "";
            String Status = "Pass";

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

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

                executionLog.Log("VerifyDocumentsOnEmailAttachment", "Redirect at documents page.");
                VisitOffice("documents");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                //officeActivities_DocumentHelper.TypeText("SearchDocumet", "Don't Delete");
                //officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyDocumentsOnEmailAttachment", "Click on any document");
                officeActivities_DocumentHelper.ClickElement("OpenDoc");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                //executionLog.Log("VerifyDocumentsOnEmailAttachment", "Wait for locator to present.");
                //officeActivities_DocumentHelper.WaitForElementPresent("EmailThisDocument", 10);

                executionLog.Log("VerifyDocumentsOnEmailAttachment", "Click on add new version button");
                officeActivities_DocumentHelper.ClickElement("AddVersion");
                officeActivities_DocumentHelper.WaitForWorkAround(1000);

                executionLog.Log("VerifyDocumentsOnEmailAttachment", "Attach File");
                officeActivities_DocumentHelper.UploadFile("//*[@id='DocumentFile']", "E:/pegqa/Pegasus_New_skin/Files/Up.jpg");
                officeActivities_DocumentHelper.WaitForWorkAround(1000);

                executionLog.Log("VerifyDocumentsOnEmailAttachment", "Click on add new version button");
                officeActivities_DocumentHelper.TypeText("DocCommnet", "comment");
                //officeActivities_DocumentHelper.WaitForWorkAround(1000);

                executionLog.Log("VerifyDocumentsOnEmailAttachment", "Click on Save button");
                officeActivities_DocumentHelper.ClickElement("AddVersionSave");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyDocumentsOnEmailAttachment", "Click on email this note.");
                officeActivities_DocumentHelper.ClickElement("EmailThisDocument");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyDocumentsOnEmailAttachment", "Verify attached file is pdf file");
                officeActivities_DocumentHelper.VerifyText("VerifyEmailAttachment", "Up.jpg");
                //officeActivities_DocumentHelper.WaitForWorkAround(3000);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("VerifyDocumentsOnEmailAttachment");
                String Error       = executionLog.GetAllTextFile("Error");
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Verify Documents On Email Attachment");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Verify Documents On Email Attachment", "Bug", "Medium", "Documents page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Verify Documents On Email Attachment");
                        TakeScreenshot("VerifyDocumentsOnEmailAttachment");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\VerifyDocumentsOnEmailAttachment.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("VerifyDocumentsOnEmailAttachment");
                        string id            = loginHelper.getIssueID("Verify Documents On Email Attachment");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\VerifyDocumentsOnEmailAttachment.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Verify Documents On Email Attachment"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Verify Documents On Email Attachment");
                //   executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("VerifyDocumentsOnEmailAttachment");
                executionLog.WriteInExcel("Verify Documents On Email Attachment", Status, JIRA, "Activities Management");
            }
        }
Ejemplo n.º 3
0
        public void verifyRedirectedToEmailPageIssue()
        {
            string[] username = null;
            string[] password = null;

            XMLParse 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 officeActivities_DocumentsHelper = new OfficeActivities_DocumentHelper(GetWebDriver());

            // Random Variable
            String JIRA    = "";
            String Status  = "Pass";
            var    docname = "Testdoc" + RandomNumber(111, 9999);

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

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

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Redirect to Create Document page");
                VisitOffice("documents/create");

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Enter document name");
                officeActivities_DocumentsHelper.TypeText("Name", docname);

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Upload document");
                officeActivities_DocumentsHelper.UploadFile("//*[@id='DocumentFile']", "C:/Users/Public/Pictures/Sample Pictures/Desert.jpg");

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Select User Group");
                officeActivities_DocumentsHelper.SelectByText("UserGroup", "Secondary");

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Click on Save button");
                officeActivities_DocumentsHelper.ClickElement("Save");
                officeActivities_DocumentsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Enter document name in Search field");
                officeActivities_DocumentsHelper.TypeText("SearchDocumet", docname);
                officeActivities_DocumentsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Open document");
                officeActivities_DocumentsHelper.ClickElement("OpenDoc");
                officeActivities_DocumentsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Click on User Group");
                officeActivities_DocumentsHelper.ClickElement("AssgnUserGroup");
                officeActivities_DocumentsHelper.WaitForWorkAround(4000);

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Verify User not directed to Compose Email page");
                officeActivities_DocumentsHelper.VerifyTextNotAvailable("E-Mails");
                Console.WriteLine("User is not redirected to Compose Email page");

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Redirect to All Document page");
                VisitOffice("documents");
                officeActivities_DocumentsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Enter document name in Search field");
                officeActivities_DocumentsHelper.TypeText("SearchDocumet", docname);
                officeActivities_DocumentsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Select document");
                officeActivities_DocumentsHelper.ClickElement("ClickOnCheckBox");

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Click on Delete button");
                officeActivities_DocumentsHelper.ClickElement("ClickOndelete");
                //officeActivities_DocumentsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyRedirectedToEmailPageIssue", "Accept Alert");
                officeActivities_DocumentsHelper.AcceptAlert();
                officeActivities_DocumentsHelper.WaitForText("Document deleted successfully.", 05);
                Console.WriteLine("Document Deleted");
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("VerifyRedirectedToEmailPageIssue");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Verify Redirected To Email Page Issue");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Verify Redirected To Email Page Issue", "Bug", "Medium", "Document page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Verify Redirected To Email Page Issue");
                        TakeScreenshot("VerifyRedirectedToEmailPageIssue");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\VerifyRedirectedToEmailPageIssue.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("VerifyRedirectedToEmailPageIssue");
                        string id            = loginHelper.getIssueID("Verify Redirected To Email Page Issue");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\VerifyRedirectedToEmailPageIssue.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Verify Redirected To Email Page Issue"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Verify Redirected To Email Page Issue");
                //   executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("VerifyRedirectedToEmailPageIssue");
                executionLog.WriteInExcel("Verify Redirected To Email Page Issue", Status, JIRA, "Office Activities");
            }
        }
Ejemplo n.º 4
0
        public void verifyCreatorNameOfDocumentInMerchant()
        {
            string[] username1 = null;
            string[] username  = null;
            string[] password  = null;

            XMLParse 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 corp_MerchantHelper             = new Corp_MerchantHelper(GetWebDriver());
            var office_clientsHelper            = new Office_ClientsHelper(GetWebDriver());
            var myprofilepagehelper             = new MyProfilePageHelper(GetWebDriver());
            var officeActivities_DocumentHelper = new OfficeActivities_DocumentHelper(GetWebDriver());

            // variables
            String JIRA    = "";
            String Status  = "Pass";
            var    docname = "TestDoc" + RandomNumber(111, 999999);

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

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

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Redirect at My Profile page.");
                VisitOffice("myprofile");

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Click on Edit profile Button.");
                myprofilepagehelper.ClickElement("EditProfileBtn");
                myprofilepagehelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Get First Name of User");
                var name = myprofilepagehelper.GetValue("//input[@id='EmployeeFirstName']");

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Redirect at merchants page.");
                VisitOffice("clients");
                office_clientsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Click on a client");
                var clientname = office_clientsHelper.GetText("//table[@id='list1']/tbody/tr[2]/td[15]/a");
                office_clientsHelper.ClickElement("Client1");
                office_clientsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Click on New Task");
                office_clientsHelper.ClickElement("AddDoc");
                office_clientsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Enter document name");
                officeActivities_DocumentHelper.TypeText("Name", docname);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Upload file");
                var path = GetPathToFile() + "Desert.jpg";
                officeActivities_DocumentHelper.UploadFile("//*[@id='DocumentFiles']", path);
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Click on Save button");
                officeActivities_DocumentHelper.ClickElement("ClientPopupSave");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Logout from office portal");
                VisitOffice("logout");
                office_clientsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Login to corporate portal with valid username and password");
                Login(username[0], password[0]);
                Console.WriteLine("Logged in as: " + username[0] + " / " + password[0]);

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

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Redirect at merchants page.");
                VisitCorp("merchants");
                corp_MerchantHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Enter client name in search box");
                corp_MerchantHelper.TypeText("EnterClinentToSearch", clientname);
                corp_MerchantHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Click on Merchant");
                corp_MerchantHelper.ClickElement("ClickOnMerchant");
                corp_MerchantHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Select Activity Type >> Documents");
                corp_MerchantHelper.Select("SelectActivityType", "Documents");
                corp_MerchantHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Enter document name");
                corp_MerchantHelper.TypeText("SearchActivityName", docname);
                corp_MerchantHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Click on document");
                corp_MerchantHelper.ClickElement("ClickOnActivityAny");
                corp_MerchantHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyCreatorNameOfDocumentInMerchant", "Verify Created By name is appearing");
                corp_MerchantHelper.VerifyText("CreatedOnText", name);
                Console.WriteLine("Creator Name of Document is " + name);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("VerifyCreatorNameOfDocumentInMerchant");
                String Error       = executionLog.GetAllTextFile("Error");
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Verify Creator Name Of Document In Merchant");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Verify Creator Name Of Document In Merchant", "Bug", "Medium", "Merchant corp", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Verify Creator Name Of Document In Merchant");
                        TakeScreenshot("VerifyCreatorNameOfDocumentInMerchant");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\VerifyCreatorNameOfDocumentInMerchant.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("VerifyCreatorNameOfDocumentInMerchant");
                        string id            = loginHelper.getIssueID("Verify Creator Name Of Document In Merchant");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\VerifyCreatorNameOfDocumentInMerchant.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Verify Creator Name Of Document In Merchant"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Verify Creator Name Of Document In Merchant");
                //   executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("VerifyCreatorNameOfDocumentInMerchant");
                executionLog.WriteInExcel("Verify Creator Name Of Document In Merchant", Status, JIRA, "Corp Merchant");
            }
        }
        public void documentUpdateVersion()
        {
            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    officeActivities_DocumentHelper = new OfficeActivities_DocumentHelper(GetWebDriver());
            String JIRA   = "";
            String Status = "Pass";

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

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

                executionLog.Log("DocumentUpdateVersion", "Redirect to URL");
                VisitOffice("documents");

                executionLog.Log("DocumentUpdateVersion", "Wait for element to present");
                officeActivities_DocumentHelper.WaitForElementPresent("EditDoc", 10);

                executionLog.Log("DocumentUpdateVersion", " Click On Edit Icon");
                officeActivities_DocumentHelper.ClickElement("EditDoc");

                executionLog.Log("DocumentUpdateVersion", "Verify page title");
                VerifyTitle("Edit Document");

                executionLog.Log("DocumentUpdateVersion", "ClickOnAddNewVesion");
                officeActivities_DocumentHelper.ClickElement("NewVersion");

                string value = officeActivities_DocumentHelper.GetAtrributeByLocator("//*[@id='DocumentVersion']", "value");
                Console.WriteLine("Value in string = " + value);

                executionLog.Log("DocumentUpdateVersion", "upload file");
                var path = GetPathToFile() + "1.pdf";
                officeActivities_DocumentHelper.UploadFile("//*[@id='DocumentFile']", path);

                executionLog.Log("DocumentUpdateVersion", "Enter coment");
                officeActivities_DocumentHelper.TypeText("DocCommnet", "Test Comment");

                executionLog.Log("DocumentUpdateVersion", "Click Save");
                officeActivities_DocumentHelper.ClickDisplayed("//input[@title='Save']");
                officeActivities_DocumentHelper.WaitForWorkAround(1000);

                executionLog.Log("DocumentUpdateVersion", "New Version File Uploaded successfully.");
                officeActivities_DocumentHelper.WaitForText("New Version File Uploaded successfully.", 8);

                double intValue = double.Parse(value);
                Console.WriteLine("Value in int = " + intValue);
                officeActivities_DocumentHelper.WaitForWorkAround(5000);
                value = officeActivities_DocumentHelper.GetAtrributeByLocator("//*[@id='DocumentVersion']", "value");
                Assert.IsTrue(intValue + 1 == double.Parse(value));
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("DocumentUpdateVersion");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Document Update Version");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Document Update Version", "Bug", "Medium", "Document page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Document Update Version");
                        TakeScreenshot("DocumentUpdateVersion");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\DocumentUpdateVersion.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("DocumentUpdateVersion");
                        string id            = loginHelper.getIssueID("Document Update Version");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\DocumentUpdateVersion.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Document Update Version"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Document Update Version");
                //  executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("DocumentUpdateVersion");
                executionLog.WriteInExcel("Document Update Version", Status, JIRA, "Office Activities");
            }
        }
Ejemplo n.º 6
0
        public void documentManagement()
        {
            string[] username = null;
            string[] password = null;

            var oXMLData = new XMLParse();

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

            // Initializing the objects
            var executionLog = new ExecutionLog();
            var loginHelper  = new LoginHelper(GetWebDriver());
            var officeActivities_DocumentHelper = new OfficeActivities_DocumentHelper(GetWebDriver());

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

            // Variable
            var    fileInvalid = GetPathToFile() + "Invalid.dll";
            var    file        = GetPathToFile() + "index.jpg";
            var    Document    = "New" + RandomNumber(99, 99999);
            var    CDBA        = "New" + RandomNumber(99, 99999);
            String JIRA        = "";
            String Status      = "Pass";

            try
            {
                executionLog.Log("DocumentManagement", "Login with valid credential  Username");
                Login(username[0], password[0]);

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

                executionLog.Log("DocumentManagement", "Visit Document");
                VisitOffice("documents");
                officeActivities_DocumentHelper.WaitForWorkAround(5000);

                executionLog.Log("DocumentManagement", "Click on Create Document");
                officeActivities_DocumentHelper.ClickElement("ClickOnCreateDoc");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("DocumentManagement", "Document Name");
                officeActivities_DocumentHelper.TypeText("Name", Document);

                executionLog.Log("DocumentManagement", "Upload Document");
                officeActivities_DocumentHelper.UploadFile("//*[@id='DocumentFile']", file);
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("DocumentManagement", "Click on Save button.");
                officeActivities_DocumentHelper.ClickElement("Save");

                executionLog.Log("DocumentManagement", "Wait for Confirmation");
                officeActivities_DocumentHelper.WaitForText("Document saved successfully.", 10);

                executionLog.Log("DocumentManagement", "Search Document");
                officeActivities_DocumentHelper.TypeText("SearchDocumet", Document);
                officeActivities_DocumentHelper.WaitForWorkAround(2000);
                officeActivities_DocumentHelper.selectOwner("//*[@id='gs_first_name']");
                officeActivities_DocumentHelper.WaitForWorkAround(6000);

                executionLog.Log("DocumentManagement", "Click on Edit");
                officeActivities_DocumentHelper.ClickElement("EditDoc");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("DocumentManagement", "Click on Save");
                officeActivities_DocumentHelper.ClickElement("Save");

                executionLog.Log("DocumentManagement", "Verify Confirmation");
                officeActivities_DocumentHelper.WaitForText("Document updated successfully.", 10);

                executionLog.Log("DocumentManagement", "Redirect at Documents page.");
                VisitOffice("documents");
                officeActivities_DocumentHelper.WaitForWorkAround(5000);

                executionLog.Log("DocumentManagement", "Click on Create Document");
                officeActivities_DocumentHelper.ClickElement("ClickOnCreateDoc");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("DocumentManagement", "Click on Save button.");
                officeActivities_DocumentHelper.ClickElement("Save");

                executionLog.Log("DocumentManagement", "Wait for Validation");
                officeActivities_DocumentHelper.WaitForText("This field is required.", 10);

                executionLog.Log("DocumentManagement", "Uplaod File");
                officeActivities_DocumentHelper.UploadFile("//*[@id='DocumentFile']", fileInvalid);
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("DocumentManagement", "Accept alert message.");
                officeActivities_DocumentHelper.AcceptAlert();

                executionLog.Log("DocumentManagement", "Valiadtion please select a valid file");
                officeActivities_DocumentHelper.WaitForText("please select a valid file", 10);

                executionLog.Log("DocumentManagement", "Accept alert message.");
                officeActivities_DocumentHelper.AcceptAlert();
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("DocumentManagement", "Click on Cancel");
                officeActivities_DocumentHelper.ClickElement("DocumentCancelButton");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                officeActivities_DocumentHelper.VerifyText("VerifyDocumentHeader", "Documents");
                officeActivities_DocumentHelper.WaitForWorkAround(1000);

                executionLog.Log("DocumentManagement", "Redirect at documents page.");
                VisitOffice("documents");
                officeActivities_DocumentHelper.WaitForWorkAround(5000);

                executionLog.Log("DocumentManagement", "Click on first document");
                officeActivities_DocumentHelper.ClickElement("DocumentClick");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("DocumentManagement", "Add Version");
                officeActivities_DocumentHelper.ClickElement("AddVersion");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("DocumentManagement", "Uplaod");
                officeActivities_DocumentHelper.UploadFile("//*[@id='DocumentFile']", file);
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("DocumentManagement", "Add Comment");
                officeActivities_DocumentHelper.TypeText("AddComment", "Test Comment");

                executionLog.Log("DocumentManagement", "Click on Save");
                officeActivities_DocumentHelper.ClickElement("AddVersionSave");

                executionLog.Log("DocumentManagement", "Wait for Confirmation");
                officeActivities_DocumentHelper.WaitForText("New Version File Uploaded successfully.", 10);

                executionLog.Log("DocumentManagement", "Click on Delete");
                officeActivities_DocumentHelper.ClickElement("DeleteVersion");
                officeActivities_DocumentHelper.AcceptAlert();

                executionLog.Log("DocumentManagement", "Confirmation");
                officeActivities_DocumentHelper.WaitForText("Document Version Deleted Permanently.", 10);

                executionLog.Log("DocumentManagement", "Goto Document");
                VisitOffice("documents");
                officeActivities_DocumentHelper.WaitForWorkAround(5000);

                executionLog.Log("DocumentManagement", "Search Documet");
                officeActivities_DocumentHelper.TypeText("SearchDocumet", Document);
                officeActivities_DocumentHelper.selectOwner("//*[@id='gs_first_name']");
                officeActivities_DocumentHelper.WaitForWorkAround(4000);

                executionLog.Log("DocumentManagement", "Click on Check box for first document");
                officeActivities_DocumentHelper.ClickElement("ClickOnCheckBox");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("DocumentManagement", "Click Delete");
                officeActivities_DocumentHelper.ClickElement("DeleteDocument");
                officeActivities_DocumentHelper.AcceptAlert();

                executionLog.Log("DocumentManagement", "Confirmaion");
                officeActivities_DocumentHelper.WaitForText("Document deleted successfully.", 10);

                executionLog.Log("DocumentManagement", "Redirect at Recycle bin");
                VisitOffice("documents/recyclebin");

                executionLog.Log("DocumentManagement", "Search Document");
                officeActivities_DocumentHelper.TypeText("SearchDocumet", Document);
                officeActivities_DocumentHelper.selectOwner("//*[@id='gs_first_name']");
                officeActivities_DocumentHelper.WaitForWorkAround(4000);

                executionLog.Log("DocumentManagement", "Restore Document");
                officeActivities_DocumentHelper.ClickElement("RestoredDoc");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("DocumentManagement", "Confirmation");
                officeActivities_DocumentHelper.WaitForText("Document Restored Successfully.", 10);

                executionLog.Log("DocumentManagement", "Goto Document");
                VisitOffice("documents");
                officeActivities_DocumentHelper.WaitForWorkAround(5000);

                executionLog.Log("DocumentManagement", "Search Document");
                officeActivities_DocumentHelper.TypeText("SearchDocumet", Document);
                officeActivities_DocumentHelper.selectOwner("//*[@id='gs_first_name']");
                officeActivities_DocumentHelper.WaitForWorkAround(4000);

                executionLog.Log("DocumentManagement", "Select document");
                officeActivities_DocumentHelper.ClickElement("CheckDocToDel");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("DocumentManagement", "Click on Delete");
                officeActivities_DocumentHelper.ClickElement("DeleteDocument");
                officeActivities_DocumentHelper.AcceptAlert();

                executionLog.Log("DocumentManagement", "Wait for Confirmation");
                officeActivities_DocumentHelper.WaitForText("Document deleted successfully.", 10);

                executionLog.Log("DocumentManagement", "Redirect at Recycle bin");
                VisitOffice("documents/recyclebin");
                officeActivities_DocumentHelper.WaitForWorkAround(5000);

                executionLog.Log("DocumentManagement", "Search Document");
                officeActivities_DocumentHelper.TypeText("SearchDocumet", Document);
                officeActivities_DocumentHelper.selectOwner("//*[@id='gs_first_name']");
                officeActivities_DocumentHelper.WaitForWorkAround(4000);

                executionLog.Log("DocumentManagement", "Delete From Recycle bin");
                officeActivities_DocumentHelper.ClickElement("DeleteRecycleBin");
                officeActivities_DocumentHelper.AcceptAlert();

                executionLog.Log("DocumentManagement", "Wait for Confirmation");
                officeActivities_DocumentHelper.WaitForText("Document Permanently Deleted.", 10);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("DocumentManagement");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("DocumentManagement");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("DocumentManagement", "Bug", "Medium", "Document page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("DocumentManagement");
                        TakeScreenshot("DocumentManagement");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\DocumentManagement.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("DocumentManagement");
                        string id            = loginHelper.getIssueID("DocumentManagement");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\DocumentManagement.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("DocumentManagement"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("DocumentManagement");
                //    executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("DocumentManagement");
                executionLog.WriteInExcel("DocumentManagement", Status, JIRA, "Office Activities.");
            }
        }
Ejemplo n.º 7
0
        public void documentVersionError()
        {
            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 officeActivities_DocumentHelper = new OfficeActivities_DocumentHelper(GetWebDriver());

            String JIRA   = "";
            String Status = "Pass";

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

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

                executionLog.Log("DocumentVersionError", "Redirect To Document");
                VisitOffice("documents/create");

                executionLog.Log("DocumentVersionError", "Verify title");
                VerifyTitle("Create a New Document");

                executionLog.Log("DocumentVersionError", "Verify version is set to 1");
                string value = officeActivities_DocumentHelper.getFiledText("DocumentVersion");
                Assert.IsTrue(value.Contains("1"));

                executionLog.Log("DocumentVersionError", "Redirect To Document");
                VisitOffice("documents");

                executionLog.Log("DocumentVersionError", "Verify title");
                VerifyTitle("Documents");

                executionLog.Log("DocumentVersionError", "Edit first doc");
                officeActivities_DocumentHelper.ClickElement("EditDoc");

                executionLog.Log("DocumentVersionError", "Verify title");
                VerifyTitle("Edit Document");

                executionLog.Log("DocumentVersionError", "Verify document version is not user editable");
                Console.WriteLine("CHECK = " + officeActivities_DocumentHelper.GetAtrributeByLocator("//*[@id='DocumentVersion']", "readonly"));
                Assert.IsTrue(officeActivities_DocumentHelper.GetAtrributeByLocator("//*[@id='DocumentVersion']", "readonly").Contains("true"));

                executionLog.Log("DocumentVersionError", "Click on Add new version");
                officeActivities_DocumentHelper.ClickElement("NewVersion");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("DocumentVersionError", "Upload file");
                officeActivities_DocumentHelper.UploadFile("//*[@id='DocumentFile']", GetPathToFile() + "2.pdf");

                executionLog.Log("DocumentVersionError", "Enter comment");
                officeActivities_DocumentHelper.TypeText("DocCommnet", "Comment");

                executionLog.Log("DocumentVersionError", "Click on Save button");
                officeActivities_DocumentHelper.ClickElement("EditSave");
                officeActivities_DocumentHelper.WaitForWorkAround(3000);

                executionLog.Log("DocumentVersionError", "Verify added version is not deletable");
                officeActivities_DocumentHelper.verifyVersionNotDeletable();
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

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

            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 office_ClientsHelper            = new Office_ClientsHelper(GetWebDriver());
            var officeActivities_DocumentHelper = new OfficeActivities_DocumentHelper(GetWebDriver());

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

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

                executionLog.Log("UniqueDocError", "Redirect To create Document page");
                VisitOffice("documents/create");

                executionLog.Log("UniqueDocError", "Verify title");
                VerifyTitle("Create a New Document");

                executionLog.Log("UniqueDocError", "ClickOnCreate");
                officeActivities_DocumentHelper.TypeText("Name", "Doc1");

                string pathtofile = GetPathToFile() + "Upload1.pdf";
                executionLog.Log("UniqueDocError", "Attach File");
                officeActivities_DocumentHelper.UploadFile("//*[@id='DocumentFile']", pathtofile);

                executionLog.Log("UniqueDocError", "Select releted to");
                officeActivities_DocumentHelper.SelectByText("ReletedTo", "Client");

                executionLog.Log("UniqueDocError", "Select Client");
                officeActivities_DocumentHelper.ClickElement("Assign");
                officeActivities_DocumentHelper.WaitForWorkAround(4000);

                officeActivities_DocumentHelper.ClickElement("AssignUser");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("UniqueDocError", "Click on Save");
                officeActivities_DocumentHelper.ClickElement("Save");

                executionLog.Log("UniqueDocError", "Wait for success message.");
                officeActivities_DocumentHelper.WaitForText("Document saved successfully.", 10);

                executionLog.Log("UniqueDocError", "Redirect To Document");
                VisitOffice("documents/create");

                executionLog.Log("UniqueDocError", "Verify title");
                VerifyTitle("Create a New Document");

                executionLog.Log("UniqueDocError", "ClickOnCreate");
                officeActivities_DocumentHelper.TypeText("Name", "Doc2");

                pathtofile = GetPathToFile() + "Upload2.pdf";
                executionLog.Log("UniqueDocError", "Attach File");
                officeActivities_DocumentHelper.UploadFile("//*[@id='DocumentFile']", pathtofile);

                executionLog.Log("UniqueDocError", "Select releted to");
                officeActivities_DocumentHelper.SelectByText("ReletedTo", "Client");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("UniqueDocError", "Select Client");
                officeActivities_DocumentHelper.ClickElement("Assign");
                officeActivities_DocumentHelper.WaitForWorkAround(4000);

                officeActivities_DocumentHelper.ClickElement("AssignUser");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("UniqueDocError", "Click on Save");
                officeActivities_DocumentHelper.ClickElement("Save");

                executionLog.Log("UniqueDocError", "Wait for success message.");
                officeActivities_DocumentHelper.WaitForText("Document saved successfully.", 10);

                executionLog.Log("UniqueDocError", "Verify page title.");
                VerifyTitle("Documents");

                executionLog.Log("UniqueDocError", "Redirect To Document");
                VisitOffice("documents/create");

                executionLog.Log("UniqueDocError", "ClickOnCreate");
                officeActivities_DocumentHelper.TypeText("Name", "Doc3");

                pathtofile = GetPathToFile() + "Upload3.pdf";
                executionLog.Log("UniqueDocError", "Attach File");
                officeActivities_DocumentHelper.UploadFile("//*[@id='DocumentFile']", pathtofile);

                executionLog.Log("UniqueDocError", "Select releted to");
                officeActivities_DocumentHelper.SelectByText("ReletedTo", "Client");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("UniqueDocError", "Select Client");
                officeActivities_DocumentHelper.ClickElement("Assign");
                officeActivities_DocumentHelper.WaitForWorkAround(4000);

                officeActivities_DocumentHelper.ClickElement("AssignUser");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("UniqueDocError", "Click on Save");
                officeActivities_DocumentHelper.ClickElement("Save");

                executionLog.Log("UniqueDocError", "Wait for success message.");
                officeActivities_DocumentHelper.WaitForText("Document saved successfully.", 10);

                executionLog.Log("UniqueDocError", "Go to client page");
                VisitOffice("clients");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("UniqueDocError", "Verify title");
                VerifyTitle();
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("UniqueDocError", "Open the client");
                office_ClientsHelper.ClickElement("Client1");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("UniqueDocError", "Click on info");
                office_ClientsHelper.ClickElement("Info");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);

                executionLog.Log("UniqueDocError", "Verify title");
                VerifyTitle("- Details");
                officeActivities_DocumentHelper.WaitForWorkAround(2000);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("UniqueDocError");
                String Error       = executionLog.GetAllTextFile("Error");
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Unique Doc Error");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Unique Doc Error", "Bug", "Medium", "Documents page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Unique Doc Error");
                        TakeScreenshot("UniqueDocError");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\UniqueDocError.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("UniqueDocError");
                        string id            = loginHelper.getIssueID("Unique Doc Error");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\UniqueDocError.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Unique Doc Error"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Unique Doc Error");
                //   executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("UniqueDocError");
                executionLog.WriteInExcel("Unique Doc Error", Status, JIRA, "Office Activities");
            }
        }