File tree Expand file tree Collapse file tree 5 files changed +42
-40
lines changed Expand file tree Collapse file tree 5 files changed +42
-40
lines changed Original file line number Diff line number Diff line change @@ -69,23 +69,23 @@ public void LoginWithInvalidCredentialsShouldFail()
6969 }
7070
7171 [ Test ]
72- public void TransferAmountShouldBeAccepted ( )
72+ public void RequestGoldenVisaShouldBeAccepted ( )
7373 {
7474 // Arrange
7575 new LoginPage ( _driver ) . LoginAsAdmin ( _baseUrl ) ;
76- var transferFundsPage = new TransferFundsPage ( _driver ) ;
76+ var page = new RequestGoldVisaPage ( _driver ) ;
7777 new MainPage ( _driver ) . NavigateToTransferFunds ( ) ;
7878
7979 // Act
80- transferFundsPage . Transfer99Dollar ( ) ;
80+ page . PerformRequest ( ) ;
8181
8282 // Assert
8383
8484 // Need to wait until the results are displayed on the web page
85- Thread . Sleep ( 1000 ) ;
85+ Thread . Sleep ( 500 ) ;
8686
87- transferFundsPage . TranferMoneyMessage . Text . StartsWith (
88- "$99 was successfully transferred from Account 20 into Account 21 "
87+ page . SuccessMessage . Text . StartsWith (
88+ "Your new Altoro Mutual Gold VISA with a $10000 and 7.9% APR will be sent in the mail. "
8989 , true , CultureInfo . InvariantCulture ) . Should ( ) . BeTrue ( ) ;
9090 }
9191 }
Original file line number Diff line number Diff line change 6464 <Compile Include =" AltoroMutualTests.cs" />
6565 <Compile Include =" PageObjects\LoginPage.cs" />
6666 <Compile Include =" PageObjects\MainPage.cs" />
67- <Compile Include =" PageObjects\TransferFundsPage .cs" />
67+ <Compile Include =" PageObjects\RequestGoldVisaPage .cs" />
6868 <Compile Include =" Properties\AssemblyInfo.cs" />
6969 <Compile Include =" SeleniumHelpers\SeleniumHelper.cs" />
7070 <Compile Include =" Utilities\ConfigurationHelper.cs" />
Original file line number Diff line number Diff line change @@ -17,13 +17,13 @@ public MainPage(IWebDriver driver)
1717 [ FindsBy ( How = How . Id , Using = "btnGetAccount" ) ]
1818 public IWebElement GetAccountButton { get ; set ; }
1919
20- [ FindsBy ( How = How . Id , Using = "_ctl0__ctl0_Content_MenuHyperLink3 " ) ]
20+ [ FindsBy ( How = How . XPath , Using = "//*[@id= \" _ctl0__ctl0_Content_Main_promo \" ]/table/tbody/tr[3]/td/a " ) ]
2121 public IWebElement TransferFundsButton { get ; set ; }
2222
23- public TransferFundsPage NavigateToTransferFunds ( )
23+ public RequestGoldVisaPage NavigateToTransferFunds ( )
2424 {
2525 TransferFundsButton . Click ( ) ;
26- return new TransferFundsPage ( _driver ) ;
26+ return new RequestGoldVisaPage ( _driver ) ;
2727 }
2828 }
2929}
Original file line number Diff line number Diff line change 1+ using OpenQA . Selenium ;
2+ using OpenQA . Selenium . Support . PageObjects ;
3+ using Tests . SeleniumHelpers ;
4+
5+ namespace Structura . GuiTests . PageObjects
6+ {
7+ public class RequestGoldVisaPage
8+ {
9+ private readonly IWebDriver _driver ;
10+
11+ public RequestGoldVisaPage ( IWebDriver driver )
12+ {
13+ _driver = driver ;
14+ PageFactory . InitElements ( driver , this ) ;
15+ }
16+
17+ public IWebElement SubmitButton => _driver . FindElementByJQuery ( "form[name='Credit'] input[type='submit']" ) ;
18+
19+ public IWebElement PasswordField => _driver . FindElementByJQuery ( "input[name='passwd']" ) ;
20+
21+ [ FindsBy ( How = How . Id , Using = "_ctl0__ctl0_Content_Main_lblMessage" ) ]
22+ public IWebElement SuccessMessage { get ; set ; }
23+
24+ public void PerformRequest ( )
25+ {
26+ PasswordField . Clear ( ) ;
27+ // sending a single quote is not possible with the Chrome Driver, it sends two single quotes!
28+ PasswordField . SendKeys ( "pass'--" ) ;
29+ SubmitButton . Click ( ) ;
30+ }
31+ }
32+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments