Example #1
0
        public void RunAllLocalTests()
        {
            BaseTest bt = new BaseTest();
            bt.Setup();

            CleanUpLocal();
            RunAllTestsLocalMobile("http://localhost:12738/WebBucketList/Mobile");

            CleanUpLocal();
            RunAllTestsLocalDesktop("http://localhost:12738/WebBucketList/Desktop");
        }
Example #2
0
        public void DepositRestrictTelebet(IWebDriver tb2Driver, MyAcct_Data acctData, string netAcc, string error, string site = null)
        {
            BaseTest.AddTestCase("Verify the customer is able to perform withdraw and not deposit", "Deposit should not be successfull");
            AccountAndWallets anw = new AccountAndWallets();

            String portalWindow = tb2Driver.WindowHandles.ToArray()[0].ToString();

            wAction.Click(tb2Driver, By.Id("deposit_tab_list_item"), "Deposit link not found");
            System.Threading.Thread.Sleep(3000);
            wAction.WaitAndMovetoFrame(tb2Driver, By.Id("acctIframe"));


            Framework.BaseTest.Assert.IsTrue(common.CommonWithdraw_Netteller_PT(tb2Driver, acctData, acctData.depositAmt, false, false, "Games"), "Amount not deducted after withdraw");



            #region Deposit
            // tb2Driver.SwitchTo().Window(tb2Driver.WindowHandles.ToArray()[1].ToString());
            wAction._Click(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "DepositTab", "Deposit Tab not found", 0, false);

            BaseTest.AddTestCase("Verify that Payment method is added to the customer but cannot deposit", "The customer should have the payment option added to it but gets error msg during deposit");

            wAction.WaitAndMovetoFrame(tb2Driver, By.Id("acctIframe"));
            String nettellerImg = "//table[contains(@class,'data')]//tbody[contains(@id,'accounts')]//td[contains(text(),'" + netAcc + "')]";
            wAction.Click(tb2Driver, By.XPath(nettellerImg), "Netteller Image not found", 0, false);
            wAction._Type(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.id, "NettellerPwd_txt", acctData.card, "Net teller Security Text not found", FrameGlobals.reloadTimeOut, false);
            wAction._Clear(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.id, "Amount_txt", "Amount_txt not found");
            wAction._Type(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.id, "Amount_txt", acctData.depositAmt, "Amount_txt not found");

            wAction._SelectDropdownOption_ByPartialText(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.id, "sourceWallet_cmb", acctData.depositWallet, "sourceWallet_cmb not found");

            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2));
            wAction._Click(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "deposit_btn", "deposit_btn not found");
            BaseTest.Assert.IsTrue(wAction.GetText(tb2Driver, By.XPath("id('globalErrors')//span"), "Restrict message not found", false).Contains(error), "Restrict login error message is incorrect");

            BaseTest.Pass();
            #endregion

            BaseTest.Pass();
        }
    public string RunTest()
    {
        string report  = string.Empty;
        bool   testRes = false;

        // ResetRoadMap
        BaseTest.CheckTest(ref testRes, Test1_1(ref testRes), ref report);
        BaseTest.CheckTest(ref testRes, Test1_2(ref testRes), ref report);
        BaseTest.CheckTest(ref testRes, Test1_3(ref testRes), ref report);

        // CheckRoadRules
        BaseTest.CheckTest(ref testRes, Test2_1(ref testRes), ref report);
        BaseTest.CheckTest(ref testRes, Test2_2(ref testRes), ref report);
        BaseTest.CheckTest(ref testRes, Test2_3(ref testRes), ref report);

        // BuildRoadRules
        BaseTest.CheckTest(ref testRes, Test3_1(ref testRes), ref report);
        BaseTest.CheckTest(ref testRes, Test3_2(ref testRes), ref report);
        BaseTest.CheckTest(ref testRes, Test3_3(ref testRes), ref report);

        return(report);
    }
Example #4
0
        public void Test_update_post()
        {
            RequestMap map = new RequestMap();

            map.Set("id", "1111");
            map.Set("title", "updated title");
            map.Set("body", "updated body");


            Post response = new Post(map).Update();

            List <string> ignoreAsserts = new List <string>();


            BaseTest.assertEqual(ignoreAsserts, response, "id", "1");
            BaseTest.assertEqual(ignoreAsserts, response, "title", "updated title");
            BaseTest.assertEqual(ignoreAsserts, response, "body", "updated body");
            BaseTest.assertEqual(ignoreAsserts, response, "userId", "1");


            BaseTest.putResponse("update_post", response);
        }
Example #5
0
        public void Tree_Factory_AllTypes_Multiple()
        {
            var client  = BaseTest.Initialize_Client(new MultiTypeResponse());
            var factory = new PrtgNodeFactory(client);

            var probes  = factory.Probes(Property.Name, "Local Probe");
            var groups  = factory.Groups(Property.Name, "Windows Infrastructure");
            var devices = factory.Devices(Property.Name, "dc-1");
            var sensors = factory.Sensors(Property.Name, "Ping");

            var properties = factory.Properties(3000);

            var response = new NotificationTriggerResponse(
                NotificationTriggerItem.StateTrigger(parentId: "3000"),
                NotificationTriggerItem.SpeedTrigger(parentId: "3000")
                );

            var triggerClient  = BaseTest.Initialize_Client(response);
            var triggerFactory = new PrtgNodeFactory(triggerClient);

            var triggers = triggerFactory.Triggers(3000);
        }
Example #6
0
    public void OnClick()
    {
        //Debug.Log("click" + GetComponent<LoadCache>().getCurPath());
        string name      = BaseScript.getLoadObject("Canvas/username").GetComponent <InputField>().text;
        string passw     = BaseScript.getLoadObject("Canvas/passw").GetComponent <InputField>().text;
        string passwsure = BaseScript.getLoadObject("Canvas/passwsure").GetComponent <InputField>().text;

        if (passw == passwsure)
        {
            Debug.Log("on passw success");
        }
        if (i == 0)
        {
            BaseTest.send(new BaseData(null).createObject().putObject("mK", new BaseData("login")).putObject("mV", new BaseData(null).createObject().putObject("username", name).putObject("userpassword", passw)));
        }
        else
        {
            BaseTest.send(new BaseData(null).createObject().putObject("mE", new BaseData("da")).putObject("mV", new BaseData(null).createObject().putObject("username", name).putObject("userpassword", passw)));
        }
        i++;
        //BaseTest.send(new BaseData(null).createObject().putObject("regist", new BaseData(null).createObject().putObject("username", name).putObject("userpassword", passw)));
    }
Example #7
0
    static int _CreateBaseTest(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                BaseTest obj = new BaseTest();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: BaseTest.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
        public void AddFreeBet(IWebDriver driverObj, string Promo)
        {
            string portal = driverObj.WindowHandles.ToArray()[0].ToString();

            BaseTest.AddTestCase("Add Freebet to the customer", "Freebet should be added");
            driverObj.SwitchTo().Window(driverObj.WindowHandles.ToArray()[1].ToString());
            wAction.WaitforPageLoad(driverObj);

            wAction.WaitUntilElementDisappears(driverObj, By.XPath(MyAcctPage.LoadingPrompt_XP));
            wAction.Click(driverObj, By.LinkText(MyAcctPage.MyAcct_Free_Bets_lnk), "Freebet link not found");
            wAction.WaitUntilElementDisappears(driverObj, By.XPath(MyAcctPage.LoadingPrompt_XP));
            wAction.Clear(driverObj, By.Name(MyAcctPage.Freebet_promotionCode_name), "Promo code box not found", 0, false);

            wAction.Type(driverObj, By.Name(MyAcctPage.Freebet_promotionCode_name), Promo, "Promo code box not found");
            wAction.Click(driverObj, By.XPath(MyAcctPage.Freebet_Submit_XP), "Submit btn not found");
            BaseTest.Assert.IsTrue(wAction.IsElementPresent(driverObj, By.XPath(MyAcctPage.Freebet_Success_XP)), "Success message not found");


            driverObj.Close();
            driverObj.SwitchTo().Window(portal);
            BaseTest.Pass();
        }
Example #9
0
        static int _m_ToString(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                BaseTest gen_to_be_invoked = (BaseTest)translator.FastGetCSObj(L, 1);



                {
                    string gen_ret = gen_to_be_invoked.ToString(  );
                    LuaAPI.lua_pushstring(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
        public void Test_101_example_calculate_installment_I_request()
        {
            //



            RequestMap map = new RequestMap();

            map.Set("calculatorReqData.primaryAccountNumber", "5204737010000412");
            map.Set("calculatorReqData.transactionAmount", "500");
            map.Set("calculatorReqData.currencyCode", "840");
            map.Set("calculatorReqData.noOfInstallments", "4");
            map.Set("calculatorReqData.merchCategCode", "1");
            map.Set("calculatorReqData.acqInstIdCode", "485");
            map.Set("calculatorReqData.cardAccpIdCode", "8692");
            map.Set("calculatorReqData.issuerConsentRequired", "N");

            List <string> ignoreAsserts = new List <string>();

            EligibilityAndCalculator response = EligibilityAndCalculator.Create(map);

            BaseTest.assertEqual(ignoreAsserts, response, "status", "Success");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.primaryAccountNumber", "0412");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.transactionAmount", "500");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.currencyCode", "840");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.merchCategCode", "1");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.acqInstIdCode", "485");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.cardAccpIdCode", "8692");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.installmentPaymentFormatI[0].noOfInstallments", "4");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.installmentPaymentFormatI[0].apr", "5.82");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.installmentPaymentFormatI[0].firstInstallmentAmount", "130.26");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.installmentPaymentFormatI[0].subSeqInstallmentAmount", "125.26");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.installmentPaymentFormatI[0].totalAmountDue", "506.04");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.installmentPaymentFormatI[0].interestRate", "1.00");
            BaseTest.assertEqual(ignoreAsserts, response, "calculatorRespData.installmentPaymentFormatI[0].installmentFee", "5.00000");

            BaseTest.putResponse("example_calculate_installment_I_request", response);
        }
Example #11
0
        static void Main(string[] args)
        {
            //------------------------------------------------------------------------------------------
            // Third party library with the same interface class types and methods
            //------------------------------------------------------------------------------------------
            External.BaseTestExternal ext = new BaseTestExternal();

            //------------------------------------------------------------------------------------------
            // Class implementation (BaseTest, Child, Generalized)
            //------------------------------------------------------------------------------------------
            BaseTest bt = new BaseTest();
            Child    cd = new Child();
            Generalized <BaseTest> gt = new Generalized <BaseTest>();

            //------------------------------------------------------------------------------------------
            // Tuple with two types Child, BaseTest
            //------------------------------------------------------------------------------------------
            (Child, BaseTest)tuple = (new Child(), new BaseTest());

            //------------------------------------------------------------------------------------------
            // Dictionary with two types Child, BaseTest
            //------------------------------------------------------------------------------------------
            Dictionary <Child, BaseTest> dict = new Dictionary <Child, BaseTest>();

            //------------------------------------------------------------------------------------------
            // Delegates
            //------------------------------------------------------------------------------------------
            Del del = (BaseTest bt11) => new BaseTest();
            Del1 <BaseTest, Child> del1 = Foo;

            //------------------------------------------------------------------------------------------
            // Casts of type BaseTest
            //------------------------------------------------------------------------------------------
            BaseTest bt1 = cd as BaseTest;
            bool     var = cd is BaseTest;

            Console.WriteLine("Hello World!");
        }
Example #12
0
        public void Test_create_user()
        {
            RequestMap map = new RequestMap();

            map.Set("website", "hildegard.org");
            map.Set("address.city", "New York");
            map.Set("address.postalCode", "10577");
            map.Set("address.state", "NY");
            map.Set("address.line1", "2000 Purchase Street");
            map.Set("phone", "1-770-736-8031");
            map.Set("name", "Joe Bloggs");
            map.Set("email", "*****@*****.**");
            map.Set("username", "jbloggs");



            List <string> ignoreAsserts = new List <string>();


            User response = User.Create(map);

            BaseTest.assertEqual(ignoreAsserts, response, "website", "hildegard.org");
            BaseTest.assertEqual(ignoreAsserts, response, "address.instructions.doorman", "true");
            BaseTest.assertEqual(ignoreAsserts, response, "address.instructions.text", "some delivery instructions text");
            BaseTest.assertEqual(ignoreAsserts, response, "address.city", "New York");
            BaseTest.assertEqual(ignoreAsserts, response, "address.postalCode", "10577");
            BaseTest.assertEqual(ignoreAsserts, response, "address.id", "1");
            BaseTest.assertEqual(ignoreAsserts, response, "address.state", "NY");
            BaseTest.assertEqual(ignoreAsserts, response, "address.line1", "2000 Purchase Street");
            BaseTest.assertEqual(ignoreAsserts, response, "phone", "1-770-736-8031");
            BaseTest.assertEqual(ignoreAsserts, response, "name", "Joe Bloggs");
            BaseTest.assertEqual(ignoreAsserts, response, "id", "1");
            BaseTest.assertEqual(ignoreAsserts, response, "email", "*****@*****.**");
            BaseTest.assertEqual(ignoreAsserts, response, "username", "jbloggs");


            BaseTest.putResponse("create_user", response);
        }
        public void Log_EqualityComparer_GetHashCode_UniqueValues()
        {
            var random = new Random();

            var response = new MessageResponse(Enumerable.Range(0, 50).Select(i =>
            {
                var r = random.NextDouble();

                return(new MessageItem(
                           $"WMI Remote Ping_{r}",
                           datetimeRaw: (43042.2573037732 + r).ToString(),
                           parent: $"Probe Device_{r}",
                           sensor: $"WMI Remote Ping_{r}",
                           device: $"Probe Device_{r}",
                           group: $"Local Probe_{r}"
                           ));
            }).ToArray());

            var logs = BaseTest.Initialize_Client(response).GetLogs(count: null);

            Assert.AreEqual(50, logs.Count);

            var set = new HashSet <Log>(new LogEqualityComparer());

            foreach (var log in logs)
            {
                set.Add(log);
            }

            Assert.AreEqual(50, set.Count);

            var comparer = new LogEqualityComparer();

            foreach (var log in logs)
            {
                Assert.AreEqual(comparer.GetHashCode(log), comparer.GetHashCode(log));
            }
        }
Example #14
0
        public void AllWallets_TransferTB2(IWebDriver tb2Driver, MyAcct_Data acctData, string wallets, string table)
        {
            List <string> wallet    = wallets.ToString().Split(';').ToList <string>();
            List <string> walletTbl = table.ToString().Split(';').ToList <string>();

            tb2Driver.FindElement(By.Id("deposit_tab_list_item")).Click();
            System.Threading.Thread.Sleep(3000);
            wAction.WaitAndMovetoFrame(tb2Driver, By.Id("acctIframe"));



            String portalWindow = tb2Driver.WindowHandles.ToArray()[0].ToString();

            for (int fromWalletInd = 0; fromWalletInd < wallet.Count(); fromWalletInd++)
            {
                for (int toWalletInd = 0; toWalletInd < wallet.Count(); toWalletInd++)
                {
                    if (wallet[fromWalletInd].ToString() == wallet[toWalletInd].ToString())
                    {
                        continue;
                    }

                    else
                    {
                        BaseTest.AddTestCase("Validating transfer from wallet:" + wallet[fromWalletInd].ToString() + " to Towallet: " + wallet[toWalletInd].ToString(), "Transfer Should be successfull");
                        acctData.depositWallet  = wallet[fromWalletInd];
                        acctData.withdrawWallet = wallet[toWalletInd];
                        acctData.wallet1        = walletTbl[fromWalletInd];
                        acctData.wallet2        = walletTbl[toWalletInd];

                        Framework.BaseTest.Assert.IsTrue(common.CommonTransferWithdraw_Netteller_PT(tb2Driver, acctData, acctData.depositAmt), "Amount not added/deducted after transfer");
                        BaseTest.Pass();
                        wAction._Click(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "DepositTab", "Deposit Tab not found", 0, false);
                        // tb2Driver.SwitchTo().DefaultContent();
                    }
                }
            }
        }
        public void TestSmallExample()
        {
            double[,] values = new[, ]
            {
                { 0.0, 1.0, 0, 5 },
                { 2.0, 3.0, 0, 5 }
            };
            IMatrixData mdata = PerseusFactory.CreateMatrixData(values, new List <string> {
                "Col___1", "Col___2", "Col___3", "No expand"
            });

            mdata.ColumnDescriptions = new List <string> {
                "Description Col", "Col", "Col", "Description No expand"
            };
            double[][] multiNum = new[]
            {
                new[] { 0.0, 1.0 },
                new[] { 2.0 }
            };
            mdata.AddMultiNumericColumn("MultiNum", "", multiNum);
            string[] stringCol = new[] { "row1", "row2" };
            mdata.AddStringColumn("String", "", stringCol);
            ExpandSiteTable expand = new ExpandSiteTable();

            IMatrixData[]   supplData = null;
            IDocumentData[] docs      = null;
            expand.ProcessData(mdata, new Parameters(), ref supplData, ref docs, BaseTest.CreateProcessInfo());
            Assert.AreEqual(2, mdata.ColumnCount);
            CollectionAssert.AreEqual(new [] { "No expand", "Col" }, mdata.ColumnNames.ToArray());
            Assert.AreEqual(2, mdata.ColumnDescriptions.Count);
            CollectionAssert.AreEqual(new [] { "Description No expand", "Description Col" }, mdata.ColumnDescriptions.ToArray());
            Assert.AreEqual(6, mdata.RowCount);
            Assert.AreEqual(2, mdata.StringColumnCount);
            CollectionAssert.AreEqual(new [] { "String", "Unique identifier" }, mdata.StringColumnNames);
            CollectionAssert.AreEqual(stringCol.Concat(stringCol).Concat(stringCol).ToArray(), mdata.StringColumns[0]);
            Assert.AreEqual(1, mdata.MultiNumericColumnCount);
            CollectionAssert.AreEqual(multiNum.Concat(multiNum).Concat(multiNum).ToArray(), mdata.MultiNumericColumns[0]);
        }
Example #16
0
        public static string ReadXMLQuery_ByKeyValue(string path, string TagName, string _attributeVal)
        {
            try
            {
                XDocument xDoc  = XDocument.Load(path);
                var       pairs = XDocument.Parse(xDoc.ToString())
                                  .Descendants(TagName)
                                  .Select(x => new
                {
                    Key   = x.Attribute("key").Value,
                    Value = x.Attribute("value").Value
                })
                                  .Where(addr => (string)addr.Key.ToString() == _attributeVal)

                                  .ToDictionary(item => item.Key, item2 => item2.Value);

                string val = null;
                val = pairs[_attributeVal];
                return(val);
            }
            catch (Exception e) { BaseTest.Fail("Issue while reading :" + _attributeVal + " from XML OR files"); }
            return(null);
        }
        public void VerifyPropertyTypeIsOngoing()
        {
            BaseTest baseTest = new BaseTest();

            try
            {
                test = extent.CreateTest("VerifyPropertyTypeIsOngoing").Info("Test Started");
                IMTRLandingPage         imtr            = new IMTRLandingPage(BaseTest.driver);
                IMTRPropertyDetailsPage imtrPropdetails = new IMTRPropertyDetailsPage(BaseTest.driver);
                imtr.ClickTrackRecordOnInMenu();
                imtr.ClickOngoingDeals();
                imtr.NavigateToIMTRPropDetail();
                String dealtype = imtrPropdetails.ReturnPropertyDealType();
                Assert.AreEqual("Ongoing", dealtype, "Property is not ongoing property");
                test.Log(Status.Pass, "Test Case Passed");
            }
            catch (Exception e)
            {
                test.Log(Status.Fail, "Test Case Failed");
                baseTest.TakeScreenshot();
                Console.WriteLine(e.StackTrace);
            }
        }
Example #18
0
        static int _m_Proxy(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                BaseTest gen_to_be_invoked = (BaseTest)translator.FastGetCSObj(L, 1);



                {
                    int _p = LuaAPI.xlua_tointeger(L, 2);

                    gen_to_be_invoked.Proxy(_p);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Example #19
0
        public void ValidateHTTPSTelebet(IWebDriver tb2Driver)
        {
            BaseTest.AddTestCase("Customer should be taken to HTTPS page on accessing any page from Telebet having sensitive data", "Sensitive page should not be having HTTPS");
            AccountAndWallets anw = new AccountAndWallets();

            String portalWindow = tb2Driver.WindowHandles.ToArray()[0].ToString();

            wAction.Click(tb2Driver, By.Id("deposit_tab_list_item"), "Deposit link not found");

            System.Threading.Thread.Sleep(3000);
            wAction.WaitAndMovetoFrame(tb2Driver, By.Id("acctIframe"));
            BaseTest.Assert.IsTrue(wAction._IsElementPresent(tb2Driver, ORFile.Accounts_Wallets_Banking, wActions.locatorType.xpath, "WithdrawTab"), "Cashier page not loaded");
            BaseTest.Assert.IsTrue(tb2Driver.Url.Contains("https"), "URL is not HTTPS when accessing deposit page:" + tb2Driver.Url);



            tb2Driver.SwitchTo().DefaultContent();
            wAction.Click(tb2Driver, By.LinkText("Account Overview"), "Account Overview link not found");
            BaseTest.Assert.IsTrue(tb2Driver.Url.Contains("https"), "URL is not HTTPS when accessing My ACct page:" + tb2Driver.Url);


            BaseTest.Pass();
        }
        public void MouseHoverDressess()
        {
            if (BaseTest.WaitUntilElementExists(mouseHoverOnDressess))
            {
                ExtentTestManager.GetTest().Log(Status.Pass, "User Logged In Successfully");
            }
            else
            {
                ExtentTestManager.GetTest().Log(Status.Fail, "Login was unsuccessful");
            }
            Actions action = new Actions(_driver);

            action.MoveToElement(mouseHoverOnDressess).Perform();
            if (BaseTest.WaitUntilElementExists(chooseSummerDressess))
            {
                ExtentTestManager.GetTest().Log(Status.Pass, "Summer Dressess page loaded");
            }
            else
            {
                ExtentTestManager.GetTest().Log(Status.Pass, "Summer Dressess page not loaded");
            }
            chooseSummerDressess.Click();
        }
Example #21
0
        public async Task PrtgClient_ParsesInvalidXml_RetainsDirtyAsync()
        {
            var xml = "<property><value>\01</value></property>";

            var client = BaseTest.Initialize_Client(new BasicResponse(xml.ToString()));

            var validator = new EventValidator <string>(new[]
            {
                //First - retry a dirty response
                "https://prtg.example.com/api/table.xml?content=objects&columns=objid,name,tags,type,active,basetype&count=*&username=username&passhash=12345678",
                "XmlSerializer encountered exception ''.', hexadecimal value 0x00, is an invalid character. Line 1, position 18.' while processing request. Retrying request and flagging engine as dirty.",
                "https://prtg.example.com/api/table.xml?content=objects&columns=objid,name,tags,type,active,basetype&count=*&username=username&passhash=12345678",

                //Second - engine should be already marked as dirty
                "https://prtg.example.com/api/table.xml?content=objects&columns=objid,name,tags,type,active,basetype&count=*&username=username&passhash=12345678"
            });

            client.LogVerbose += (s, e) =>
            {
                var message = e.Message;

                if (message.StartsWith("Synchronously") || message.StartsWith("Asynchronously"))
                {
                    message = Regex.Replace(e.Message, "(.+ request )(.+)", "$2");
                }

                Assert.AreEqual(validator.Get(message), message);
            };

            validator.MoveNext(3);
            var result = await client.ObjectEngine.GetObjectAsync <DummyElementRoot>(new PrtgObjectParameters());

            validator.MoveNext();
            result = await client.ObjectEngine.GetObjectAsync <DummyElementRoot>(new PrtgObjectParameters());

            Assert.IsTrue(validator.Finished, "Did not process all requests");
        }
Example #22
0
        public static void ValidateNextPart(this BaseTest test,
                                            IEnumerable <string> gotByThisMoment,
                                            IEnumerable <string> newItems,
                                            string itemName,
                                            AssertDelegate assert)
        {
            List <string> newNotUnique = new List <string>();   // intersection within new part
            List <string> duplicated   = new List <string>();   // intersection with received previously

            foreach (string token in newItems)
            {
                if (newItems.Count(S => S == token) > 1)
                {
                    newNotUnique.Add(token);
                }
                if (gotByThisMoment.Count(S => S == token) > 0)
                {
                    duplicated.Add(token);
                }
            }

            bool          ok    = true;
            StringBuilder error = new StringBuilder();

            if (newNotUnique.Count > 0)
            {
                ok = false;
                error.AppendLine("The following tokens are not unique: " + string.Join(", ", newNotUnique.ToArray()));
            }
            if (duplicated.Count > 0)
            {
                ok = false;
                error.AppendLine("The following tokens have been already received: " + string.Join(", ", duplicated.ToArray()));
            }

            assert(ok, error.ToStringTrimNewLine(), "Validate response received", string.Empty);
        }
Example #23
0
        /// <summary>
        /// Checks that list contains exactly one item with specified token
        /// </summary>
        /// <typeparam name="T">Item type</typeparam>
        /// <param name="test">Class containing test method in which validation should be performed.</param>
        /// <param name="list">Items list</param>
        /// <param name="token">Token of desired item</param>
        /// <param name="tokenSelector">Function to get token from Item</param>
        /// <param name="itemName">Name of item for eror description</param>
        /// <param name="assert"></param>
        public static void CheckRequestedInfo <T>(this BaseTest test, IEnumerable <T> list,
                                                  string token,
                                                  Func <T, string> tokenSelector,
                                                  string itemName,
                                                  AssertDelegate assert)
        {
            string error = string.Empty;

            int count = 0;

            if (list != null)
            {
                count = list.Count();
            }

            if (count == 0)
            {
                error = string.Format("No {0} information returned", itemName);
            }
            else
            {
                if (count > 1)
                {
                    error = "More than one entry returned";
                }
                else
                {
                    T item = list.First();
                    if (tokenSelector(item) != token)
                    {
                        error = "Entry for other token returned";
                    }
                }
            }
            assert(string.IsNullOrEmpty(error), error, "Check response", string.Empty);
        }
        private bool RunOneTest(string testName, BaseTest test)
        {
            bool      result    = true;
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            try
            {
                logger.Info("Executing test: " + testName);

                result = test.Execute();
                if (!result)
                {
                    logger.Error("Error in running test: " + testName);
                }
                else
                {
                    logger.Info("Successful in running test: " + testName);
                }
            }
            catch (Exception e)
            {
                result = false;
                logger.Error("Error while running test: " + testName + ". Exception: " + e);
            }

            stopWatch.Stop();

            MetricsHelper.PushTestMetric(Convert.ToInt64(stopWatch.Elapsed.TotalSeconds),
                                         this.SuiteName,
                                         testName,
                                         result.ToString());

            return(result);
        }
Example #25
0
 public Verification VerifyCurrentText(string text)
 {
     return(BaseTest.VerifyText(text, TextBlock_CurrentText.Text));
 }
Example #26
0
        public void EITQ_3794(IDictionary <string, string> data)
        {
            MasterData     = new objMasterData(data);
            className      = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name;
            testMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            MasterData.TestResultPathStem = string.Format(FileUtilities.DefaultTestResultDirectory, className);
            //MasterData.TestResultPathStem = string.Format("{0}\\{1}\\{2}\\{3} - {4}", FileUtilities.DefaultTestResultDirectory_ShareDrive, className, testMethodName, Environment.UserName, runTime);
            path = string.Format("{0}\\{1}.html", MasterData.TestResultPathStem, TestReportName);

            if (!Directory.Exists(string.Format("{0}", MasterData.TestResultPathStem)))
            {
                Directory.CreateDirectory(string.Format("{0}", MasterData.TestResultPathStem));
            }

            if (BaseTest.HtmlReport == null)
            {
                InitializeExtentReports(path, TestReportName);
            }

            BaseTest.extentTest = ExtentReport.CreateTest(MasterData.TestID + " (First Payment Month = " + MasterData.ImpoundsFirstPayment + ")");

            string StepDetails = string.Format("Impounds Testing");
            bool   StepStatus  = true;
            string MethodName  = System.Reflection.MethodBase.GetCurrentMethod().Name;

            try
            {
                //Impounds(unlocked loan must be up to Step 4 of Disclosure Prep(TRID) form)


                //extentTest.Pass("Pass step description.");

                AttachToProcess(Processes.Encompass, 5);

                URLA_Page1
                .OpenForm_FromFormsTab()
                .txt_SubjectProperty_ZipCode_SendKeys(MasterData.Zip);
                extentTest.Pass("Verified Subject Property is in " + MasterData.City + ", " + MasterData.State, MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_address"), true)).Build());

                RegZCD
                .OpenForm_FromFormsTab()
                .txt_FirstPaymentDate_SendKeys(MasterData.FirstPaymentDate);
                extentTest.Pass("Populated First Payment Date field [682] on RegZ-CD with " + MasterData.FirstPaymentDate, MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_FirstPaymentDate"), true)).Build());

                Itemization
                .OpenForm_FromFormsTab()
                .btn_ScrollDown1100_Click()
                .btn_AggregateSetup_Click();

                AggregateSetup
                .Initialize()
                .DragWindow_AggregateSetup();
                extentTest.Pass("Opened Aggregate Setup window and verified Due Date(s) = " + MasterData.ImpoundsDueDates + " and verified Property Taxes mths field [1386] = " + MasterData.ImpoundsMonths + " when First Payment Month = " + MasterData.ImpoundsFirstPayment, MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_impounds"), true)).Build());

                AggregateSetup
                .Initialize()
                .btn_OK_Click();
                extentTest.Pass("Verified line 1004 Property Taxes mths field [1386] remains populated with '" + MasterData.ImpoundsMonths + "' after Aggregate Setup window is closed", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_AggregateSetupClosed"), true)).Build());

                Itemization
                .Initialize()
                .btn_ScrollUp900_Click();
                extentTest.Pass("Verified line 904 Property Taxes mths field is populated with '" + MasterData.Impounds904Months + "' only when First Payment Month '" + MasterData.ImpoundsFirstPayment + "' is the same as Due Date(s) '" + MasterData.ImpoundsDueDates + "'", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_line904"), true)).Build());

                Itemization
                .Initialize()
                .txt_PropertyTaxesMths_SendKeys(" ");
            }

            catch (Exception ex)
            {
                StepStatus = false;
                BaseTest.ExtentFailStep(ex, StepDetails, "ErrorOccured");
                //step.ModalText = ex.ToString();
                //step.Status = "Fail";
                //step.ScreenShotLocation = Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format("Failure\\{0}", System.Reflection.MethodBase.GetCurrentMethod().Name));
                Assert.Fail(ex.ToString());
            }
            finally
            {
                if (StepStatus)
                {
                    extentTest.Pass("Test Passed - reached the end of script");
                }
                //Report.addStep(step);
            }
        }
        public void Loan_Creation(IDictionary <string, string> data)
        {
            MasterData     = new objMasterData(data);
            className      = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name;
            testMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            //MasterData.TestResultPathStem = string.Format(FileUtilities.DefaultTestResultDirectory, className);
            MasterData.TestResultPathStem = string.Format("{0}\\{1}\\{2}\\{3} - {4}", FileUtilities.DefaultTestResultDirectory_ShareDrive, className, testMethodName, Environment.UserName, runTime);
            path = string.Format("{0}\\{1}.html", MasterData.TestResultPathStem, TestReportName);

            if (!Directory.Exists(string.Format("{0}", MasterData.TestResultPathStem)))
            {
                Directory.CreateDirectory(string.Format("{0}", MasterData.TestResultPathStem));
            }

            if (BaseTest.HtmlReport == null)
            {
                InitializeExtentReports(path, TestReportName);
            }

            BaseTest.extentTest = ExtentReport.CreateTest(runTime);

            string StepDetails = string.Format("Smoke Test");
            bool   StepStatus  = true;
            string MethodName  = System.Reflection.MethodBase.GetCurrentMethod().Name;

            try
            {
                LaunchApplication(DesktopApps.Encompass);

                Launcher
                .Initialize()
                .cmb_EnvironmentID_SelectByText(MasterData.EnvironmentID)
                .btn_Login_Click();

                extentTest.Pass("Launched Encompass environment " + MasterData.EnvironmentID, MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_Launch"), true)).Build());

                AttachToProcess(Processes.Encompass, 5);

                Login
                .Initialize()
                .txt_Username_SendKeys("test_qa_lo")
                .txt_Password_SendKeys("P@ramount1")
                .btn_Login_Click();

                extentTest.Pass("Logged in as Loan Officer, test_qa_lo", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_Login"), true)).Build());

                Thread.Sleep(10000); EncompassMain.Initialize().Resize().tab_Pipeline_Select(); Pipeline.Initialize().btn_NewLoan_Click();

                NewLoan
                .Initialize()
                .cmb_LoanTemplateFolder_SelectByText("PEM Direct")
                .SelectItem_DirectConvRefinance();

                extentTest.Pass("Created new Direct Conventional Refinance loan from Pipeline", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_LoanTemplate"), true)).Build());

                FormsTab.Initialize().chk_Show_Check(true).chk_ShowInAlpha_Check(true);

                TestConsole.OpenForm_FromFormsTab().btn_CreateNewLoan_Click(MasterData.LoanCreator); EncompassDialog.Initialize().btn_OK_Click();

                CreditReport.Initialize().lstbx_Provider_Select("Equifax Mortgage Solutions").btn_Submit_Click();

                CreditReportRequest
                .Initialize()
                .txt_UserName_SendKeys("PARAMOUNTIT")
                .txt_Password_SendKeys("P@ramount2")
                .chk_SaveLoginInformation_Check(true)
                .chk_Equifax_Check(true)
                .chk_Experian_Check(true)
                .chk_TransUnion_Check(true)
                .btn_Finish_Click();

                EncompassMain.Initialize().tab_ServicesView_Select(); extentTest.Pass("Credit Report successfully generated", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_CreditReport"), true)).Build()); Thread.Sleep(500); EncompassMain.Initialize().tab_Loan_Select();

                TestConsole
                .Initialize()
                .rdb_NoCashOutRefi_Select()
                .rdb_Direct_Select()
                .txt_BorrowerEmail_SendKeys(MasterData.BorrowerEmail);

                TestConsole.Initialize().btn_BLSCertification_Click(); QuickEntryBankerLoanSubmission.Initialize().ScrollDown().btn_BankerCertificationBLS_Click(); extentTest.Pass("Banker Loan Submission Form certified", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_BLS"), true)).Build()); QuickEntryBankerLoanSubmission.Initialize().btn_Close_Click();

                TestConsole
                .Initialize()
                .txt_SubjectProperty_Address_SendKeys(MasterData.Address)
                .txt_SubjectProperty_City_SendKeys(MasterData.City)
                .txt_SubjectProperty_State_SendKeys(MasterData.State)
                .txt_SubjectProperty_County_SendKeys(MasterData.County)
                .txt_SubjectProperty_ZipCode_SendKeys(MasterData.Zip);

                BorrowerSummary.OpenForm_FromFormsTab(); Thread.Sleep(500); extentTest.Pass("Borrower Summary successfully completed with Borrower email address " + MasterData.BorrowerEmail, MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_BorrowerSummary"), true)).Build());

                URLA_Page1.OpenForm_FromFormsTab(); Thread.Sleep(2000); extentTest.Pass("1003 Page 1 successfully completed with address " + MasterData.Address + ", " + MasterData.City + ", " + MasterData.State + ", " + MasterData.Zip + " (" + MasterData.County + " County)", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_1003Page1"), true)).Build());

                URLA_Page2.OpenForm_FromFormsTab(); Thread.Sleep(2000); extentTest.Pass("1003 Page 2 successfully completed", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_1003Page2"), true)).Build());

                URLA_Page3.OpenForm_FromFormsTab(); Thread.Sleep(2000); extentTest.Pass("1003 Page 3 successfully completed", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_1003Page3"), true)).Build());

                FormsTab.Initialize().lstbx_Forms_SelectForm("VOE"); Thread.Sleep(1000); extentTest.Pass("Verification of Employment successfully completed", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_VOE"), true)).Build());

                FormsTab.Initialize().lstbx_Forms_SelectForm("VOD"); Thread.Sleep(1000); extentTest.Pass("Verification of Depository successfully completed", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_VOD"), true)).Build());

                TransmittalSummary.OpenForm_FromFormsTab(); Thread.Sleep(1000); extentTest.Pass("Transmittal Summary successfully completed", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_TransmittalSum"), true)).Build());

                #region eConsent

                eConsentNotYetReceived.Open_FromAlertsandMessagesTab().btn_Request_eConsent_Click();

                SendConsent
                .Initialize()
                .chk_BorrowerConsent_Check(true)
                .chk_NotifyWhenBorrowerReceives_Check(true)
                .btn_Send_Click();

                BaseSeleniumPage.CreateDriver(BaseSeleniumPage.WebDrivers.Chrome); BaseSeleniumPage.NavigateToURL(@"https://www.mortgage-application.net/myaccount/accountlogin.aspx");

                BorrowerLoanCenterLogIn.Initialize()
                .txt_Email_SendKeys("*****@*****.**")
                .txt_Password_SendKeys("P@ramount1")
                .btn_Login_Click();

                CheckLoanStatus.Initialize().fn_SelectFirstRow();

                //LoanDetail.Initialize().btn_View_Click();

                AgreeToReceiveDisclosuresElectronically.Initialize().btn_Agree_Click(); BaseSeleniumPage.CloseDriver();

                eConsentNotYetReceived.Initialize().btn_View_eConsent_Click();

                extentTest.Pass("eConsent accepted", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_eConsentAccepted"), true)).Build());

                #endregion eConsent

                #region Product and Pricing

                OB_ProductandPricing.OpenFrom_MainMenu().lstbx_Provider_Select("Optimal Blue - Enhanced").btn_Submit_Click();

                OB_Login
                .Initialize()
                .txt_LoginName_SendKeys(MasterData.OB_Login)
                .txt_Password_SendKeys(MasterData.OB_Password)
                .chk_SaveLoginInformation_Check(true)
                .chk_UpdateUpfrontMIdataforFHAloans_Check(true)
                .btn_Continue_Click();

                OB_ProductSearch.Initialize().btn_Submit_Click(); extentTest.Pass("Loan is ready to execute pricing through Optimal Blue", MediaEntityBuilder.CreateScreenCaptureFromPath(Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format(MasterData.TestID + "_Pricing"), true)).Build());

                #endregion Run Product and Pricing
            }

            catch (Exception ex)
            {
                StepStatus = false;
                BaseTest.ExtentFailStep(ex, StepDetails, "ErrorOccured");
                //step.ModalText = ex.ToString();
                //step.Status = "Fail";
                //step.ScreenShotLocation = Screenshot.TakeScreenShot(Screenshot.TakeSS_FullDesktop(), string.Format("Failure\\{0}", System.Reflection.MethodBase.GetCurrentMethod().Name));
                Assert.Fail(ex.ToString());
            }
            finally
            {
                if (StepStatus)
                {
                    extentTest.Pass("Test Passed - reached the end of script");
                }
                //Report.addStep(step);
            }
        }
Example #28
0
 private BaseTest BaseTest(BaseTest bt)
 {
     return(new BaseTest());
 }
Example #29
0
 public static void ClassCleanup()
 {
     BaseTest.BrowserCleanup();
 }
Example #30
0
 public static void ClassInitialize(TestContext context)
 {
     BaseTest.InitializeBrowser();
 }
 public AspCodeBehindTestHelper(BaseTest test)
 {
     _test = test;
 }
Example #32
0
 public void CleanUpLocal()
 {
     BaseTest bt = new BaseTest();
     bt.CleanUpLocal();
 }