public static void VerifyCollateralistheSameThroughTableandCardMakerDao() { try { Open(); IWebElement makerDaoColumn = Engine.Browser.CurrentBrowser.FindElement(MakerDaoColumn); makerDaoColumn.Click(); Engine.Browser.MiddlePause(); IWebElement collateralTable = Engine.Browser.CurrentBrowser.FindElement(CollateralTable); string collateralTableValue = collateralTable.Text; string[] stringSeparators = new string[] { "(" }; var result = collateralTableValue.Split(stringSeparators, StringSplitOptions.None); string token = result[0].Substring(0, 4); string dollar = result[1]; IWebElement firstrow = Engine.Browser.CurrentBrowser.FindElement(Row); firstrow.Click(); Engine.Browser.LongPause(); IWebElement collateralCard = Engine.Browser.CurrentBrowser.FindElement(CollateralTableMakerDao); var valueFromCard = Convert.ToDouble(collateralCard.Text.Substring(0, 4)); var valueFromTable = Convert.ToDouble(token.Substring(0, 4)); var difference = valueFromTable - valueFromCard; Assert.IsTrue(difference < 1 || difference == 0, "[" + Env + "] LOANSCAN", "Collateral vlaue on the card is not the same as in the table | expected: " + collateralCard.Text + " was: " + token + " URL " + Browser.CurrentBrowser.Url); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void VerifyCollateralistheSameThroughTableandCard() { try { Open(); IWebElement dharmacolumn = Engine.Browser.CurrentBrowser.FindElement(DharmaColumn); dharmacolumn.Click(); Engine.Browser.LongPause(); IWebElement collateralTable = Engine.Browser.CurrentBrowser.FindElement(CollateralTable); string collateralTableValue = collateralTable.Text; string[] stringSeparators = new string[] { "(" }; var result = collateralTableValue.Split(stringSeparators, StringSplitOptions.None); string token = result[0]; string dollar = result[1]; IWebElement firstrow = Engine.Browser.CurrentBrowser.FindElement(Row); firstrow.Click(); Engine.Browser.LongPause(); var currentURL = Browser.CurrentBrowser.Url; IWebElement collateralCard = Engine.Browser.CurrentBrowser.FindElement(CollateralCard); Assert.IsTrue(collateralCard.Text.Contains(dollar), "[" + Env + "] LOANSCAN", "Collateral vlaue on the card is not the same as in the table. expected: " + collateralCard.Text + " was: " + dollar + " url: " + currentURL); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void VerifyLoanAmountisTheSameinTableandOnCard() { try { Open(); IWebElement dharmacolumn = Engine.Browser.CurrentBrowser.FindElement(DharmaColumn); dharmacolumn.Click(); Engine.Browser.MiddlePause(); IWebElement firstrow = Engine.Browser.CurrentBrowser.FindElement(Row); IWebElement loanamount = Engine.Browser.CurrentBrowser.FindElement(LoanAmount); string loanamountvalue = loanamount.Text; string[] stringSeparators = new string[] { "(" }; var result = loanamountvalue.Split(stringSeparators, StringSplitOptions.None); string token = result[0]; string dollar = result[1]; firstrow.Click(); Engine.Browser.MiddlePause(); IWebElement loanamountCard = Engine.Browser.CurrentBrowser.FindElement(LaonAmountCard); Assert.IsTrue(loanamountCard.Text.Contains(dollar), "[" + Env + "] LOANSCAN", "Loan amount in the card is not the same as in the table"); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void VerifyAllDataloadedMakerDao() { try { Open(); IWebElement makerDaoColumn = Engine.Browser.CurrentBrowser.FindElement(MakerDaoColumn); makerDaoColumn.Click(); Engine.Browser.MiddlePause(); IWebElement firstrow = Engine.Browser.CurrentBrowser.FindElement(Row); firstrow.Click(); Engine.Browser.MiddlePause(); IList <IWebElement> datamakerdao = Engine.Browser.CurrentBrowser.FindElements(AllDataMakerDao); foreach (var value in datamakerdao) { string valuetext = value.Text; Assert.IsTrue(!valuetext.Contains(""), "[" + Env + "] LOANSCAN", "Some values are missing on the MakerDao Single Card"); } } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
//Tests public static void VerifySingleCardOpening() { try { Open(); IWebElement dharmacolumn = Engine.Browser.CurrentBrowser.FindElement(DharmaColumn); dharmacolumn.Click(); Engine.Browser.MiddlePause(); IWebElement firstrow = Engine.Browser.CurrentBrowser.FindElement(Row); IWebElement annualintrate = Engine.Browser.CurrentBrowser.FindElement(AnnaulInterestRateTable); string value = annualintrate.Text; firstrow.Click(); Engine.Browser.MiddlePause(); IWebElement annualinterestratecard = Engine.Browser.CurrentBrowser.FindElement(AnnualInterestRateCard); Assert.IsTrue(annualinterestratecard.Text.Contains(value), "[" + Env + "] LOANSCAN", "The appopriate card is not opened from the table"); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void VerifyDataonMakerDaoCardcorrespondsDataFromTable() { try { Open(); IWebElement makerDaoColumn = Engine.Browser.CurrentBrowser.FindElement(MakerDaoColumn); makerDaoColumn.Click(); Engine.Browser.MiddlePause(); IWebElement row = Engine.Browser.CurrentBrowser.FindElement(Row); IWebElement annaulInterestRateTable = Engine.Browser.CurrentBrowser.FindElement(AnnaulInterestRateTable); string annaulintRateTableValue = annaulInterestRateTable.Text; IWebElement repayedTable = Engine.Browser.CurrentBrowser.FindElement(RepayedTable); string repayedTableValue = repayedTable.Text; IWebElement lendingProtocol = Engine.Browser.CurrentBrowser.FindElement(LendingProtocolTable); string lendingProtocolValue = lendingProtocol.Text; row.Click(); Engine.Browser.LongPause(); Console.WriteLine(Engine.Browser.CurrentBrowser.Url); IWebElement annualInterestRateCard = Engine.Browser.CurrentBrowser.FindElement(AnnualInterestRateCardMakerDao); string annaulVlaueCard = annualInterestRateCard.Text; Console.WriteLine("Annual Interest Rate: card " + annaulVlaueCard + " table " + annaulintRateTableValue); if (!annaulVlaueCard.Contains(annaulintRateTableValue)) { throw new Exception("[" + Env + "] LOANSCAN: Annual Interest Rate value doesn't match through the table and the card of Maker DAO lending protocol. Please check manually."); } //IWebElement repayedCard = Engine.Browser.CurrentBrowser.FindElement(RepayedCard); //Console.WriteLine("%Repayed value: card " + repayedCard + " table " + repayedTableValue); //if (!repayedCard.Text.Contains(repayedTableValue)) //{ // throw new Exception("[" + Env + "] LOANSCAN: %Repayed value doesn't match through the table and the card. Please check manually."); //} IWebElement lendingProtocolCard = Engine.Browser.CurrentBrowser.FindElement(LendingProtocolCard); Console.WriteLine("Lending Protocol: card " + lendingProtocolCard + " table " + lendingProtocolValue); if (!lendingProtocolCard.Text.Contains(lendingProtocolValue)) { throw new Exception("[" + Env + "] LOANSCAN: Lending Protocol type doesn't match through the table and the card. Please check manually."); } } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void PaginationTable() { try { Open(); PaginationbyTheTable(); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void SearchFunctionality() { try { Open(); PerformSearch(); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void LendingProtocolSwitch() { try { Open(); LendingProtocolsSwitch(); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void TermSwitchingFunctionality() { try { Open(); TermSwitch(); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void CurrencySwtichingTest() { try { Open(); SwitchCurrency(); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void ColumnsTable() { try { Open(); ColumnsAvailabilityintheTable(); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void FilteringTable() { try { Open(); FilteringTablebyLendingProtocol(); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void ChartTabsAvailability() { try { Open(); ChartTabsSwitching(); //ScreenShot.TakeScreenshotFullPageWithScroll(Engine.Browser.CurrentBrowser); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void VerifyTokensCanBeWithdrawn() { try { Console.WriteLine("Login to the app..."); ReadOnlyCollection <string> windows = MainPageBb.LoginToMainPage("lender"); string MetamaskTab = windows[0]; string BloqboardTab = windows[1]; Console.WriteLine("Test started..."); Browser.CurrentBrowser.Navigate().GoToUrl(TestData.Urls.Lend); Browser.MiddlePause(); TermsandConditionAceptance(); Browser.MiddlePause(); IWebElement withdrawBtnt = Browser.CurrentBrowser.FindElement(WithdrawBtn); withdrawBtnt.Click(); IWebElement amount = Browser.CurrentBrowser.FindElement(LendAMountImput); amount.SendKeys("1"); Browser.MiddlePause(); IWebElement confirm = Browser.CurrentBrowser.FindElement(ConfirmWithdrawBtn); confirm.Click(); Browser.MiddlePause(); Browser.CurrentBrowser.SwitchTo().Window(MetamaskTab); Browser.CurrentBrowser.Navigate().GoToUrl("chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/home.html#"); Browser.LongPause(); Browser.CurrentBrowser.Navigate().Refresh(); Browser.ShortPause(); Console.WriteLine("Confirming request..."); BloqBoard.MainPageBb.SignRequest(); Browser.CurrentBrowser.SwitchTo().Window(BloqboardTab); Browser.LongPause(); IWebElement msg = Browser.CurrentBrowser.FindElement(ConfirmationMessage); Assert.IsTrue(msg.Text.Contains("successfully"), "[" + Env + "] BLOQBOARD", "Withdraw functionality is not working properly"); } catch (Exception exception) { Assert.FinilizeErrors(Env, "BLOQBOARD", exception, false); } }
//Tests public static void SearchAvailability() { try { // IList<IWebElement> MyElements = Engine.Browser.CurrentBrowser.FindElements(By.CssSelector("[text-anchor='start']")); Open(); IWebElement searchinput = Engine.Browser.CurrentBrowser.FindElement(SearchInput); Assert.IsTrue(searchinput.Displayed, "[" + Env + "] LOANSCAN", "Search is not available on the page"); } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
//Tests public static void VerifyLendToLiquidityPoolTableisOpened() { try { Console.WriteLine("Login to the app..."); ReadOnlyCollection <string> windows = MainPageBb.LoginToMainPage("lender"); string MetamaskTab = windows[0]; string BloqboardTab = windows[1]; Console.WriteLine("Test started..."); Browser.CurrentBrowser.SwitchTo().Window(BloqboardTab); Browser.CurrentBrowser.Navigate().GoToUrl(TestData.Urls.Lend); Browser.MiddlePause(); IWebElement table = Browser.CurrentBrowser.FindElement(LendToLiquidityTable); Assert.IsTrue(table.Displayed, "[" + Env + "] BLOQBOARD", "Lend to liquidity table is not loaded correctly"); } catch (Exception exception) { Assert.FinilizeErrors(Env, "BLOQBOARD", exception, false); } }
public static void VerifyProtocolsSingleCards() { try { Engine.Browser.CurrentBrowser.Navigate().GoToUrl("https://loanscan.io/agreements/MakerDao/14142"); Engine.Browser.MiddlePause(); string valuesStr = ""; IList <IWebElement> values = Engine.Browser.CurrentBrowser.FindElements(By.CssSelector(".col-sm-3")); foreach (var val in values) { valuesStr += val.Text; } if (valuesStr != "Repayment progressLoan balanceLoan termLoan interest rate (annual)Loan-to-value (LTV) currentBorrower addressLender addressLoan drawsCollateralRepaymentsCumulative liquidation feeCDP creation linkLending platformLending protocol") { throw new Exception("[" + Env + "] LOANSCAN: MakerDao card is probably broken. Please check manually."); } Engine.Browser.MiddlePause(); Engine.Browser.CurrentBrowser.Navigate().GoToUrl("https://loanscan.io/agreements/Dharma/0x2544c6eeb2cc029f216b7d032b31b35b8efd01ac243b8a391cf7bb23e33e05be"); Engine.Browser.MiddlePause(); string valuesDharmaStr = ""; IList <IWebElement> valuesDharma = Engine.Browser.CurrentBrowser.FindElements(By.CssSelector(".col-sm-3")); foreach (var val in valuesDharma) { valuesDharmaStr += val.Text; } var finalDharma = valuesDharmaStr.Replace(" ", string.Empty); if (!valuesDharmaStr.Contains("(annual)/(per loan term)Loan issuance dateLoan maturity dateLoan-to-value (LTV) at originationLoan-to-value (LTV) currentBorrower addressLender addressCollateralRepaymentsRepayment frequencyAgreement IdLending platformLending platform addressLending platform feesUnderwriter nameUnderwriter addressUnderwriter feesUnderwriter risk ratingLoan issuance linkLoan contractLending protocol")) { throw new Exception("[" + Env + "] LOANSCAN: Dharma card is probably broken. Please check manually."); } } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void VerifyDataonDharmaCardcorrespondsDataFromTable() { try { Open(); IWebElement dharmacolumn = Engine.Browser.CurrentBrowser.FindElement(DharmaColumn); dharmacolumn.Click(); Engine.Browser.MiddlePause(); IWebElement row = Engine.Browser.CurrentBrowser.FindElement(Row); IWebElement annaulInterestRateTable = Engine.Browser.CurrentBrowser.FindElement(AnnaulInterestRateTable); string annaulintRateTableValue = annaulInterestRateTable.Text; IWebElement loanTermTable = Engine.Browser.CurrentBrowser.FindElement(LoanTermTable); string loanTermtableValue = loanTermTable.Text; IWebElement repayedTable = Engine.Browser.CurrentBrowser.FindElement(RepayedTable); string repayedTableValue = repayedTable.Text; IWebElement underwriterNameTable = Engine.Browser.CurrentBrowser.FindElement(UnderwriterNameTable); string underwriterNameTableValue = underwriterNameTable.Text; IWebElement relayerNameTable = Engine.Browser.CurrentBrowser.FindElement(RelayerNameTable); string relayerNameTableValue = relayerNameTable.Text; row.Click(); Engine.Browser.MiddlePause(); IWebElement annualInterestRateCard = Engine.Browser.CurrentBrowser.FindElement(AnnualInterestRateCard); string annaulVlaueCard = annualInterestRateCard.Text; if (!annaulVlaueCard.Contains(annaulintRateTableValue)) { throw new Exception("[" + Env + "] LOANSCAN: Annual Interest Rate value doesn't match through the table and the card. Please check manually."); } IWebElement repayedCard = Engine.Browser.CurrentBrowser.FindElement(RepayedCard); if (!repayedCard.Text.Contains(repayedTableValue)) { throw new Exception("[" + Env + "] LOANSCAN: %Repayed value doesn't match through the table and the card. Please check manually."); } IWebElement loanTermCard = Engine.Browser.CurrentBrowser.FindElement(LoanTermCard); if (!loanTermCard.Text.Contains(loanTermtableValue)) { throw new Exception("[" + Env + "] LOANSCAN: Loan Term value doesn't match through the table and the card. Please check manually."); } IWebElement underwritercard = Engine.Browser.CurrentBrowser.FindElement(UnderwrietrNameCard); if (!underwritercard.Text.Contains(underwriterNameTableValue)) { throw new Exception("[" + Env + "] LOANSCAN: Underwriter Name value doesn't match through the table and the card. Please check manually."); } //IWebElement relayername = Engine.Browser.CurrentBrowser.FindElement(By.CssSelector("dl.row > dd:nth-of-type(16) > a > span.d-none.d-md-inline-block")); //OR //if (!relayername.Text.Substring(0, 5).Contains(relayerNameTableValue.Substring(0, 5))) //{ // throw new Exception("[" + Env + "] LOANSCAN: Relayer Name value doesn't match through the table and the card. Please check manually."); //} } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
//TESTS public static void VerifyElementsonDharmaSingleCard() { try { Open(); IWebElement dharmacolumn = Engine.Browser.CurrentBrowser.FindElement(DharmaColumn); dharmacolumn.Click(); Engine.Browser.MiddlePause(); IWebElement firstrow = Engine.Browser.CurrentBrowser.FindElement(Row); firstrow.Click(); Engine.Browser.MiddlePause(); IList <IWebElement> elements = Engine.Browser.CurrentBrowser.FindElements(ElementsonCardPageDharma); if (elements.Count < 24) { throw new Exception("[" + Env + "] LOANSCAN fields count is incorrect. Please check manually. " + elements.Count + " URL " + Engine.Browser.CurrentBrowser.Url); } else { if (!elements[0].Text.Contains("Repayment progress")) { throw new Exception("[" + Env + "] LOANSCAN: Repayment progress element is incorrect. Please check manually."); } if (!elements[1].Text.Contains("Loan amount")) { throw new Exception("[" + Env + "] LOANSCAN: Loan amount field is incorrect. Please check manually."); } if (!elements[2].Text.Contains("Loan term")) { throw new Exception("[" + Env + "] LOANSCAN: Loan term field is incorrect. Please check manually."); } if (!elements[3].Text.Contains("Loan interest rate")) { throw new Exception("[" + Env + "] LOANSCAN: Loan interest rate field is incorrect. Please check manually."); } if (!elements[4].Text.Contains("Loan issuance date")) { throw new Exception("[" + Env + "] LOANSCAN: Loan issuance date field is incorrect. Please check manually."); } //Loan issuance date if (!elements[5].Text.Contains("Loan maturity date")) { throw new Exception("[" + Env + "] LOANSCAN: Loan maturity date field is incorrect. Please check manually."); } if (!elements[6].Text.Contains("Loan-to-value (LTV) at origination")) { throw new Exception("[" + Env + "] LOANSCAN: Loan-to-value (LTV) at origination field is incorrect. Please check manually."); } if (!elements[7].Text.Contains("Loan-to-value (LTV) current")) { throw new Exception("[" + Env + "] LOANSCAN: Loan-to-value (LTV) current field is incorrect. Please check manually."); } //Debtor address if (!elements[8].Text.Contains("Borrower address")) { throw new Exception("[" + Env + "] LOANSCAN: Debtor address field is incorrect. Please check manually."); } //Creditor address if (!elements[9].Text.Contains("Lender address")) { throw new Exception("[" + Env + "] LOANSCAN: Creditor address field is incorrect. Please check manually."); } if (!elements[10].Text.Contains("Collateral")) { throw new Exception("[" + Env + "] LOANSCAN: Collateral field is incorrect. Please check manually."); } if (!elements[11].Text.Contains("Repayments")) { throw new Exception("[" + Env + "] LOANSCAN: Repayments field is incorrect. Please check manually."); } if (!elements[12].Text.Contains("Repayment frequency")) { throw new Exception("[" + Env + "] LOANSCAN: Repayment frequency field is incorrect. Please check manually."); } if (!elements[13].Text.Contains("Agreement Id")) { throw new Exception("[" + Env + "] LOANSCAN: Agreement Id field is incorrect. Please check manually."); } //Relayer name if (!elements[14].Text.Contains("Lending platform")) { throw new Exception("[" + Env + "] LOANSCAN: Relayer name field is incorrect. Please check manually."); } //Relayer address if (!elements[15].Text.Contains("Lending platform address")) { throw new Exception("[" + Env + "] LOANSCAN: Relayer address field is incorrect. Please check manually."); } //Relayer fees if (!elements[16].Text.Contains("Lending platform fees")) { throw new Exception("[" + Env + "] LOANSCAN: Relayer fees field is incorrect. Please check manually."); } if (!elements[17].Text.Contains("Underwriter name")) { throw new Exception("[" + Env + "] LOANSCAN: Underwriter name field is incorrect. Please check manually."); } if (!elements[18].Text.Contains("Underwriter address")) { throw new Exception("[" + Env + "] LOANSCAN: Underwriter address field is incorrect. Please check manually."); } if (!elements[19].Text.Contains("Underwriter fees")) { throw new Exception("[" + Env + "] LOANSCAN:Underwriter fees field is incorrect. Please check manually."); } if (!elements[20].Text.Contains("Underwriter risk rating")) { throw new Exception("[" + Env + "] LOANSCAN: Underwriter risk rating field is incorrect. Please check manually."); } if (!elements[21].Text.Contains("Loan issuance link")) { throw new Exception("[" + Env + "] LOANSCAN: Loan issuance link field is incorrect. Please check manually."); } if (!elements[22].Text.Contains("Loan contract")) { throw new Exception("[" + Env + "] LOANSCAN: Loan contract field is incorrect. Please check manually."); } //Lending protocol/system if (!elements[23].Text.Contains("Lending protocol")) { throw new Exception("[" + Env + "] LOANSCAN: Lending protocol/system field is incorrect. Please check manually."); } } } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }
public static void VerifyTokenCanbeLendedtoLiquidityPool() { try { Console.WriteLine("Login to the app..."); ReadOnlyCollection <string> windows = MainPageBb.LoginToMainPage("lender"); string MetamaskTab = windows[0]; string BloqboardTab = windows[1]; Console.WriteLine("Test started..."); IWebElement MyLoans = Browser.CurrentBrowser.FindElement(By.CssSelector("div > div:nth-of-type(2) > a:nth-of-type(2)")); MyLoans.Click(); Browser.LongPause(); string loanedcount = CheckLoanedAmount(); Browser.MiddlePause(); Browser.CurrentBrowser.Navigate().GoToUrl(TestData.DefineRootAdressDependingOnEnvironment() + "lend"); Browser.LongPause(); IList <IWebElement> elementListRows = Browser.CurrentBrowser.FindElements(By.CssSelector(".on-demand-wrapper .content-table-row")); foreach (var el in elementListRows) { var children = el.FindElements(By.XPath(".//*")); var tokenName = children[0].Text; int i = 1; if (tokenName.Contains("WETH")) { foreach (var ele in children) { if (ele.Text.Contains("LEND") && ele.TagName == "div") { i++; if (i >= 3) { ele.Click(); break; } } } } } Browser.ShortPause(); IWebElement amount = Browser.CurrentBrowser.FindElement(LendAMountImput); amount.SendKeys("0.0001"); Browser.MiddlePause(); IWebElement confirm = Browser.CurrentBrowser.FindElement(ConfirmLendRedButton); confirm.Click(); Console.WriteLine("Approve on MetaMask..."); Wallets.ApproveTransaction(MetamaskTab, BloqboardTab); Browser.LongPause(); Console.WriteLine("Do the final assert..."); IWebElement Close = Browser.CurrentBrowser.FindElement(By.CssSelector("button.main-btn")); Close.Click(); Browser.ShortPause(); IWebElement MyLoansAfter = Browser.CurrentBrowser.FindElement(By.CssSelector("div > div:nth-of-type(2) > a:nth-of-type(2)")); MyLoansAfter.Click(); Browser.LongPause(); var loanedAfter = CheckLoanedAmount(); //Assert.IsTrue(loanedcount != loanedAfter, "[" + Env + "] BLOQBOARD", "Lend functionality is not working as expected"); } catch (Exception exception) { Browser.Close(); string Environment = TestData.DefineEnvironmentDependingOnEnvironment(); if (Environment.Contains("STAGING_Mainnet")) { throw new Exception("Transaction wait is too long (more than 3 minutes)..."); } Assert.FinilizeErrors(Env, "BLOQBOARD", exception, false); } }
public static void VerifyTokenCanbeBorrowedFromLiquidityPool() { try { Console.WriteLine("Login to the app..."); ReadOnlyCollection <string> windows = MainPageBb.LoginToMainPage("borrower"); string MetamaskTab = windows[0]; string BloqboardTab = windows[1]; Console.WriteLine("Test started..."); IWebElement Borrow = Browser.CurrentBrowser.FindElement(By.CssSelector("div.sidebar-block.loans-block > a:nth-of-type(1)")); Borrow.Click(); Browser.LongPause(); string environment = TestData.DefineEnvironmentDependingOnEnvironment(); if (environment.Contains("STAGING")) { IWebElement MyLoans = Browser.CurrentBrowser.FindElement(By.CssSelector("div > div:nth-of-type(2) > a:nth-of-type(2)")); MyLoans.Click(); Browser.LongPause(); string loanedcountSTAGING = ""; IList <IWebElement> elementListRowsSTAGING = Browser.CurrentBrowser.FindElements(By.CssSelector(".on-demand-wrapper .content-table-row")); foreach (var el in elementListRowsSTAGING) { var children = el.FindElements(By.XPath(".//*")); var tokenName = children[0].Text; int i = 1; if (tokenName.Contains("ZRX")) { foreach (var ele in children) { if (ele.Text.Contains("Borrowed") && loanedcountSTAGING == "") { loanedcountSTAGING = ele.Text; } } } } Browser.CurrentBrowser.Navigate().GoToUrl(TestData.Urls.Lend); Browser.LongPause(); IList <IWebElement> elementListRowsBorrow = Browser.CurrentBrowser.FindElements(By.CssSelector(".on-demand-wrapper .content-table-row")); foreach (var el in elementListRowsBorrow) { var children = el.FindElements(By.XPath(".//*")); var tokenName = children[0].Text; int i = 1; if (tokenName.Contains("ZRX")) { foreach (var ele in children) { if (ele.Text.Contains("BORROW") && ele.TagName == "div") { i++; if (i >= 3) { ele.Click(); break; } } } } } Browser.ShortPause(); IWebElement amountBorrow = Browser.CurrentBrowser.FindElement(LendAMountImput); amountBorrow.SendKeys("0.0001"); Browser.MiddlePause(); IWebElement confirmBorrow = Browser.CurrentBrowser.FindElement(By.CssSelector("button.on-demand-modal__button.btn-green")); confirmBorrow.Click(); Browser.LongPause(); Console.WriteLine("Approve on MetaMask..."); Wallets.ApproveTransaction(MetamaskTab, BloqboardTab); Browser.LongPause(); Console.WriteLine("Do the final assert..."); IWebElement Close = Browser.CurrentBrowser.FindElement(By.CssSelector("button.main-btn")); Close.Click(); Browser.ShortPause(); //IWebElement MyLoansAfter = Browser.CurrentBrowser.FindElement(By.CssSelector("div > div:nth-of-type(2) > a:nth-of-type(2)")); //MyLoansAfter.Click(); //Browser.LongPause(); //string loanedAmountAfterBorrow = loanedcountSTAGING; //var loanedAfterStaging = CheckBorrowedAmount(); //Assert.IsTrue(loanedcountSTAGING != loanedAfterStaging, "[" + Env + "] BLOQBOARD", "Lend functionality is not working as expected"); } else { string loanedcount = ""; IList <IWebElement> elementListRows = Browser.CurrentBrowser.FindElements(By.CssSelector(".on-demand-wrapper .content-table-row")); foreach (var el in elementListRows) { var children = el.FindElements(By.XPath(".//*")); var tokenName = children[0].Text; int i = 1; if (tokenName.Contains("ZRX")) { foreach (var ele in children) { if (ele.Text.Contains("Borrowed") && loanedcount == "") { loanedcount = ele.Text; } if (ele.Text.Contains("BORROW") && ele.TagName == "div") { i++; if (i >= 3) { ele.Click(); break; } } } } } Browser.ShortPause(); IWebElement amount = Browser.CurrentBrowser.FindElement(LendAMountImput); amount.SendKeys("0.0001"); Browser.MiddlePause(); IWebElement confirm = Browser.CurrentBrowser.FindElement(By.CssSelector("button.on-demand-modal__button.btn-green")); confirm.Click(); Console.WriteLine("Approve on MetaMask..."); Wallets.ApproveTransaction(MetamaskTab, BloqboardTab); Console.WriteLine("Do the final assert..."); string loanedAmountAfter = loanedcount; var loanedAfter = CheckBorrowedAmount(); //Assert.IsTrue(loanedcount != loanedAfter, "[" + Env + "] BLOQBOARD", "Lend functionality is not working as expected"); } } catch (Exception exception) { Browser.Close(); Assert.FinilizeErrors(Env, "BLOQBOARD", exception, false); } }
public static void VerifyTokenCanbeRepaidFromLiquidityPool() { try { Console.WriteLine("Login to the app..."); ReadOnlyCollection <string> windows = MainPageBb.LoginToMainPage("lender"); string MetamaskTab = windows[0]; string BloqboardTab = windows[1]; Console.WriteLine("Test started..."); Browser.CurrentBrowser.Navigate().GoToUrl(TestData.DefineRootAdressDependingOnEnvironment() + "lend"); Browser.MiddlePause(); //IWebElement loansbtn = Browser.CurrentBrowser.FindElement(By.CssSelector("div > div:nth-of-type(2) > a:nth-of-type(2)")); //loansbtn.Click(); Browser.LongPause(); //IWebElement loanedRepamount = Browser.CurrentBrowser.FindElement(LoanedRep); //string[] stringSeparators = new string[] { "." }; //var result = loanedRepamount.Text.Split(stringSeparators, StringSplitOptions.None); //double loanedRep = double.Parse(result[0]); //string loanedcount = ""; //IList<IWebElement> elementListRows = Browser.CurrentBrowser.FindElements(By.CssSelector(".on-demand-wrapper .content-table-row")); //foreach (var el in elementListRows) //{ // var children = el.FindElements(By.XPath(".//*")); // var tokenName = children[0].Text; // int i = 1; // if (tokenName.Contains("ZRX")) // { // foreach (var ele in children) // { // if (ele.Text.Contains("Borrowed") && loanedcount == "") // { // loanedcount = ele.Text; // } // if (ele.Text.Contains("REPAY") && ele.TagName == "div") // { // i++; // if (i >= 3) // { // ele.Click(); // break; // } // } // } // } //} //Browser.ShortPause(); //IWebElement amount = Browser.CurrentBrowser.FindElement(LendAMountImput); //amount.SendKeys("0.002"); //Browser.MiddlePause(); //IWebElement confirm = Browser.CurrentBrowser.FindElement(By.CssSelector("button.on-demand-modal__button.btn-red")); //confirm.Click(); //Browser.MiddlePause(); //Browser.CurrentBrowser.SwitchTo().Window(MetamaskTab); //Browser.CurrentBrowser.Navigate().GoToUrl("chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/home.html#"); //Browser.LongPause(); //Browser.CurrentBrowser.Navigate().Refresh(); //Browser.ShortPause(); //Console.WriteLine("Confirming request..."); //BloqBoard.MainPageBb.SignRequest(); //Browser.ShortPause(); //Browser.CurrentBrowser.SwitchTo().Window(BloqboardTab); //Browser.LongPause(); //string loanedAmountAfter = loanedcount; //var loanedAfter = CheckBorrowedAmount(); //Assert.IsTrue(loanedcount != loanedAfter, "[" + Env + "] BLOQBOARD", "Lend functionality is not working as expected"); } catch (Exception exception) { Assert.FinilizeErrors(Env, "BLOQBOARD", exception, false); } }
public static void VerifyElementsonMakerDaoSingleCard() { try { Open(); IWebElement column = Engine.Browser.CurrentBrowser.FindElement(MakerDaoColumn); column.Click(); Engine.Browser.MiddlePause(); IWebElement firstrow = Engine.Browser.CurrentBrowser.FindElement(Row); firstrow.Click(); Engine.Browser.LongPause(); IList <IWebElement> elements = Engine.Browser.CurrentBrowser.FindElements(ElementsonCardPageDharma); if (!elements[0].Text.Contains("Repayment progress")) { throw new Exception("[" + Env + "] LOANSCAN: Repayment progress field is not present at the card page. Please check manually."); } if (!elements[1].Text.Contains("Loan balance")) { throw new Exception("[" + Env + "] LOANSCAN: Loan balance field is not present at the card page. Please check manually."); } if (!elements[2].Text.Contains("Loan term")) { throw new Exception("[" + Env + "] LOANSCAN: Loan term field is not present at the card page. Please check manually."); } if (!elements[3].Text.Contains("Loan interest rate (annual)")) { throw new Exception("[" + Env + "] LOANSCAN: Loan interest rate (annual) field is not present at the card page. Please check manually."); } if (!elements[4].Text.Contains("Loan-to-value (LTV) current")) { throw new Exception("[" + Env + "] LOANSCAN: Loan-to-value (LTV) current field is not present at the card page. Please check manually."); } // if (!elements[5].Text.Contains("Borrower address")) { throw new Exception("[" + Env + "] LOANSCAN: Debtor addresst field is not present at the card page. Please check manually."); } if (!elements[6].Text.Contains("Lender address")) { throw new Exception("[" + Env + "] LOANSCAN: Creditor address field is not present at the card page. Please check manually."); } if (!elements[7].Text.Contains("Loan draws")) { throw new Exception("[" + Env + "] LOANSCAN: Loan draws field is not present at the card page. Please check manually."); } if (!elements[8].Text.Contains("Collateral")) { throw new Exception("[" + Env + "] LOANSCAN: Collateral field is not present at the card page. Please check manually."); } if (!elements[10].Text.Contains("Repayments")) { throw new Exception("[" + Env + "] LOANSCAN: Repayments field is not present at the card page. Please check manually."); } if (!elements[11].Text.Contains("Cumulative liquidation fee")) { throw new Exception("[" + Env + "] LOANSCAN: Cumulative liquidation fee field is element. Please check manually."); } if (!elements[12].Text.Contains("CDP creation link")) { throw new Exception("[" + Env + "] LOANSCAN: CDP creation link field is not present at the card page. Please check manually."); } if (!elements[13].Text.Contains("Lending platform")) { throw new Exception("[" + Env + "] LOANSCAN: Lending protocol/system field is not present at the card page. Please check manually."); } } catch (Exception exception) { Assert.FinilizeErrors(Env, "LOANSCAN", exception, false); } }