public void ValidLogUserIn() { //var username = TestContext.DataRow[0] as string; //var password = TestContext.DataRow[1] as string; //another way to write this var username = TestContext.DataRow["username"] as string; var password = TestContext.DataRow["password"] as string; //the below was copied from above.we //want it create account and login //var createAccount = new CreateAccount(_driver); //// createAccount.RegisterAccount(); //var loginpage = createAccount.RegisterAccount(); //loginpage.LoginAsValidUser(username, password); //var logOutPage = new LogOutPage(_driver); //logOutPage.LogUserOut(); //we want to reduce the 5 lines of code above //using POM // var createAccount1 = new CreateAccount(_driver); // CreateAccount createAccount1= new CreateAccount(_driver); createAccount1 .RegisterAccount() .LoginAsValidUser(username, password) .SearchForPc() .LogUserOut(); //as we did for CreateANewAccount() we will do //var for loginPage in "LoginPage.cs" // var loginPage = new LoginPage(_driver); // loginPage.LoginAsValidUser(username, password); //var logoutButton = _driver.FindElement(By.ClassName("ico-logout")); //Assert.IsTrue(logoutButton.Displayed); }
public void CreateANewAccount() { var createAccount = new CreateAccount(_driver); createAccount.RegisterAccount(); }