예제 #1
0
        public void deleteInactiveProducts()
        {
            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 products_ProductHelper = new Products_ProductHelper(GetWebDriver());

            // Variable
            var    name   = "Test" + GetRandomNumber();
            String JIRA   = "";
            String Status = "Pass";

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

                executionLog.Log("Delete Inactive Products", "Verify Page title");
                VerifyTitle("Dashboard");

                executionLog.Log("Delete Inactive Products", "Click On  Admin");
                VisitOffice("admin");

                executionLog.Log("Delete Inactive Products", "Redirect To Profucts");
                VisitOffice("products");

                executionLog.Log("Delete Inactive Products", "Verify title");
                VerifyTitle("Products");

                executionLog.Log("Delete Inactive Products", " Click On Create");
                products_ProductHelper.ClickElement("Create");

                executionLog.Log("Delete Inactive Products", "verify title");
                VerifyTitle("Products");

                executionLog.Log("Delete Inactive Products", "Enter Name");
                products_ProductHelper.TypeText("Name", name);

                executionLog.Log("Delete Inactive Products", "Select Category");
                products_ProductHelper.ClickElement("Category");

                executionLog.Log("Delete Inactive Products", " Click On Category");
                products_ProductHelper.ClickElement("AddCustomField");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("Delete Inactive Products", "Enter Filed name");
                products_ProductHelper.TypeText("FieldName", "Test");

                executionLog.Log("Delete Inactive Products", "Select Type");
                products_ProductHelper.Select("Type", "textbox");

                executionLog.Log("Delete Inactive Products", "Select Type");
                products_ProductHelper.Select("ContentType", "text");

                executionLog.Log("Delete Inactive Products", "Enter Filed name");
                products_ProductHelper.TypeText("DataLength", "10");

                executionLog.Log("Delete Inactive Products", "Select Data Validation");
                products_ProductHelper.Select("DataValidation", "email");

                executionLog.Log("Delete Inactive Products", "Click on Required CheckBox");
                products_ProductHelper.ClickElement("Required");
                products_ProductHelper.WaitForWorkAround(1000);

                executionLog.Log("Delete Inactive Products", "Enter Description");
                products_ProductHelper.TypeText("Description", "THIS IS TESTING DESCRIPTION");

                executionLog.Log("Delete Inactive Products", "  Click on Save button");
                products_ProductHelper.ClickElement("Save1");
                products_ProductHelper.WaitForWorkAround(2000);

                executionLog.Log("Delete Inactive Products", "Wait for save button to present.");
                products_ProductHelper.WaitForElementPresent("Save", 10);

                executionLog.Log("Delete Inactive Products", "Click on Save btn.");
                products_ProductHelper.ClickElement("Save");
                products_ProductHelper.WaitForWorkAround(1000);

                executionLog.Log("Delete Inactive Products", "Redirect To Profucts");
                VisitOffice("products");

                executionLog.Log("Delete Inactive Products", "Verify title");
                VerifyTitle("Products");

                executionLog.Log("Delete Inactive Products", "Enter Name to search");
                products_ProductHelper.TypeText("SearchProduct", name);
                products_ProductHelper.WaitForWorkAround(2000);

                executionLog.Log("Delete Inactive Products", "Click on edit icon");
                products_ProductHelper.ClickElement("Edit");

                executionLog.Log("Delete Inactive Products", "Select status as inactive.");
                products_ProductHelper.Select("Status", "0");

                executionLog.Log("Delete Inactive Products", "Click on save button.");
                products_ProductHelper.ClickElement("Save");

                executionLog.Log("Delete Inactive Products", "Enter Name to search");
                products_ProductHelper.TypeText("SearchProduct", name);
                products_ProductHelper.WaitForWorkAround(2000);

                executionLog.Log("Delete Inactive Products", "Click Delete btn  ");
                products_ProductHelper.ClickElement("DeleteProduct");

                executionLog.Log("Delete Inactive Products", "Accept alert message. ");
                products_ProductHelper.AcceptAlert();

                executionLog.Log("Delete Inactive Products", "Wait for delete message. ");
                products_ProductHelper.WaitForText("Product Deleted Successfully", 10);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

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

            // VARIABLE
            var    name   = "Delete " + GetRandomNumber();
            String JIRA   = "";
            String Status = "Pass";

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

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

                executionLog.Log("DeleteProductAdmin", "Redirect To Product page");
                VisitOffice("products");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("DeleteProductAdmin", "ClickOnCreate");
                products_ProductHelper.ClickElement("Create");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("DeleteProductAdmin", "Enter ProductName");
                products_ProductHelper.TypeText("Name", name);

                executionLog.Log("DeleteProductAdmin", "ClickSaveProdBtn");
                products_ProductHelper.ClickElement("Save");

                executionLog.Log("DeleteProductAdmin", "Wait for success message.");
                products_ProductHelper.WaitForText("Product Created Successfully", 10);

                executionLog.Log("DeleteProductAdmin", "Redirect to product page");
                VisitOffice("products");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("DeleteProductAdmin", "Search Product");
                products_ProductHelper.TypeText("SearchProduct", name);
                products_ProductHelper.WaitForWorkAround(2000);

                executionLog.Log("DeleteProductAdmin", "Click on delete product");
                products_ProductHelper.ClickElement("DeleteProduct");

                executionLog.Log("DeleteProductAdmin", "Accept Alert messsage.");
                products_ProductHelper.AcceptAlert();

                executionLog.Log("DeleteProductAdmin", "Wait for success message.");
                products_ProductHelper.WaitForText("Product Deleted Successfully", 10);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

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

            // Variable

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

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

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

                executionLog.Log("ProductUpdateDate", "Goto Product tab.");
                VisitOffice("products");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("ProductUpdateDate", "Select first checkbox");
                products_ProductHelper.ClickElement("SelectCheckBoxForFirst");
                products_ProductHelper.WaitForWorkAround(3000);

                products_ProductHelper.ClickElement("BulkUpdateButton");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("ProductUpdateDate", "Click on Change Default View button.");
                products_ProductHelper.ClickElement("ChangeDefaultView");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("ProductUpdateDate", "Select Collapse Default View.");
                products_ProductHelper.SelectByText("SelectDefaultView", "Collapse");

                executionLog.Log("ProductUpdateDate", "Click on Update button.");
                products_ProductHelper.ClickDisplayed("//button[text()='Update']");

                executionLog.Log("ProductUpdateDate", "Accept Alert.");
                products_ProductHelper.AcceptAlert();
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("ProductUpdateDate", "Verify current date for updated product.");
                string date  = System.DateTime.Today.ToString("dd/MM/yy");
                var    loc22 = "//table[@id='list1']//tr[2]//td[contains(@title,'" + date + "')]";
                products_ProductHelper.IsElementPresent(loc22);
            }

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

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

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

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

                executionLog.Log("AdminProductChangeUrl", "Redirect To Admin");
                VisitOffice("admin");
                products_ProductHelper.WaitForWorkAround(1000);

                executionLog.Log("AdminProductChangeUrl", "Goto Product >> Product");
                VisitOffice("products");

                executionLog.Log("AdminProductChangeUrl", "Click On Any Product");
                products_ProductHelper.ClickElement("ClickProduct1");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("AdminProductChangeUrl", "Change url of the page.");
                VisitOffice("products/edit/121");

                executionLog.Log("AdminProductChangeUrl", "Verify You don't have privilege.");
                products_ProductHelper.WaitForText("You don't have privilege.", 20);
                Console.WriteLine("Passed");
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

                String counter     = executionLog.readLastLine("counter");
                String Description = executionLog.GetAllTextFile("AdminProductChangeUrl");
                String Error       = executionLog.GetAllTextFile("Error");
                Console.WriteLine(Error);
                if (counter == "")
                {
                    counter = "0";
                }
                bool result = loginHelper.CheckExstingIssue("Admin Product Change Url");
                if (!result)
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        loginHelper.CreateIssue("Admin Product Change Url", "Bug", "Medium", "Office Admin", "QA", "Log in as: " + username[0] + " / " + password[0] + "\n\nSteps:\n" + Description + "\n\n\nError Description:\n" + Error);
                        string id = loginHelper.getIssueID("Admin Product Change Url");
                        TakeScreenshot("AdminProductChangeUrl");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\AdminProductChangeUrl.png";
                        loginHelper.AddAttachment(location, id);
                    }
                }
                else
                {
                    if (Int16.Parse(counter) < 9)
                    {
                        executionLog.Count("counter", (Int16.Parse(counter) + 1).ToString());
                        TakeScreenshot("AdminProductChangeUrl");
                        string id            = loginHelper.getIssueID("Admin Product Change Url");
                        string directoryName = loginHelper.GetnewDirectoryName(GetPath());
                        var    location      = directoryName + "\\AdminProductChangeUrl.png";
                        loginHelper.AddAttachment(location, id);
                        loginHelper.AddComment(loginHelper.getIssueID("Admin Product Change Url"), "This issue is still occurring");
                    }
                }
                JIRA = loginHelper.getIssueID("Admin Product Change Url");
                // executionLog.DeleteFile("Error");
                throw;
            }
            finally
            {
                executionLog.DeleteFile("AdminProductChangeUrl");
                executionLog.WriteInExcel("Admin Product Change Url", Status, JIRA, "Admin Products");
            }
        }
예제 #5
0
        public void productManagement()
        {
            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 products_CategoryHelper = new Products_CategoryHelper(GetWebDriver());
            var products_ProductHelper  = new Products_ProductHelper(GetWebDriver());
            var office_ClientsHelper    = new Office_ClientsHelper(GetWebDriver());

            // Variable
            string name        = "Test" + RandomNumber(1, 999);
            var    ProductName = "Product" + RandomNumber(1, 999);
            String JIRA        = "";
            String Status      = "Pass";

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

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

                executionLog.Log("ProductManagement", "Click On  Admin");
                VisitOffice("admin");

                executionLog.Log("ProductManagement", "Redirect To Product categories page.");
                VisitOffice("products/categories");

                executionLog.Log("ProductManagement", "Verify title");
                VerifyTitle("Product Categories");

                executionLog.Log("ProductManagement", " Click On Create");
                products_CategoryHelper.ClickElement("Create");

                executionLog.Log("ProductManagement", " Wait for save button to present.");
                products_CategoryHelper.WaitForElementPresent("Save", 10);

                executionLog.Log("ProductManagement", " Click on Save button.");
                products_CategoryHelper.ClickElement("Save");

                executionLog.Log("ProductManagement", "Verify Validation for Name");
                products_CategoryHelper.VerifyText("NameError", "This field is required.");

                executionLog.Log("ProductManagement", "Enter Name");
                products_CategoryHelper.TypeText("Name", name);

                executionLog.Log("ProductManagement", "Select default view.");
                products_CategoryHelper.Select("DefaultView", "0");

                executionLog.Log("ProductManagement", " Click on Save button.");
                products_CategoryHelper.ClickElement("Save");

                executionLog.Log("ProductManagement", "Wait for success message.n");
                products_CategoryHelper.WaitForText("Category Created Successfully", 10);
                products_CategoryHelper.WaitForWorkAround(5000);

                executionLog.Log("ProductManagement", "Redirect at products page.");
                VisitOffice("products");

                executionLog.Log("ProductManagement", "Verify title");
                VerifyTitle("Products");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("ProductManagement", " Click On Create");
                products_ProductHelper.ClickElement("Create");

                executionLog.Log("ProductManagement", "verify page title");
                VerifyTitle("Products");

                executionLog.Log("ProductManagement", "Enter product Name");
                products_ProductHelper.TypeText("Name", ProductName);

                executionLog.Log("ProductManagement", "Select product Category");
                products_ProductHelper.SelectByText("Category", name);

                executionLog.Log("ProductManagement", "Click on Save btn.");
                products_ProductHelper.ClickElement("Save");

                executionLog.Log("ProductManagement", "Click On  Admin");
                products_CategoryHelper.WaitForText("Product Created Successfully", 10);

                executionLog.Log("ProductManagement", "Redirect To Product categorie page.");
                VisitOffice("products/categories");

                executionLog.Log("ProductManagement", "Verify delete button is not displayed for product category.");
                products_CategoryHelper.VerifyDeleteButton(name);
                products_CategoryHelper.WaitForWorkAround(3000);

                executionLog.Log("ProductManagement", "Redirect To Products");
                VisitOffice("products");

                executionLog.Log("ProductManagement", "Verify title");
                VerifyTitle("Products");

                executionLog.Log("ProductManagement", "Enter Name to search");
                products_ProductHelper.TypeText("SearchProduct", ProductName);
                products_ProductHelper.WaitForWorkAround(2000);

                executionLog.Log("ProductManagement", "Delete the created product.");
                products_ProductHelper.ClickElement("DeleteProduct");

                executionLog.Log("ProductManagement", "Accept alert message.");
                products_ProductHelper.AcceptAlert();

                executionLog.Log("ProductManagement", "Wait for delete success message.");
                products_ProductHelper.WaitForText("Product Deleted Successfully", 10);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

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

            var    Name    = "QaProduct" + RandomNumber(1, 100);
            var    prodcat = "ProdCat" + GetRandomNumber();
            String JIRA    = "";
            String Status  = "Pass";

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

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

                executionLog.Log("ProductIpage", "Redirect To product categories");
                VisitOffice("products/categories");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("ProductIpage", "Click on Create button");
                products_CategoryHelper.ClickElement("Create");
                products_CategoryHelper.WaitForWorkAround(1000);

                executionLog.Log("ProductIpage", "Click on Create button");
                products_CategoryHelper.TypeText("Name", prodcat);

                executionLog.Log("ProductIpage", "Click on Save button");
                products_CategoryHelper.ClickElement("Save");
                products_CategoryHelper.WaitForWorkAround(3000);

                executionLog.Log("CreateProducts", "Redirect To Profucts");
                VisitOffice("products/create");
                products_ProductHelper.WaitForWorkAround(4000);

                executionLog.Log("CreateProducts", "Enter the name of the product");
                products_ProductHelper.TypeText("Name", Name);

                executionLog.Log("CreateProducts", "Select the category of the product");
                products_ProductHelper.SelectByText("Category", prodcat);

                executionLog.Log("CreateProducts", " Click On Category");
                products_ProductHelper.ClickElement("AddCustomField");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("CreateProducts", "Enter Filed name");
                products_ProductHelper.TypeText("FieldName", "Test");

                executionLog.Log("CreateProducts", "Select Type");
                products_ProductHelper.Select("Type", "textbox");

                executionLog.Log("CreateProducts", "Select Type");
                products_ProductHelper.Select("ContentType", "text");

                executionLog.Log("CreateProducts", "Enter Filed name");
                products_ProductHelper.TypeText("DataLength", "10");

                executionLog.Log("CreateProducts", "Select Data Validation");
                products_ProductHelper.Select("DataValidation", "email");

                executionLog.Log("CreateProducts", "Click on Required CheckBox");
                products_ProductHelper.ClickElement("Required");
                products_ProductHelper.WaitForWorkAround(2000);

                executionLog.Log("CreateProducts", "Enter Description");
                products_ProductHelper.TypeText("Description", "THIS IS TESTING DESCRIPTION");

                executionLog.Log("CreateProducts", "  Click on Save button");
                products_ProductHelper.ClickElement("Save1");
                products_ProductHelper.WaitForElementPresent("Save", 5);

                executionLog.Log("CreateProducts", "Click on Save btn.");
                products_ProductHelper.ClickJS("Save");
                products_ProductHelper.WaitForWorkAround(5000);

                executionLog.Log("CreateProducts", "Search the same product");
                products_ProductHelper.TypeText("SearchProduct", Name);
                products_ProductHelper.WaitForWorkAround(4000);

                executionLog.Log("ProductMaxLength", "Open first product");
                products_ProductHelper.ClickElement("ClickProduct1");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("ProductMaxLength", "Verify title");
                VerifyTitle("Products");

                executionLog.Log("ProductMaxLength", "Click on Add custom field");
                products_ProductHelper.ClickElement("AddCustomField");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("ProductMaxLength", "Select Text Box type");
                products_ProductHelper.SelectByText("CustomType", "Text Box");

                executionLog.Log("ProductMaxLength", "Enter value in the Data length field");
                products_ProductHelper.TypeText("EditDataLength", "30");

                executionLog.Log("ProductMaxLength", "Select Number as content type");
                products_ProductHelper.SelectByText("EditContenttypt", "Number");

                executionLog.Log("ProductMaxLength", "Verify Data length");
                Assert.IsTrue(products_ProductHelper.GetValue("//*[@id='ProductCustomFieldEditDataLength']").Contains("30"));

                executionLog.Log("ProductMaxLength", "Select text as content type");
                products_ProductHelper.SelectByText("EditContenttypt", "Text");

                executionLog.Log("ProductMaxLength", "Verify Data length");
                Assert.IsTrue(products_ProductHelper.GetValue("//*[@id='ProductCustomFieldEditDataLength']").Contains("30"));

                executionLog.Log("CreateProducts", "  Click on Save button");
                products_ProductHelper.ClickElement("Save1");
                products_ProductHelper.WaitForElementPresent("Save", 5);

                executionLog.Log("CreateProducts", "Click on Save btn.");
                products_ProductHelper.ClickJS("Save");
                products_ProductHelper.WaitForWorkAround(4000);

                executionLog.Log("CreateProducts", "Enter Name to search");
                products_ProductHelper.TypeText("SearchProduct", Name);
                products_ProductHelper.WaitForWorkAround(5000);

                executionLog.Log("CreateProducts", "Click Delete btn  ");
                products_ProductHelper.ClickElement("DeleteProduct");

                executionLog.Log("CreateProducts", "Accept alert message. ");
                products_ProductHelper.AcceptAlert();

                executionLog.Log("CreateProducts", "Wait for delete message. ");
                products_ProductHelper.WaitForText("Product Deleted Successfully", 10);

                executionLog.Log("ProductIpage", "Redirect To product categories");
                VisitOffice("products/categories");
                products_ProductHelper.WaitForWorkAround(3000);

                executionLog.Log("ProductIpage", "Delete category");
                products_CategoryHelper.DeleteCat(prodcat);

                executionLog.Log("ProductIpage", "Wait for success message.");
                products_CategoryHelper.WaitForText("Category Deleted Successfully", 10);
            }
            catch (Exception e)
            {
                executionLog.Log("Error", e.StackTrace);
                Status = "Fail";

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