Esempio n. 1
0
        public void verifyContactCreditsIssue()
        {
            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 office_ContactsHelper = new Office_ContactsHelper(GetWebDriver());

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

            // Variable
            var FName         = "Test" + RandomNumber(99, 99999);
            var LName         = "Test" + RandomNumber(99, 99999);
            var CDBA          = "New" + RandomNumber(99, 99999);
            var ContactImport = GetPathToFile() + "contactsamples.csv";

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

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

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

                executionLog.Log("VerifyContactCreditsIssue", "Goto Contact");
                VisitOffice("contacts");
                office_ContactsHelper.WaitForWorkAround(5000);

                executionLog.Log("VerifyContactCreditsIssue", "Verify title");
                office_ContactsHelper.VerifyText("VerifyContact", "Contacts");

                executionLog.Log("VerifyContactCreditsIssue", "Goto Create Contact");
                VisitOffice("contacts/create");

                executionLog.Log("VerifyContactCreditsIssue", "Click on Cancel Button");
                office_ContactsHelper.ClickElement("Cancelbtn");

                executionLog.Log("VerifyContactCreditsIssue", "Verify text on page.");
                office_ContactsHelper.VerifyText("VerifyContact", "Contacts");

                executionLog.Log("VerifyContactCreditsIssue", "Create Contact");
                VisitOffice("contacts/create");

                executionLog.Log("VerifyContactCreditsIssue", "Enter First Name");
                office_ContactsHelper.TypeText("FirstNAME", FName);

                executionLog.Log("VerifyContactCreditsIssue", "Enter Last Name");
                office_ContactsHelper.TypeText("LastName", LName);

                executionLog.Log("VerifyContactCreditsIssue", "Enter Company DBA Name");
                office_ContactsHelper.TypeText("CompanyName", CDBA);

                executionLog.Log("VerifyContactCreditsIssue", "Click on Save Contact");
                office_ContactsHelper.ClickElement("SaveContactN");
                office_ContactsHelper.WaitForWorkAround(3000);

/*
 *          if (office_ContactsHelper.IsElementPresent("//h3[text()='Existing Contacts']"))
 *          {
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Click on Dublicate button");
 *              office_ContactsHelper.ClickElement("ClickOnDuplicate");
 *              office_ContactsHelper.WaitForWorkAround(3000);
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Confirmation");
 *              office_ContactsHelper.WaitForText("A Contact has been created.", 10);
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Redirect at contacts page.");
 *              VisitOffice("contacts");
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Verify page title.");
 *              VerifyTitle("Contacts");
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Search Contact by company name");
 *              office_ContactsHelper.TypeText("SearchCompany", CDBA);
 *              office_ContactsHelper.WaitForWorkAround(3000);
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Clcik on searched contact.");
 *              office_ContactsHelper.ClickElement("Contact1");
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Verify contact created by credits.");
 *              office_ContactsHelper.VerifyText("CreatedBy", "Howard Tang");
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Verify contact modified by credits.");
 *              office_ContactsHelper.VerifyText("ModifiedBy", "Howard Tang");
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Goto Contact");
 *              VisitOffice("contacts");
 *              office_ContactsHelper.WaitForWorkAround(3000);
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Search Contact by company name");
 *              office_ContactsHelper.TypeText("SearchCompany", CDBA);
 *              office_ContactsHelper.WaitForWorkAround(3000);
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Check the first contact checkbox");
 *              office_ContactsHelper.ClickElement("CheckTheFirstContact");
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Click delete icon");
 *              office_ContactsHelper.ClickElement("ClickOnDeleteIcon");
 *              office_ContactsHelper.AcceptAlert();
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Wait for deleted text message");
 *              office_ContactsHelper.WaitForText("records deleted successfully", 10);
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Redirect to recycled contacts.");
 *              VisitOffice("contacts/recyclebin");
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Click restore link");
 *              office_ContactsHelper.ClickElement("ClickOnContactRCRestore");
 *              office_ContactsHelper.WaitForWorkAround(3000);
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Wait for restored message");
 *              office_ContactsHelper.WaitForText("Contact Restored Successfully.", 10);
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Goto Contact");
 *              VisitOffice("contacts");
 *              office_ContactsHelper.WaitForWorkAround(3000);
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Search Contact by company name");
 *              office_ContactsHelper.TypeText("SearchCompany", CDBA);
 *              office_ContactsHelper.WaitForWorkAround(3000);
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Check the  First Checkbox");
 *              office_ContactsHelper.ClickElement("CheckTheFirstContact");
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Click on Delete Icon");
 *              office_ContactsHelper.ClickElement("ClickOnDeleteIcon");
 *              office_ContactsHelper.AcceptAlert();
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Confrimation");
 *              office_ContactsHelper.WaitForText("records deleted successfully", 10);
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Goto Contact Recycle Bin");
 *              VisitOffice("contacts/recyclebin");
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Delete Icon");
 *              office_ContactsHelper.ClickElement("ClickOnDeleteIconRCBin");
 *              office_ContactsHelper.AcceptAlert();
 *
 *              executionLog.Log("VerifyContactCreditsIssue", "Confiration");
 *              office_ContactsHelper.WaitForText("Contact Permanently Deleted.", 10);
 *
 *          }
 *          else
 *          {   */
                executionLog.Log("VerifyContactCreditsIssue", "Wait for save Confirmation");
                office_ContactsHelper.WaitForText("A Contact has been created.", 20);
                office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyContactCreditsIssue", "Redirect at contacts page.");
                VisitOffice("contacts");

                executionLog.Log("VerifyContactCreditsIssue", "Verify page title.");
                VerifyTitle("Contacts");

                executionLog.Log("VerifyContactCreditsIssue", "Search Contact by company name");
                office_ContactsHelper.TypeText("SearchCompany", CDBA);
                office_ContactsHelper.WaitForWorkAround(3000);

                office_ContactsHelper.SelectDropDownByText("//select[@name='owner']", "All");
                office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyContactCreditsIssue", "Click on searched contact.");
                office_ContactsHelper.ClickElement("Contact1");

                executionLog.Log("VerifyContactCreditsIssue", "Verify contact created by credits.");
                office_ContactsHelper.VerifyText("CreatedBy", "Howard Tang");

                executionLog.Log("VerifyContactCreditsIssue", "Verify contact modified by credits.");
                office_ContactsHelper.VerifyText("ModifiedBy", "Howard Tang");

                executionLog.Log("VerifyContactCreditsIssue", "Goto Contact");
                VisitOffice("contacts");
                office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyContactCreditsIssue", "Search Contact by company name");
                office_ContactsHelper.TypeText("SearchCompany", CDBA);
                office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyContactCreditsIssue", "Check the first contact checkbox");
                office_ContactsHelper.ClickElement("CheckTheFirstContact");

                executionLog.Log("VerifyContactCreditsIssue", "Click delete icon");
                office_ContactsHelper.ClickElement("ClickOnDeleteIcon");
                office_ContactsHelper.AcceptAlert();

                executionLog.Log("VerifyContactCreditsIssue", "Wait for deleted text message");
                office_ContactsHelper.WaitForText("records deleted successfully", 10);

                executionLog.Log("VerifyContactCreditsIssue", "Redirect to recycled contacts.");
                VisitOffice("contacts/recyclebin");

                executionLog.Log("VerifyContactCreditsIssue", "Click restore link");
                office_ContactsHelper.ClickElement("ClickOnContactRCRestore");
                office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyContactCreditsIssue", "Wait for restored message");
                office_ContactsHelper.WaitForText("Contact Restored Successfully.", 10);

                executionLog.Log("VerifyContactCreditsIssue", "Goto Contact");
                VisitOffice("contacts");
                office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyContactCreditsIssue", "Search Contact by company name");
                office_ContactsHelper.TypeText("SearchCompany", CDBA);
                office_ContactsHelper.WaitForWorkAround(5000);

                executionLog.Log("VerifyContactCreditsIssue", "Check the  First Checkbox");
                office_ContactsHelper.ClickElement("CheckTheFirstContact");

                executionLog.Log("VerifyContactCreditsIssue", "Click on Delete Icon");
                office_ContactsHelper.ClickElement("ClickOnDeleteIcon");
                office_ContactsHelper.AcceptAlert();

                executionLog.Log("VerifyContactCreditsIssue", "Confrimation");
                office_ContactsHelper.WaitForText("records deleted successfully", 10);

                executionLog.Log("VerifyContactCreditsIssue", "Goto Contact Recycle Bin");
                VisitOffice("contacts/recyclebin");

                executionLog.Log("VerifyContactCreditsIssue", "Delete Icon");
                office_ContactsHelper.ClickElement("ClickOnDeleteIconRCBin");
                office_ContactsHelper.AcceptAlert();

                executionLog.Log("VerifyContactCreditsIssue", "Confiration");
                office_ContactsHelper.WaitForText("Contact Permanently Deleted.", 10);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

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

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

            // Variable
            var FName         = "Test" + RandomNumber(99, 99999);
            var LName         = "Test" + RandomNumber(99, 99999);
            var CDBA          = "New" + RandomNumber(99, 99999);
            var ContactImport = GetPathToFile() + "contactsamples.csv";

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

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

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

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Goto Create Contact");
                VisitOffice("contacts/create");
                office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Click on Cancel Button");
                office_ContactsHelper.ClickElement("Cancelbtn");
                office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify text on page.");
                office_ContactsHelper.VerifyText("VerifyContact", "Contacts");
                //office_ContactsHelper.WaitForWorkAround(3000);


                executionLog.Log("VerifyQuickLookLabelsForContacts", "Redirect at create contacts page.");
                VisitOffice("contacts/create");
                office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Enter First name.");
                office_ContactsHelper.TypeText("FirstNAME", FName);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Enter Last Name");
                office_ContactsHelper.TypeText("LastName", LName);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Enter Company DBA Name");
                office_ContactsHelper.TypeText("CompanyName", CDBA);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Click on Save Contact");
                office_ContactsHelper.ClickElement("SaveContactN");
                office_ContactsHelper.WaitForWorkAround(3000);

                //    executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify Confirmation");
                //office_ContactsHelper.WaitForText("A Contact has been created.", 30);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Click on any contact.");
                office_ContactsHelper.ClickElement("Contact1");
                office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify label for contact type.");
                office_ContactsHelper.VerifyText("Type", "Select Type");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify label for contact Status.");
                office_ContactsHelper.VerifyText("StatusV", "Active");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify label for contact source.");
                office_ContactsHelper.VerifyText("Source", "Select Source");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify label for contact category.");
                office_ContactsHelper.VerifyText("CategoryLabel", "Select Category");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify label for contact responsibility.");
                office_ContactsHelper.VerifyText("ResponsibilityV", "Howard Tang");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify label for contact sales manager.");
                office_ContactsHelper.VerifyText("SalesManagerLabel", "Select Sales Manager");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Click on edit button.");
                office_ContactsHelper.ClickElement("EditLink");
                office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify page title as edit contact");
                VerifyTitle("Edit Contact");
                office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Select contact type.");
                office_ContactsHelper.selectByText("SelectType", "Client Owner");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Select contact source.");
                office_ContactsHelper.selectByText("SelectSource", "Web Site");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Select contact category.");
                office_ContactsHelper.selectByText("SelectCategory", "Personal");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Select contact responsibility.");
                office_ContactsHelper.selectByText("Responsibility", "Howard Tang");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Select contact sales manager.");
                office_ContactsHelper.selectByText("SalesManager", "Howard Tang");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Click on save contact.");
                office_ContactsHelper.ClickElement("SaveContactN");
                office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify title as contacts.");
                VerifyTitle("Contacts");
                //office_ContactsHelper.WaitForWorkAround(3000);


                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify contact label for type.");
                office_ContactsHelper.VerifyText("Type", "Client Owner");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify contact label for status.");
                office_ContactsHelper.VerifyText("StatusV", "Active");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify contact label for source.");
                office_ContactsHelper.VerifyText("Source", "Web Site");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify contact label for category.");
                office_ContactsHelper.VerifyText("CategoryLabel", "Personal");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify contact label for responsibility.");
                office_ContactsHelper.VerifyText("ResponsibilityV", "Howard Tang");
                //office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Verify contact label for sales manager.");
                office_ContactsHelper.VerifyText("SalesManagerLabel", "Howard Tang");
                //office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Goto Contact");
                VisitOffice("contacts");
                office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Search Contact by company name");
                office_ContactsHelper.TypeText("SearchCompany", CDBA);
                office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Select 'All' in Responsbitiy field");
                office_ContactsHelper.SelectByText("ResponsibiltyField", "All");
                office_ContactsHelper.WaitForWorkAround(2000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Check the  First Checkbox");
                office_ContactsHelper.ClickElement("CheckTheFirstContact");
                //office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Click on Delete Icon");
                office_ContactsHelper.ClickElement("ClickOnDeleteIcon");
                office_ContactsHelper.AcceptAlert();
                //office_ContactsHelper.WaitForWorkAround(3000);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Confrimation");
                office_ContactsHelper.WaitForText("records deleted successfully", 10);

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Goto Contact Recycle Bin");
                VisitOffice("contacts/recyclebin");

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Delete Icon");
                office_ContactsHelper.ClickElement("ClickOnDeleteIconRCBin");
                office_ContactsHelper.AcceptAlert();

                executionLog.Log("VerifyQuickLookLabelsForContacts", "Confiration");
                office_ContactsHelper.WaitForText("Contact Permanently Deleted.", 10);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

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

            // Variable
            var    FirstName = "Test" + GetRandomNumber();
            var    LastName  = "Tester" + GetRandomNumber();
            var    Number    = "12345678" + GetRandomNumber();
            String JIRA      = "";
            String Status    = "Pass";

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

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

                executionLog.Log("ValidationforContactPrimaryEmail", "Go to contacts page");
                VisitOffice("contacts");
                contact_Helper.WaitForWorkAround(3000);

                //contact_Helper.TypeText("SearchName", "aslam ");
                //contact_Helper.WaitForWorkAround(4000);

                executionLog.Log("ValidationforContactPrimaryEmail", "Click On Any  Contact");
                contact_Helper.ClickElement("CheckTheFirstContact");
                contact_Helper.WaitForWorkAround(2000);

                executionLog.Log("ValidationforContactPrimaryEmail", "Click On Edit icon");
                contact_Helper.ClickElement("EditContactNewSkin");
                contact_Helper.WaitForWorkAround(3000);

                executionLog.Log("ValidationforContactPrimaryEmail", "Click On Save Button");
                contact_Helper.ClickElement("SaveContactN");

                executionLog.Log("ValidationforContactPrimaryEmail", "Wait for success message");
                contact_Helper.WaitForText("Contact has been updated.", 10);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

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

            // Random variables
            var    File   = GetPathToFile() + "leadsamples.csv";
            String JIRA   = "";
            String Status = "Pass";


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

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

                executionLog.Log("ImportInValidVcardContacts", "Redirect at contacts page.");
                VisitOffice("contacts");

                executionLog.Log("ImportInValidVcardContacts", "Click on Import Vcard.");
                office_ContactsHelper.ClickElement("ImportVCard");

                executionLog.Log("ImportInValidVcardContacts", "Browse a file");
                office_ContactsHelper.Upload("BrowseVcard", File);

                executionLog.Log("ImportInValidVcardContacts", "Click on import button");
                office_ContactsHelper.ClickElement("ImportBtn");
                office_ContactsHelper.WaitForWorkAround(1000);

                executionLog.Log("ImportInValidVcardContacts", "Wait for invalid file message.");
                office_ContactsHelper.WaitForText("vCard: invalid vCard", 10);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("ImportInValidVcardContacts");
                String Error       = executionLog.GetAllTextFile("Error");
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Import InValid Vcard Contacts");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Import InValid Vcard Contacts", "Bug", "Medium", "Contacts page", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Import InValid Vcard Contacts");
                        TakeScreenshot("ImportInValidVcardContacts");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\ImportInValidVcardContacts.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("ImportInValidVcardContacts");
                        string id            = loginHelper.getIssueID("Import InValid Vcard Contacts");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\ImportInValidVcardContacts.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Import InValid Vcard Contacts"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Import InValid Vcard Contacts");
                // executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("ImportInValidVcardContacts");
                executionLog.WriteInExcel("Import InValid Vcard Contacts", Status, JIRA, "Contacts Management");
            }
        }
Esempio n. 5
0
        public void mergeContact()
        {
            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 office_ContactsHelper = new Office_ContactsHelper(GetWebDriver());

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

            // Variable
            var    FName  = "Test" + RandomNumber(99, 99999);
            var    LName  = "Test" + RandomNumber(99, 99999);
            var    CDBA   = "New" + RandomNumber(99, 99999);
            String JIRA   = "";
            String Status = "Pass";

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

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

                executionLog.Log("MergeContact", "Goto Contact");
                VisitOffice("contacts");

                executionLog.Log("MergeContact", "Veify Title Contact");
                office_ContactsHelper.VerifyText("VerifyContact", "Contacts");

                executionLog.Log("MergeContact", "Goto Create Contact page.");
                VisitOffice("contacts/create");

                executionLog.Log("MergeContact", "Click on Cancel");
                office_ContactsHelper.ClickElement("Cancelbtn");

                executionLog.Log("MergeContact", "Verify Title Contact");
                office_ContactsHelper.VerifyText("VerifyContact", "Contacts");
                office_ContactsHelper.WaitForWorkAround(1000);

                executionLog.Log("MergeContact", "Create Contact");
                VisitOffice("contacts/create");

                executionLog.Log("MergeContact", "Enter First Name");
                office_ContactsHelper.TypeText("FirstNAME", FName);

                executionLog.Log("MergeContact", "Enter Last Name");
                office_ContactsHelper.TypeText("LastName", LName);

                executionLog.Log("MergeContact", "Enter Company DBA Name");
                office_ContactsHelper.TypeText("CompanyName", CDBA);

                executionLog.Log("MergeContact", "Click Save Button");
                office_ContactsHelper.ClickElement("SaveContactN");

                executionLog.Log("MergeContact", "Wait for Confirmation");
                office_ContactsHelper.WaitForText("A Contact has been created.", 10);

                executionLog.Log("MergeContact", "Goto Create Contact");
                VisitOffice("contacts/create");

                executionLog.Log("MergeContact", "Enter First Name");
                office_ContactsHelper.TypeText("FirstNAME", FName);

                executionLog.Log("MergeContact", "Enter Last Name");
                office_ContactsHelper.TypeText("LastName", LName);

                executionLog.Log("MergeContact", "Enter Company DBA Name");
                office_ContactsHelper.TypeText("CompanyName", CDBA);

                executionLog.Log("MergeContact", "Save Contact");
                office_ContactsHelper.ClickElement("SaveContactN");
                office_ContactsHelper.WaitForWorkAround(3000);

                if (office_ContactsHelper.IsElementPresent("//h3[text()='Existing Contacts']"))
                {
                    executionLog.Log("MergeContact", "Click on Dublicate");
                    office_ContactsHelper.ClickElement("ClickOnDuplicate");

                    executionLog.Log("MergeContact", "Confirmation");
                    office_ContactsHelper.WaitForText("A Contact has been created.", 10);

                    executionLog.Log("MergeContact", "Visit Contact");
                    VisitOffice("contacts");

                    executionLog.Log("MergeContact", "Select 1st contact");
                    office_ContactsHelper.ClickElement("SelectIstContact");
                    office_ContactsHelper.WaitForWorkAround(1000);

                    executionLog.Log("MergeContact", "Select 2nd contact");
                    office_ContactsHelper.ClickElement("Select2ndContact");
                    office_ContactsHelper.WaitForWorkAround(1000);

                    executionLog.Log("MergeContact", "Click on merge records.");
                    office_ContactsHelper.ClickElement("MergeRecordContact");
                    office_ContactsHelper.WaitForWorkAround(2000);

                    executionLog.Log("MergeContact", "Select Primary Contact.");
                    office_ContactsHelper.ClickElement("SelectCompContact");
                    office_ContactsHelper.WaitForWorkAround(2000);

                    executionLog.Log("MergeContact", "Click On Merge");
                    office_ContactsHelper.ClickElement("ClickOnMergeBtn");
                    office_ContactsHelper.AcceptAlert();

                    executionLog.Log("MergeContact", "Wait for success message.");
                    office_ContactsHelper.WaitForText("Merging Contact(s) Completed Successfully.", 10);
                }
                else
                {
                    executionLog.Log("MergeContact", "Wait for Confirmatoion");
                    office_ContactsHelper.WaitForText("A Contact has been created.", 10);

                    executionLog.Log("MergeContact", "Visist Contact");
                    VisitOffice("contacts");

                    executionLog.Log("MergeContact", "Select 1st Contact");
                    office_ContactsHelper.ClickElement("SelectIstContact");

                    executionLog.Log("MergeContact", "Select 2nd Contact");
                    office_ContactsHelper.ClickElement("Select2ndContact");

                    executionLog.Log("MergeContact", "Merge Record Contact");
                    office_ContactsHelper.ClickElement("MergeRecordContact");

                    executionLog.Log("MergeContact", "Select Comp Contact");
                    office_ContactsHelper.ClickElement("SelectCompContact");

                    executionLog.Log("MergeContact", "Click on Merge Button");
                    office_ContactsHelper.ClickElement("ClickOnMergeBtn");
                    office_ContactsHelper.AcceptAlert();

                    executionLog.Log("MergeContact", "Wait for Confirmation");
                    office_ContactsHelper.WaitForText("Merging Contact(s) Completed Successfully.", 10);
                }
            }

            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

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