-
-
Save testautomationtribe/8ae64c694254b3d99793c3343177a55f to your computer and use it in GitHub Desktop.
Login steps with page object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using OpenQA.Selenium; | |
using TatAuto.Pages; | |
using TechTalk.SpecFlow; | |
namespace TatAuto.Bindings.Steps | |
{ | |
[Binding] | |
public class LoginSteps | |
{ | |
private readonly IWebDriver _driver; | |
public LoginSteps() | |
{ | |
_driver = ScenarioContext.Current.Get<IWebDriver>("currentDriver"); | |
} | |
[Given(@"I Navigate to the Login page")] | |
public void GivenINavigateToTheLoginPage() | |
{ | |
_driver.Navigate().GoToUrl("http://127.0.0.1:4001/wordpress/wp-login.php"); | |
} | |
[When(@"I Login with Username '(.*)' and Password '(.*)' on the Login Page")] | |
public void WhenILoginWithUsernameAndPasswordOnTheLoginPage(string username, string password) | |
{ | |
LoginPObject loginPage = new LoginPObject(_driver); | |
loginPage.LoginAs(username, password); | |
} | |
[Then(@"the User Name '(.*)' Should be seen on the Dashboard Page")] | |
public void ThenTheUserNameShouldBeSeenOnTheDashboardPage(string expectedUser) | |
{ | |
DashboardPObject dashboardPage = new DashboardPObject(_driver); | |
Assert.IsTrue(dashboardPage.GetUser().Contains(expectedUser)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment