Пример #1
0
 public void TheLoginFail_CamposVaciosTest()
 {
     selenium.Open("/");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("Ingrese datos de campos faltantes", selenium.GetText("css=div.validation-summary-errors"));
 }
Пример #2
0
 public void TheLoginFail_UsuarioFaltanteTest()
 {
     selenium.Open("/");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Type("id=Contrase_a", "root");
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("Ingrese Nombre de Usuario", selenium.GetText("css=div.validation-summary-errors"));
 }
Пример #3
0
 public void TheIniciarSesionCorrectoTest()
 {
     selenium.Open("/");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Type("id=Codigo", "root");
     selenium.Type("id=Contrase_a", "root");
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("Mantenimiento Cliente", selenium.GetText("link=Mantenimiento Cliente"));
 }
Пример #4
0
 public void TheLogOutTest()
 {
     selenium.Open("/Home/Login");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Type("id=Codigo", "root");
     selenium.Type("id=Contrase_a", "root");
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("LstCliente", selenium.GetText("css=h2"));
     selenium.Click("id=logout");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
 }
Пример #5
0
 public void TheEliminarCancelarTest()
 {
     selenium.Open("/Home/Login");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Type("id=Codigo", "root");
     selenium.Type("id=Contrase_a", "root");
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("LstCliente", selenium.GetText("css=h2"));
     selenium.ChooseCancelOnNextConfirmation();
     selenium.Click("xpath=(//a[@onclick=\"return confirm('Desea aliminar')\"])[13]");
     Assert.AreEqual("Desea aliminar", selenium.GetConfirmation());
     Assert.AreEqual("LstCliente", selenium.GetText("css=h2"));
 }
Пример #6
0
 public void TheEliminarCorrectoTest()
 {
     selenium.Open("/Home/Login");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Type("id=Codigo", "root");
     selenium.Type("id=Contrase_a", "root");
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("LstCliente", selenium.GetText("css=h2"));
     selenium.Click("xpath=(//a[@onclick=\"return confirm('Desea aliminar')\"])[13]");
     Assert.AreEqual("Desea aliminar", selenium.GetConfirmation());
     selenium.WaitForPageToLoad("3000");
     Assert.AreEqual("Se elimino satisfactoriamente el cliente", selenium.GetText("css=div.validation-summary-errors"));
 }
Пример #7
0
 public void TheEditarCancelarTest()
 {
     selenium.Open("/Home/Login");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Type("id=Codigo", "root");
     selenium.Type("id=Contrase_a", "root");
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("//a[contains(@href, '/Home/EditarCliente?ClienteId=130')]");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("link=Cancelar");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("LstCliente", selenium.GetText("css=h2"));
 }
Пример #8
0
        public string GetText(string locator)
        {
            bool actRes = false; string resStr = "", errStr = "";

            try
            {
                resStr = selenium.GetText(locator);
                actRes = true;
            }
            catch (System.Exception ex)
            {
                errStr = ex.ToString();
            }

            res = new ResultClass()
            {
                Decp = "GetText, " + locator,
                Res  = actRes ? "pass" : "fail",
                Tdev = " ms",
                Err  = errStr,
            };
            BaseListOfResItems.Add(res);

            return(resStr);
        }
Пример #9
0
        public void VerifyText(String expected, String id)
        {
            //Console.Out.WriteLine(expected);
            Assert.IsTrue(selenium.IsTextPresent(expected));
            String actual = selenium.GetText(id);

            Assert.AreEqual(expected, actual, id + " didn't match");
        }
Пример #10
0
 public void TheEditarCorrectoTest()
 {
     selenium.Open("/Home/Login");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Type("id=Codigo", "root");
     selenium.Type("id=Contrase_a", "root");
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("LstCliente", selenium.GetText("css=h2"));
     selenium.Click("//a[contains(@href, '/Home/EditarCliente?ClienteId=130')]");
     selenium.WaitForPageToLoad("30000");
     selenium.Type("id=DNI", "12345677");
     selenium.Click("css=button.btn.btn-default");
     Assert.AreEqual("Desea Editar al cliente", selenium.GetConfirmation());
     selenium.WaitForPageToLoad("3000");
     Assert.AreEqual("Se Edito satisfactoriamente el cliente", selenium.GetText("css=div.validation-summary-errors"));
 }
Пример #11
0
 public void TheRegistrarCamposVaciosTest()
 {
     selenium.Open("/Home/Login");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Type("id=Codigo", "root");
     selenium.Type("id=Contrase_a", "root");
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("Mantenimiento Cliente", selenium.GetText("link=Mantenimiento Cliente"));
     selenium.Click("link=Agregar");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("RegistrarCliente", selenium.GetText("css=h2"));
     selenium.Click("css=button.btn.btn-default");
     Assert.AreEqual("Desea Registrar", selenium.GetConfirmation());
     selenium.WaitForPageToLoad("3000");
     Assert.AreEqual("Ingresar Campos Faltantes", selenium.GetText("css=div.validation-summary-errors"));
 }
Пример #12
0
 public void TheEditarCampoVacioTest()
 {
     selenium.Open("/Home/Login");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Type("id=Codigo", "root");
     selenium.Type("id=Contrase_a", "root");
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("LstCliente", selenium.GetText("css=h2"));
     selenium.Click("//a[contains(@href, '/Home/EditarCliente?ClienteId=130')]");
     selenium.WaitForPageToLoad("30000");
     selenium.Type("id=Edad", "20");
     selenium.Type("id=Apellidos", "");
     selenium.Click("css=button.btn.btn-default");
     selenium.WaitForPageToLoad("3000");
     Assert.AreEqual("Desea Editar al cliente", selenium.GetConfirmation());
     selenium.WaitForPageToLoad("3000");
     Assert.AreEqual("EditarCliente", selenium.GetText("css=h2"));
 }
Пример #13
0
        public void Test2_BanComputer()
        {
            selenium.Open("/Security/Index");
            selenium.Click("//a[contains(text(),'Ban computer')]");
            selenium.WaitForPageToLoad("30000");
            selenium.Click("//a[contains(@href, '/Ban/ComputerBan?computer=25.25.26.23')]");
            selenium.WaitForPageToLoad("30000");
            try
            {
                Assert.AreEqual("True", selenium.GetText("//div[@id='main']/table/tbody/tr[2]/td[4]"));
            }
            catch (AssertionException e)
            {
                // verificationErrors.Append(e.Message);
            }

            selenium.Click("//a[contains(@href, '/Security/Index')]");
            selenium.WaitForPageToLoad("30000");
        }
Пример #14
0
        public void CheckTeacherAccessToUser()
        {
            selenium.Open("/");
            selenium.Type("//input[@id='loginUsername']", "prof");
            selenium.Type("//input[@id='loginPassword']", "prof");
            selenium.Click("//div[@id='logindisplay']/form[2]/input[3]");
            selenium.WaitForPageToLoad("30000");
            selenium.Click("link=" + IUDICO.UserManagement.Localization.getMessage("Account"));
            selenium.WaitForPageToLoad("30000");

            if (selenium.IsElementPresent("link=" + IUDICO.UserManagement.Localization.getMessage("UpgradeToAdmin")))
            {
                selenium.Click("link=" + IUDICO.UserManagement.Localization.getMessage("UpgradeToAdmin"));
                selenium.WaitForPageToLoad("30000");
            }

            selenium.Click("link=" + IUDICO.UserManagement.Localization.getMessage("Users"));
            selenium.WaitForPageToLoad("30000");
            string headerText = selenium.GetText("//div[@id='main']/h2");

            Assert.IsTrue(headerText == IUDICO.UserManagement.Localization.getMessage("Users"));
        }
Пример #15
0
 public void TheRegistrarDatosInvalidosTest()
 {
     selenium.Open("/Home/Login");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Type("id=Codigo", "root");
     selenium.Type("id=Contrase_a", "root");
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("LstCliente", selenium.GetText("css=h2"));
     selenium.Click("link=Agregar");
     selenium.WaitForPageToLoad("30000");
     selenium.Type("id=Nombre", "1234561");
     selenium.Type("id=Apellidos", "123456");
     selenium.Type("id=DNI", "kkk");
     selenium.Type("id=Edad", "j");
     selenium.Select("id=Nivel", "label=Universitario");
     selenium.Type("id=Telefono", "kkl");
     selenium.Click("css=button.btn.btn-default");
     Assert.AreEqual("Desea Registrar", selenium.GetConfirmation());
     selenium.WaitForPageToLoad("3000");
     Assert.AreEqual("Datos Incorrectos", selenium.GetText("css=div.validation-summary-errors"));
 }
Пример #16
0
 public void TheRegistrar_CancelarTest()
 {
     selenium.Open("/Home/Login");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Type("id=Codigo", "root");
     selenium.Type("id=Contrase_a", "root");
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("Mantenimiento Cliente", selenium.GetText("link=Mantenimiento Cliente"));
     selenium.Click("link=Agregar");
     selenium.WaitForPageToLoad("30000");
     selenium.Type("id=Nombre", "Maria");
     selenium.Type("id=Apellidos", "Magdalena");
     selenium.Type("id=DNI", "12345677");
     selenium.Type("id=Edad", "20");
     selenium.Select("id=Sexo", "label=Femenino");
     selenium.Select("id=Nivel", "label=Universitario");
     selenium.Type("id=Telefono", "123456789");
     selenium.ChooseCancelOnNextConfirmation();
     selenium.Click("css=button.btn.btn-default");
     Assert.AreEqual("Desea Registrar", selenium.GetConfirmation());
     Assert.AreEqual("RegistrarCliente", selenium.GetText("css=h2"));
 }
Пример #17
0
 public void TheRegistrarCorrectoTest()
 {
     selenium.Open("/");
     Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header"));
     selenium.Type("id=Codigo", "root");
     selenium.Type("id=Contrase_a", "root");
     selenium.Click("css=input[type=\"submit\"]");
     selenium.WaitForPageToLoad("30000");
     Assert.AreEqual("Mantenimiento Cliente", selenium.GetText("link=Mantenimiento Cliente"));
     selenium.Click("link=Agregar");
     selenium.WaitForPageToLoad("30000");
     selenium.Type("id=Nombre", "Maria");
     selenium.Type("id=Apellidos", "Magdalena");
     selenium.Type("id=DNI", "12345678");
     selenium.Type("id=Edad", "20");
     selenium.Select("id=Sexo", "label=Femenino");
     selenium.Select("id=Nivel", "label=Superior");
     selenium.Type("id=Telefono", "123456789");
     selenium.Click("css=button.btn.btn-default");
     Assert.AreEqual("Desea Registrar", selenium.GetConfirmation());
     selenium.WaitForPageToLoad("3000");
     Assert.AreEqual("Se Registro satisfactoriamente el cliente", selenium.GetText("css=div.validation-summary-errors"));
 }
        public void IISIntegrationTest()
        {
            String inputId  = "ac4";
            String updateId = "ac4update";

            selenium.Open("http://www.irian.at/selenium-server/tests/html/ajax/ajax_autocompleter2_test.html");
            selenium.KeyPress(inputId, "\\74");
            Thread.Sleep(500);
            selenium.KeyPress(inputId, "\\97");
            selenium.KeyPress(inputId, "\\110");
            Thread.Sleep(500);
            Assert.AreEqual("Jane Agnews", selenium.GetText(updateId));
            selenium.KeyPress(inputId, "\\9");
            Thread.Sleep(500);
            Assert.AreEqual("Jane Agnews", selenium.GetValue(inputId));
        }
        public void TheXero_NewInventory_NewRepInvoiceTest()
        {
            selenium.Open("/");

            //Maximizing the window
            selenium.WindowMaximize();

            //check for "Welcome to XERO" text on the Login Page
            try
            {
                Assert.AreEqual("Welcome to Xero", selenium.GetText("css=h2.x-boxed.noBorder"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Entering the credentials for Login
            selenium.Type("id=email", "*****@*****.**");
            selenium.Type("id=password", "swamiji123");
            selenium.Click("id=submitButton");
            selenium.WaitForPageToLoad("30000");

            // Checking for the organization name "Demo NZ" on the DashBoard
            try
            {
                Assert.AreEqual("Demo NZ", selenium.GetText("id=title"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            // Navigate to the Sales page through the Accounts Tab
            selenium.Click("id=Accounts");
            selenium.Click("link=Sales");
            selenium.WaitForPageToLoad("30000");

            // Check whether the Sales page is opened
            try
            {
                Assert.AreEqual("Sales", selenium.GetText("css=#page_title > div > h1"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Navigate to the New Repeating Invoice Page by clicking the repeating invoice option in the dropdown
            selenium.Click("css=#ext-gen1037 > span");
            selenium.Click("css=li.ico-repeating-invoice > a > b");
            selenium.WaitForPageToLoad("30000");

            //Checking if the New Repeating Invoice page is opened
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Demo NZ - New Repeating Invoice" == selenium.GetText("//div[@id='bodyContainer']/div/div/h1"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Demo NZ - New Repeating Invoice", selenium.GetText("//div[@id='bodyContainer']/div/div/h1"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            // Entering all the valid inputs on the page.
            string InvoiceDate = DateTime.Now.AddDays(1).ToString("dd MMM yyyy");

            selenium.Type("id=StartDate", InvoiceDate);
            selenium.Click("id=DueDateDay");
            selenium.Type("id=DueDateDay", "1");
            selenium.Click("id=DueDateType_toggle");
            selenium.Click("//div[@id='DueDateType_suggestions']/div/div[2]");
            selenium.Click("id=saveAsAutoApproved");
            selenium.Type("//div[@id='ext-gen48']/input", "associates");
            selenium.Click("//div[@id='invoiceForm']/div/div[2]/div/input");
            selenium.Type("//div[@id='invoiceForm']/div/div[2]/div/input", "sanjana");

            // Enter data in the Item's table by adding a new item in the Inventory.
            selenium.Click("//tbody/tr/td[2]/div");
            selenium.Click("//div[2]/div/img");
            selenium.Click("//div[8]/div/div/span");
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Item Code" == selenium.GetText("css=div.field.code > label"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Item Code", selenium.GetText("css=div.field.code > label"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Entering the item code,Item name,unit Price and Description of your chioce before executing.
            // Using javascript method to randomly create the item code.
            selenium.Type("//div[@id='lineItem']/div/div/div/input", "javascript{Math.floor(Math.random()*9000)+1000}");
            selenium.Type("//div[@id='lineItem']/div/div[2]/div/input", "apples");
            selenium.Type("//div[@id='lineItem']/div[3]/div[2]/div/div/input", "40");
            selenium.Click("id=Account_toggle");
            selenium.Click("//div[@id='Account_suggestions']/div/div[12]");
            selenium.Type("//div[@id='lineItem']/div[3]/div[2]/div[4]/div/textarea", "board");
            selenium.Click("link=Save");

            Thread.Sleep(5000);

            //Save the invoice
            selenium.Click("xpath=(//button[@type='button'])[3]");
            selenium.WaitForPageToLoad("30000");


            //Checking whether the invoice is created
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Repeating Template Saved. Click to view." == selenium.GetText("//div[@id='notify01']/div/p"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Repeating Template Saved. Click to view.", selenium.GetText("//div[@id='notify01']/div/p"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }
        }
        ///<summary>
        /// This method creates a customer with the same details of a self exclusion customer
        /// <example>RegisterCustomer_selfExclusion(portalbrowser, adminbrowser) </example>
        public void RegisterCustomer_selfExclusion(ISelenium browser, ISelenium adminBrowser)
        {
            try
            {
                string regMsg, gender, xPath;
                var admincommonObj = new AdminSuite.Common();
                Random rnd = new Random();
                int rndNumber = rnd.Next(10000);

                //get details of customer in OB
                adminBrowser.WindowFocus();
                string username = "******" + rndNumber;
                admincommonObj.SelectMainFrame(adminBrowser);
                string firstname = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'First Name:')]/following-sibling::td");
                string lastname = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Last Name:')]/following-sibling::td");
                string title = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Title:')]/following-sibling::td");
                if (title.ToLower() == "mr")
                {
                    gender = "male";
                }
                else
                {
                    gender = "female";
                }

                string dob = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Date of Birth:')]/following-sibling::td");
                string[] arr = dob.Split('-');
                string DOByear = arr[0];
                System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
                string DOBmonth = mfi.GetMonthName(int.Parse(arr[1])).ToString();
                string DOBday = arr[2];

                string houseno = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Address (1)')]/following-sibling::td");
                string postcode = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Postcode:')]/following-sibling::td");

                string address1 = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(2)')]/following-sibling::td") + adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(3)')]/following-sibling::td");
                string address2 = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(3)')]/following-sibling::td");
                string city = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'City:')]/following-sibling::td");
                string email = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Email:')]/following-sibling::td");
                string teleCode = "+44";
                string telnumber = "1234567890";
                string mobnumber = "1234512345";

                string password = "******";
                string confirmPassword = "******";
                string securityQuestion = "Favourite Colour";
                string securityAnswer = "Blue";

                string accountCurrency = "UK Pound Sterling";
                string country = "United Kingdom";

                browser.WindowFocus();
                WaitForLoadingIcon_MobileLobby(browser, FrameGlobals.IconLoadTimeout);
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration Page is not displayed");

                //Enter data in all the fields
                browser.Type(MobileLobbyControls.promocode, "");
                browser.Select(MobileLobbyControls.title, title);
                browser.Type(MobileLobbyControls.firstname, firstname);
                browser.Type(MobileLobbyControls.lastname, lastname);
                //gender
                if (gender.ToLower().Trim() == "male")
                {
                    browser.Click(MobileLobbyControls.genderMale);
                }
                else
                {
                    browser.Click(MobileLobbyControls.genderFemale);
                }

                browser.Select(MobileLobbyControls.DOBday, DOBday);
                browser.Select(MobileLobbyControls.DOBmonth, DOBmonth);
                browser.Select(MobileLobbyControls.DOByear, DOByear);
                browser.Select(MobileLobbyControls.country, country);

                browser.Type(MobileLobbyControls.housename, houseno);
                browser.Type(MobileLobbyControls.postcode, postcode);
                browser.Type(MobileLobbyControls.address1, address1);
                browser.Type(MobileLobbyControls.address2, address2);
                browser.Type(MobileLobbyControls.city, city);
                browser.Type(MobileLobbyControls.email, email);

                browser.Type(MobileLobbyControls.telintcode, teleCode);
                browser.Type(MobileLobbyControls.telnumber, telnumber);
                browser.Type(MobileLobbyControls.mobintcode, teleCode);
                browser.Type(MobileLobbyControls.mobnumber, mobnumber);
                browser.Select(MobileLobbyControls.accountCurrency, accountCurrency);

                browser.Type(MobileLobbyControls.username, username);
                browser.Type(MobileLobbyControls.password, password);
                browser.Type(MobileLobbyControls.confirmPassword, confirmPassword);
                browser.Select(MobileLobbyControls.securityQuestion, securityQuestion);
                browser.Type(MobileLobbyControls.securityAnswer, securityAnswer);
                MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.contactMe, "on");
                MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.aggreement, "on");
                Thread.Sleep(1000);

                //Validate registration
                clickObject_MobileLobby(browser, MobileLobbyControls.registerNow);
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration page title was not found in the header after registration");
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.failureRgMsg), "Registration failure message was not displayed");

                regMsg = "We are sorry but your country of residence is currently prohibited from using the Ladbrokes service.";
                xPath = "//ul[@class='error_align']/li[contains(text()[2], '" + regMsg + "')]";
                Assert.IsTrue(browser.IsElementPresent(xPath), "Registration failure message was not displayed to the user");
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.contactMessage), "Customer contact message was not displayed on failing to create a  customer from banned country");
                Console.WriteLine("Customer was not registered as his details provided matched a self excluded customer");
            }
            catch (Exception ex)
            {
                CaptureScreenshot(browser, "EnterRegisterDetails");
                Console.WriteLine("Function 'EnterRegisterDetails' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
            }
        }
Пример #21
0
        /// <summary>       
        /// This method gets the customer's last name
        /// </summary>
        /// <Author>Kiran</Author>
        /// <Date>10 July 2012</Date>
        /// <param name="browser">Browser Instance</param>
        /// <param name="custName">name of the customer</param>
        /// <example>GetCustLastName(browser, Livetestgbp)</example> 
        public string GetCustLastName(ISelenium browser, string custName)
        {
            string lName = "";
            try
            {

                if (AdminSearchCustomer(browser, custName) == true)
                {

                    lName = browser.GetText("//td/table/tbody/tr/td[@class='caption' and contains(text(), 'First Name')]/following-sibling::td");

                }
                return lName;

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return null;
            }
        }
        ///<summary>
        /// This method verifies the Decimal/Fractional odd type switcher changes the odd thetheir respective format
        /// <example>VerifyDecimalFractionalOddType(MyBrowser, "Competition", testDataLst[0].ClassName, testDataLst[0].TypeName, testDataLst[0].SubTypeName, testDataLst[0].EventName, testDataLst[0].MarketName, testDataLst[0].SelectionName, testDataLst[0].Odds, "Decimal/Fractional");                      
        public void VerifyDecimalFractionalOddType(ISelenium browser, string sidebarLink, string navPanel, string className, string typeName, string subTypeName, string eventName, string marketName, string selection, string odds, string oddType)
        {
            try
            {
                string xPath, actOddType;
                IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;

                HGFbetslipObj.NavigateToEventDetailsPage(browser, sidebarLink, navPanel, className, typeName, subTypeName, eventName, marketName);

                //Verify the odd is displayed in the correct format
                xPath = "//div[@class='bxcl ml10  odds-text mr2  type' and contains(text(), '" + selection + "')]//following::span[1][@class='odds-convert']";
                actOddType = browser.GetText(xPath);
                if (oddType.ToLower() == "decimal")
                {
                    Assert.IsTrue(Convert.ToDouble(odds) == Convert.ToDouble(actOddType), "Odd type failed to switch to odd type '" + oddType + "'");
                    Console.WriteLine("Successfuly validated the Odd type switch to '" + oddType + "'");
                }
                else
                {
                    Assert.IsTrue(actOddType.Contains("/"), "Odd type failed to switch to odd type '" + oddType + "'");
                    Console.WriteLine("Successfuly validated the Odd type switch to '" + oddType + "'");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Function 'VerifyNavigationsFromEventsPage' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
            }
        }
Пример #23
0
 /// <summary>
 /// Get the value of the text-box
 /// </summary>
 /// <param name="locator">The locator.</param>
 /// <param name="type">Type of locator</param>
 /// <returns></returns>
 public string GetText(string locator, FindType type = FindType.ById)
 {
     return(_selenium.GetText(locator));
 }
        public void XeroSimple_NewRepInvoice()
        {
            selenium.Open("/");

            //Maximizing the window
            selenium.WindowMaximize();

            //check for "Welcome to XERO" text on the Login Page
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Welcome to Xero" == selenium.GetText("css=h2.x-boxed.noBorder"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Welcome to Xero", selenium.GetText("css=h2.x-boxed.noBorder"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Entering the credentials to login
            selenium.Type("id=email", "*****@*****.**");
            selenium.Type("id=password", "swamiji123");
            selenium.Click("id=submitButton");
            selenium.WaitForPageToLoad("30000");

            //Check for the organization name as"Demo NZ" on the following page
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Demo NZ" == selenium.GetText("id=title"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Demo NZ", selenium.GetText("id=title"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            // On the DashBoard page, Clicking on the "Go to Sales" Link
            selenium.Click("link=Go to Sales ›");
            selenium.WaitForPageToLoad("30000");

            //Checking whether the Sales page is opened
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Sales" == selenium.GetText("css=#page_title > div > h1"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Sales", selenium.GetText("css=#page_title > div > h1"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Click on the repeating invoice option in the dropdown on the Sales page
            selenium.Click("css=#ext-gen1037 > span");
            selenium.Click("link=Repeating invoice");
            selenium.WaitForPageToLoad("30000");

            //Checking whether the New Repeating Invoice is opened
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Demo NZ - New Repeating Invoice" == selenium.GetText("//div[@id='bodyContainer']/div/div/h1"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Demo NZ - New Repeating Invoice", selenium.GetText("//div[@id='bodyContainer']/div/div/h1"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Enter all the valid values for the Invoice page
            string InvoiceDate = DateTime.Now.AddDays(1).ToString("dd MMM yyyy");

            selenium.Type("id=StartDate", InvoiceDate);
            selenium.Type("id=DueDateDay", "1");
            selenium.Click("id=DueDateType_toggle");
            selenium.Click("//div[@id='DueDateType_suggestions']/div/div[2]");
            selenium.Click("id=saveAsAutoApproved");
            selenium.Type("//div[@id='ext-gen48']/input", "Associated Limited");
            selenium.Type("//div[@id='invoiceForm']/div/div[2]/div/input", "Sanjana");
            Thread.Sleep(300);

            //Enter the Items in the  first row of the Table from the inventory
            selenium.Click("//div[@id='ext-gen19']/div/table/tbody/tr/td[2]/div");
            selenium.Click("//div[2]/div/img");
            selenium.Click("//div[8]/div/div[5]");

            //Enter the Items in the  second row of the Table from the inventory
            selenium.Click("//div[@id='ext-gen19']/div[2]/table/tbody/tr/td[2]/div");
            selenium.Click("//div[2]/div/img");
            selenium.Click("//div[8]/div/div[6]");

            //Deleting all the un- necessary rows from the table
            selenium.Click("//div[@id='ext-gen19']/div[3]/table/tbody/tr/td[11]/div/div/div");
            selenium.Click("//div[@id='ext-gen19']/div[3]/table/tbody/tr/td[11]/div/div/div");
            selenium.Click("//div[@id='ext-gen19']/div[3]/table/tbody/tr/td[11]/div/div/div");

            //Save the invoice
            selenium.Click("xpath=(//button[@type='button'])[3]");

            //Checking whether the invoice is created
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Repeating Template Saved. Click to view." == selenium.GetText("//div[@id='notify01']/div/p"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Repeating Template Saved. Click to view.", selenium.GetText("//div[@id='notify01']/div/p"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }
        }
Пример #25
0
 /// <summary> Updates the PayoutFraction
 /// Author: Yogesh
 /// Date Created: FEb 29 2012
 /// </summary>
 /// <param name="browser">Selenium browser Instance</param>
 /// <param name="selectionId">Selection Id of the selection</param>
 /// <param name="updatePayoutFractionNumerator">Payout fraction numerator</param>
 /// <param name="updatePayoutFractionDenominator">Payout fraction denominator</param>
 /// Ex: UpdatePayourFraction(browser, "12345678", "1", "2", "3");
 /// Returns: Nothing
 public void UpdatePayoutFraction(ISelenium browser, string selectionId, string updatePayoutFractionNumerator, string updatePayoutFractionDenominator)
 {
     try
     {
         //Clicking on Event Link in LHN
         LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser);
         //Selecting TopFrame
         SelectMainFrame(browser);
         browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionId);
         browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName);
         browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn);
         _frameworkCommon.WaitUntilAllElementsLoad(browser);
         browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);
         browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton); //click on back button
         string payoutFractionNumerator = browser.GetText("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacNum']");
         string payoutFractionDenominator = browser.GetText("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacDen']");
         if (String.IsNullOrWhiteSpace(payoutFractionNumerator) && String.IsNullOrWhiteSpace(payoutFractionDenominator))
         {
             browser.Type("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacNum']", updatePayoutFractionNumerator);
             browser.Type("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacDen']", updatePayoutFractionDenominator);
         }
         // Updating the market details page
         browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton);
         browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         Console.WriteLine(ex.Message);
     }
 }
Пример #26
0
            public void TestUpload([Values("BathroomFixtures02.zip",
                                           "Bidet02.zip",
                                           "BlockTable02.zip",
                                           "Chandleir01.zip",
                                           "Chandleir03.zip",
                                           "ClassicDresser02.zip",
                                           "ClassicWoodCoffeeTable02.zip",
                                           "CoffeeTAble02.zip",
                                           "Console02.zip",
                                           "Console03.zip",
                                           "DeskLamp02.zip",
                                           "DinnerChair with arms02.zip",
                                           "DinnerChair01.zip",
                                           "DinnerChair02.zip",
                                           "DirectorsChair02.zip",
                                           "Dresser02.zip",
                                           "EasyChair02.zip",
                                           "EasyChair03.zip",
                                           "EasyChair04.zip",
                                           "ElegantCouch02.zip",
                                           "FloorLamp01.zip",
                                           "FloorLamp03.zip",
                                           "GreenChair02.zip",
                                           "GreenCouch02.zip",
                                           "Grill02.zip",
                                           "Lamp01.zip",
                                           "Lamp02.zip",
                                           "Lamp03.zip",
                                           "LargeChaise02.zip",
                                           "MetalDiningChair02.zip",
                                           "MetalDinnerChairArms02.zip",
                                           "MetalExteriorChair02.zip",
                                           "MetalPoolChair02.zip",
                                           "Microwave02.zip",
                                           "MissionTable01.zip",
                                           "MissionTable02.zip",
                                           "ModernCeilingLight02.zip",
                                           "ModernConsoleTable02.zip",
                                           "ModernEasyChair02.zip",
                                           "ModernEndTable02.zip",
                                           "ModernFloorLamp02.zip",
                                           "ModernHangingLight02.zip",
                                           "ModernSconce01.zip",
                                           "ModernSconce02.zip",
                                           "OfficeChair02.zip",
                                           "OutdoorChair02.zip",
                                           "OvenFront02.zip",
                                           "PlushCouch02.zip",
                                           "RectangularAutoman02.zip",
                                           "RollingChaise02.zip",
                                           "RoundAutoman02.zip",
                                           "RoundEndTable01.zip",
                                           "RoundEndTable02.zip",
                                           "Sconce02.zip",
                                           "ServingTrayTable02.zip",
                                           "SquareLamp02.zip",
                                           "Stool02.zip",
                                           "TableLamp02.zip",
                                           "Tent 02.zip",
                                           "Tent02.zip",
                                           "Toilet02.zip",
                                           "Umbrella 01.zip",
                                           "Umbrella01.zip",
                                           "Umbrella03.zip",
                                           "WickerAutoman02.zip",
                                           "WickerChair02.zip",
                                           "WickerCouch02.zip",
                                           "WickerOutdoorLoveseat02.zip",
                                           "WingBackChair02.zip",
                                           "WoodAndMetalCoffeeTable02.zip",
                                           "WoodAndMetalDinnerTable01.zip",
                                           "WoodAndMetalDinnerTable02.zip",
                                           "WoodenDresser02.zip",
                                           "WoodEndTable02.zip")]  string filename)
            {
                selenium.WindowMaximize();
                selenium.Open("/Default.aspx");
                selenium.WindowFocus();

                if (!UserLoggedIn)
                {
                    Login();
                }

                selenium.WaitForPageToLoad("30000");
                selenium.Open("/Users/Upload.aspx");
                selenium.WaitForPageToLoad("30000");

                path = _3DR_Testing.Properties.Settings.Default.ContentPath;
                if (String.IsNullOrEmpty(filename))
                {
                    verificationErrors.Append("Error, filename to be upload cannot be blank.");
                    return;
                }
                else if (!File.Exists(path + filename))
                {
                    verificationErrors.Append("Error, " + path + filename + " could not be found");
                    return;
                }


                bool uploadResult = UploadFile(path + filename, UploadButtonIdentifier.MODEL_UPLOAD);

                if (!uploadResult)
                {
                    return;
                }

                string windowHandle  = "selenium.browserbot.getCurrentWindow()";
                string currentFormat = "";

                try
                {
                    selenium.WaitForCondition(windowHandle + ".MODE != ''", "20000");
                    currentFormat = selenium.GetEval(windowHandle + ".MODE");
                    string formatDetectStatus = selenium.GetText("id=formatDetectStatus");
                    int    substringIndex     = formatDetectStatus.LastIndexOf("Format Detected:");
                    switch (currentFormat)
                    {
                    case "VIEWABLE":
                        Assert.GreaterOrEqual(substringIndex, 0);
                        selenium.WaitForCondition(windowHandle + ".ModelConverted == true", "120000");
                        string conversionStatus = selenium.GetText("id=conversionStatus");
                        if (conversionStatus != "Conversion Failed")
                        {
                            Assert.AreEqual("Model Ready for Viewer", conversionStatus);
                            break;
                        }
                        else
                        {
                            return;      //Conversion failed, test has ended
                        }

                    case "RECOGNIZED":
                        Assert.GreaterOrEqual(substringIndex, 0);
                        break;

                    case "MULTIPLE_RECOGNIZED":
                        Assert.AreEqual("Multiple Models Detected", formatDetectStatus);
                        return;     //We have multiple recognized models, so the test has ended

                    case "UNRECOGNIZED":
                        Assert.AreEqual("Unrecognized Format", formatDetectStatus);
                        return;     //Unrecognized format, test has ended

                    default:
                        Assert.AreEqual("Server Error", formatDetectStatus);
                        return;     //Invalid server response, test has ended
                    }
                }
                catch (SeleniumException e)
                {
                    throw new NUnit.Framework.InconclusiveException(e.Message);
                }

                string title = String.Format("Automatic Upload of {0} at {1}",
                                             filename,
                                             DateTime.Now.ToString());

                selenium.Type("id=ctl00_ContentPlaceHolder1_Upload1_TitleInput", title);
                selenium.Type("id=ctl00_ContentPlaceHolder1_Upload1_DescriptionInput", FormDefaults.Description);
                selenium.Type("id=ctl00_ContentPlaceHolder1_Upload1_TagsInput", FormDefaults.Tags);

                string nextButtonDisplay = selenium.GetEval(windowHandle + ".jQuery('#nextbutton_upload').css('display')");

                Assert.AreEqual("block", nextButtonDisplay);

                selenium.Click("id=nextbutton_upload");
                Thread.Sleep(3000);
                string imageFileName = path + FormDefaults.ScreenshotFilename;//GetImageFileName(filename);

                if (currentFormat == "VIEWABLE")
                {
                    scaleValue  = selenium.GetEval("window.g_unitscale");
                    upAxisValue = selenium.GetEval("window.g_upaxis");
                    selenium.GetEval("window.updateCamera()");
                    selenium.Click("id=SetThumbnailHeader");
                    Thread.Sleep(500);
                    selenium.Click("id=ViewableSnapshotButton");
                    selenium.WaitForCondition("var thumbnailSrc = " + windowHandle + ".jQuery('#ThumbnailPreview_Viewable').attr('src');" +
                                              "thumbnailSrc != window.thumbnailLoadingLocation && thumbnailSrc != window.previewImageLocation", "30000");
                }
                else
                {
                    if (!UploadFile(imageFileName, UploadButtonIdentifier.SCREENSHOT_RECOGNIZED))
                    {
                        return;
                    }
                }

                selenium.Click("id=nextbutton_step2");
                Thread.Sleep(3000);

                selenium.Type("id=DeveloperName", FormDefaults.DeveloperName);
                selenium.Type("id=ArtistName", FormDefaults.ArtistName);
                selenium.Type("id=DeveloperUrl", FormDefaults.DeveloperUrl);
                UploadFile(path + FormDefaults.DevLogoFilename, UploadButtonIdentifier.DEVLOGO);

                selenium.Click("id=SponsorInfoTab");

                selenium.Type("id=SponsorName", FormDefaults.SponsorName);
                UploadFile(path + FormDefaults.SponsorLogoFilename, UploadButtonIdentifier.SPONSORLOGO);

                selenium.Click("id=nextbutton_step3");
                selenium.WaitForPageToLoad("120000");

                Assert.True(selenium.IsTextPresent(FormDefaults.ArtistName));
                Assert.True(selenium.IsTextPresent(FormDefaults.DeveloperName));
                Assert.True(selenium.IsTextPresent(FormDefaults.DeveloperUrl));
                Assert.True(selenium.IsTextPresent(FormDefaults.SponsorName));
                Assert.True(selenium.IsTextPresent(FormDefaults.Description));

                int tagsCount = 0;

                string[] expectedTags = FormDefaults.Tags.Split(',');
                foreach (string s in expectedTags)
                {
                    if (selenium.IsTextPresent(s))
                    {
                        tagsCount++;
                    }
                }
                if (tagsCount < expectedTags.Length)
                {
                    throw new Exception("Not all tags were found on the details page.");
                }

                Assert.AreEqual(FormDefaults.LicenseTypeUrl, selenium.GetAttribute("ctl00_ContentPlaceHolder1_CCLHyperLink@href"));
                if (currentFormat == "VIEWABLE")
                {
                    Thread.Sleep(1000);
                    selenium.Click("xpath=//div[@id='ctl00_ContentPlaceHolder1_ViewOptionsTab']/div/ul/li[2]/a/span/span/span");
                    selenium.WaitForCondition("window.g_init == true", "60000");
                    Assert.AreEqual(scaleValue, selenium.GetEval("window.g_unitscale"));
                    Assert.AreEqual(upAxisValue.ToLower(), selenium.GetEval("window.g_upaxis").ToLower());
                }
            }
Пример #27
0
        }//end ClearTest

        ///<summary>
        ///Grab warrant data from http://www.hkex.com.hk/eng/dwrc/newissue/newlaunch.htm
        ///</summary>
        ///<returns> void </returns>
        private void WarrantDataCapture()
        {
            int start_position = startPosition;

            try
            {
                selenium1.OpenWindow("/eng/dwrc/newissue/newlaunch.htm", "WarrantListWindow");
                selenium1.WaitForPopUp("WarrantListWindow", "30000");
                selenium1.SelectWindow("WarrantListWindow");

                //Get English Content
                //while (selenium1.IsElementPresent("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[1]"))
                while (start_position <= endPosition && selenium1.IsElementPresent("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[1]"))
                {
                    String   launchDateStr    = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[11]");
                    DateTime tempLaunchDateDT = DateTime.ParseExact(launchDateStr, "dd-MM-yyyy", null);
                    DateTime temp             = coreObj.DateCalculate(scheduleDate, tempLaunchDateDT, holidayCount);

                    if (temp.Date == scheduleDate.Date)
                    {
                        HKRicTemplate hkRic = new HKRicTemplate();
                        hkRic.launchDateDT        = DateTime.ParseExact(launchDateStr, "dd-MM-yyyy", null);
                        hkRic.ricCodeStr          = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[2]");
                        hkRic.ricNameStr          = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[3]");
                        hkRic.issuerIDStr         = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[4]");
                        hkRic.underlyingStr       = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[5]");
                        hkRic.callPutStr          = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[6]");
                        hkRic.boardLotStr         = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[7]");
                        hkRic.strikeLevelStr      = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[8]");
                        hkRic.entitlementRatioStr = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[9]");
                        hkRic.issueSizeStr        = selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[10]");
                        hkRic.clearingCommDateDT  = DateTime.ParseExact(selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[12]"), "dd-MM-yyyy", null);
                        hkRic.listingDateDT       = DateTime.ParseExact(selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[13]"), "dd-MM-yyyy", null);
                        hkRic.maturityDateDT      = DateTime.ParseExact(selenium1.GetText("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[14]"), "dd-MM-yyyy", null);


                        //Get issue price
                        String url        = selenium1.GetAttribute("//table[@id='bodytable']/tbody/tr/td/table/tbody[1]/tr[" + start_position + "]/td[2]/a@href");
                        String id         = url.Substring(url.IndexOf('=') + 1, 5);
                        String summaryUrl = "http://www.hkex.com.hk/eng/dwrc/dwsummary.asp?id=" + id;
                        selenium1.OpenWindow(summaryUrl, "WarrantSummaryWindow" + start_position);
                        selenium1.WaitForPopUp("WarrantSummaryWindow" + start_position, "30000");
                        selenium1.SelectWindow("WarrantSummaryWindow" + start_position);

                        //For Equity Get underlying name
                        if (Char.IsDigit(hkRic.underlyingStr, 0))
                        {
                            hkRic.underlyingNameForStockStr = selenium1.GetText("//table[@id='bodytable']/tbody/tr[3]/td[2]").Substring(8);
                        }

                        hkRic.issuePriceStr = selenium1.GetText("//table[@id='bodytable']/tbody/tr[11]/td[2]").Substring(4);

                        selenium1.Close();

                        ricList.Add(hkRic);


                        selenium1.SelectWindow("WarrantListWindow");
                    }//end if

                    start_position++;
                }//end while

                ChineseNameCapture(start_position);

                //Get gearing and premium
                //search on page http://www.hkexnews.hk/listedco/listconews/advancedsearch/search_active_main.asp
                DataCaptureFromPDF(0);
            }//end try
            catch (SeleniumException ex)
            {
                String errLog = ex.ToString();
                selenium1.Close();
                selenium1.Stop();
                CaptureRetry(start_position);
            }
        }//end WarrantDataCapture()
Пример #28
0
        public void TheXero_DraftEmail_NewRepInvoiceTest()
        {
            selenium.Open("/");

            //Maximizing the window
            selenium.WindowMaximize();

            //check for "Welcome to XERO" text on the Login Page
            try
            {
                Assert.AreEqual("Welcome to Xero", selenium.GetText("css=h2.x-boxed.noBorder"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Entering the credentials for Login
            selenium.Type("id=email", "*****@*****.**");
            selenium.Type("id=password", "swamiji123");
            selenium.Click("id=submitButton");
            selenium.WaitForPageToLoad("30000");

            // Checking for the organization name "Demo NZ" on the DashBoard
            try
            {
                Assert.AreEqual("Demo NZ", selenium.GetText("id=title"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            // Navigate to the Sales page through the Accounts Tab
            selenium.Click("id=Accounts");
            selenium.Click("link=Sales");
            selenium.WaitForPageToLoad("30000");

            // Check whether the Sales page is opened
            try
            {
                Assert.AreEqual("Sales", selenium.GetText("css=#page_title > div > h1"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Navigate to the New Repeating Invoice Page by clicking the repeating invoice option in the dropdown
            selenium.Click("css=#ext-gen1037 > span");
            selenium.Click("link=Repeating invoice");
            selenium.WaitForPageToLoad("30000");

            //Checking if the New Repeating Invoice page is opened
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Demo NZ - New Repeating Invoice" == selenium.GetText("//div[@id='bodyContainer']/div/div/h1"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Demo NZ - New Repeating Invoice", selenium.GetText("//div[@id='bodyContainer']/div/div/h1"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            // Entering all the valid inputs on the page.
            string InvoiceDate = DateTime.Now.AddDays(1).ToString("dd MMM yyyy");

            selenium.Type("id=StartDate", InvoiceDate);
            selenium.Type("id=DueDateDay", "1");
            selenium.Click("id=DueDateType_toggle");
            selenium.Click("//div[@id='DueDateType_suggestions']/div/div[2]");

            //Checking the Drafting of Email facility of the Invoice page when we choose the Approve for sending option on the New Repeating Invoice page.
            selenium.Click("id=saveAsAutoApprovedAndEmail");
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("" == selenium.GetText("//form[@id='frmEmailStatements']/div/div/div/div/div[3]/input"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }

            //Entering the Email Id and all the other details of the customer
            selenium.Type("//form[@id='frmEmailStatements']/div/div/div/div/div[3]/input", "*****@*****.**");
            selenium.Type("//form[@id='frmEmailStatements']/div/div/div/div/div[9]/div[6]/textarea", "Hi Prabodh,\n\nHere's your [Current Month] invoice [Invoice Number] for [Invoice Total].\n\nThe amount outstanding of [Amount Due] is due on [Due Date].\n\nView and pay your bill online: [Online Invoice Link]\n\nFrom your online bill you can print a PDF, export a CSV, or create a free login and view your outstanding bills.\n\nIf you have any questions, please let us know.\n\nThanks,\n[Trading Name]");
            Thread.Sleep(1000);
            selenium.Click("//div/button");
            selenium.Type("//div[@id='ext-gen48']/input", "associated limited");
            selenium.Type("//div[@id='invoiceForm']/div/div[2]/div/input", "sanjana");
            Thread.Sleep(1000);

            //Enter data in the first row of the Item's table from the inventory
            selenium.Click("//div[@id='ext-gen19']/div/table/tbody/tr/td[2]/div");
            selenium.Click("//div[2]/div/img");
            selenium.Click("//div[@id='ext-gen84']/div[5]");

            //Deleting the unused rows
            selenium.Click("//div[@id='ext-gen19']/div[2]/table/tbody/tr/td[11]/div/div/div");
            selenium.Click("//div[@id='ext-gen19']/div[2]/table/tbody/tr/td[11]/div/div/div");
            selenium.Click("//div[@id='ext-gen19']/div[2]/table/tbody/tr/td[11]/div/div/div");
            selenium.Click("//div[@id='ext-gen19']/div[2]/table/tbody/tr/td[11]/div/div/div");

            //Saving the data
            selenium.Click("xpath=(//button[@type='button'])[3]");

            //Checking whether the invoice is created
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Repeating Template Saved. Click to view." == selenium.GetText("//div[@id='notify01']/div/p"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Repeating Template Saved. Click to view.", selenium.GetText("//div[@id='notify01']/div/p"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            // Deleting all the invoices made
            selenium.Click("//table[@id='ext-gen48']/thead/tr/td/input");
            selenium.Click("css=#ext-gen45 > span.text");
            selenium.Click("//div[2]/div[2]/a/span");
            selenium.WaitForPageToLoad("30000");

            //Checking if the repeated transactions are deleted
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("There are no items to display." == selenium.GetText("//div[7]"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("There are no items to display.", selenium.GetText("//div[7]"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }
        }