public void GivenIOpenBrowserAndGoToCafeTownsendHomePage() { var test = new BaseTest(ConfigurationManager.AppSettings["cafeTownsendURL"]); var loginLogout = new LoginLogoutPage(test._driver); var basePage = new BaseTest(test._driver); var employeeManagement = new EmployeeManagementPage(test._driver); var extraActions = new ExtraActions(test._driver); ScenarioContext.Current.Clear(); ScenarioContext.Current.Set(loginLogout); ScenarioContext.Current.Set(basePage); ScenarioContext.Current.Set(employeeManagement); ScenarioContext.Current.Set(extraActions); }
[Test] //LOGIN + LOGOUT public void LoginLogout() { var loginPage = new LoginLogoutPage(Driver); var Loginform = loginPage.LoginForm(); var LoginPassAndSubmit = loginPage.LoginPassAndSubmit(user); //Thread.Sleep(1000); Driver.WaitForMeDisplayed(Driver.FindElement(By.XPath("//div[@class='tbar-top hidden-sm hidden-xs']//*[text()=' DVhbCERv ']")), 20); Assert.IsTrue(Driver.FindElement(By.XPath("//div[@class='tbar-top hidden-sm hidden-xs']//*[text()=' DVhbCERv ']")).Displayed, "You wasn't logged in, incorrect username or password"); var AccountPage = new LoginLogoutPage(Driver); Driver.WaitForMeDisplayed(AccountPage.AccountDropdown, 20); var Logout = AccountPage.Logout(); Assert.IsTrue(Driver.FindElement(By.XPath("//div[@class='tbar-top hidden-sm hidden-xs']//*[text()=' My Account ']")).Displayed, "Ooops! You wasn't logged out"); }