[TestCase("user", "password")] //enters valid username and password public void TestFirstnameAndLastnameInProfilePage(string user, string password) { //calls helper method InitLoginPage InitLoginPage(user, password, null, null, null); Thread.Sleep(2000); //creates instance of NavigationControl object Navigationcontrol navControl = new Navigationcontrol(driver); //verifies navigation links VerifyNavigationControl(navControl); //clicks on profile link navControl.GotoProfile(); Thread.Sleep(2000); //creates new Profile page object ProfilePage profilePage = new ProfilePage(driver); //checks username in profile container profilePage.VerifyTextboxes(); Thread.Sleep(2000); //enters firstname and last name profilePage.EnterFirstAndLastName("John", "Sanders"); //clicks on home link navControl.GotoHome(); Thread.Sleep(2000); //verifies first and last name in home page profile container profilePage.VerifyFullNameInHome("John ", "Sanders"); //clicks on profile link navControl.GotoProfile(); //resets to original value profilePage.ResetToOriginal(); }
[TestCase("pinkfloyd", "password")] //enters valid username and password public void TestProfilePageTitleAndFooter(string user, string password) { //calls helper method InitLoginPage InitLoginPage(user, password, null, null, null); Thread.Sleep(2000); //creates instance of NavigationControl object Navigationcontrol navControl = new Navigationcontrol(driver); //verifies navigation links VerifyNavigationControl(navControl); //clicks on profile link navControl.GotoProfile(); Thread.Sleep(2000); //creates new Explore page object ProfilepageTitleandFooter profilepageTitle = new ProfilepageTitleandFooter(driver); Thread.Sleep(2000); //explore title var expected = "PinkFloyd's profile - BC Yips!"; var actual = driver.Title; Assert.AreEqual(expected, actual, "title does not match"); //verifies footer on home page expected = "© 2020 - Bellevue College"; actual = profilepageTitle.FooterBC.Text; Assert.AreEqual(expected, actual, "Footer does not match"); }
[TestCase("pinkfloyd", "password")] //enters valid username and password public void TestExploreH3Header(string user, string password) { //calls helper method InitLoginPage InitLoginPage(user, password, null, null, null); Thread.Sleep(2000); //creates instance of NavigationControl object Navigationcontrol navControl = new Navigationcontrol(driver); //verifies navigation links VerifyNavigationControl(navControl); navControl.GotoExplore(); //creates instance of ExplorePage object ExplorePage h3Header = new ExplorePage(driver); Thread.Sleep(2000); //verifies top hashtags var expected = "Top Hashtags"; var actual = h3Header.TopHashTags.Text; Assert.AreEqual(expected, actual); //verifies top yippers expected = "Top yippers"; actual = h3Header.TopYippers.Text; Assert.AreEqual(expected, actual); }
[TestCase("pinkfloyd", "password")] //enters valid username and password public void TestProfilePageSearchBox(string user, string password) { //calls helper method InitLoginPage InitLoginPage(user, password, null, null, null); //creates instance of NavigationControl object Navigationcontrol navControl = new Navigationcontrol(driver); //verifies navigation links VerifyNavigationControl(navControl); //clicks on Profile link navControl.GotoProfile(); //creates instance of Searchbox object SearchBox searchBox = new SearchBox(driver); Thread.Sleep(2000); //verifies search box elements searchBox.VerifyElement(); Thread.Sleep(2000); //send text into search box searchBox.SearchYip("wind chimes"); Thread.Sleep(2000); //verifies explore page title searchBox.VerifyTitle(); //asserts text with search label searchBox.VerifySearchLabel("wind chimes"); }
[TestCase("pinkfloyd", "password")] //enters valid username and password public void TestExplorePageTitleAndFooter(string user, string password) { //calls helper method InitLoginPage InitLoginPage(user, password, null, null, null); Thread.Sleep(2000); //creates instance of NavigationControl object Navigationcontrol navControl = new Navigationcontrol(driver); navControl.GotoExplore(); Thread.Sleep(2000); //creates new Explore page object ExploreTitleAndFooter exploreTitleFooter = new ExploreTitleAndFooter(driver); Thread.Sleep(2000); //explore title var expected = "Explore - BC Yips!"; var actual = driver.Title; Assert.AreEqual(expected, actual); //verifies footer on home page expected = "© 2020 - Bellevue College"; actual = exploreTitleFooter.FooterBC.Text; Assert.AreEqual(expected, actual, "Footer does not match"); }
//helper method to verify navigation control links private void VerifyNavigationControl(Navigationcontrol navControl) { //verifies all these elements are available Assert.IsNotNull(navControl.HomeLink, "Home link is not available"); Assert.IsNotNull(navControl.ExploreLink, "Explore link is not available"); Assert.IsNotNull(navControl.ProfileLink, "Profile link is not available"); Assert.IsNotNull(navControl.SignOutLink, "Signout link is not available"); }
//helper method to find elements private void Init() { //h3 header topHashtags = By.XPath("//*[@class=\"trending-hashtags\"]/header/h3"); topYippers = By.XPath("//*[@class=\"Explore\"]//section[2]/header/h3"); //explore title and footer class expTitleFooter = new ExploreTitleAndFooter(this.driver); //navigation control class navControl = new Navigationcontrol(this.driver); }
[TestCase("pinkfloyd", "password")] //enters valid username and password public void TestNavigationControlExplorePage(string user, string password) { //calls helper method InitLoginPage InitLoginPage(user, password, null, null, null); Thread.Sleep(2000); //creates instance of NavigationControl object Navigationcontrol navControl = new Navigationcontrol(driver); //verifies navigation links VerifyNavigationControl(navControl); //signs out from homepage navControl.SignOut(); }
//helper method to find elements private void Init() { //title page homepageTitle = By.XPath("/html/head/title"); //footer footerBC = By.XPath("/html/body/footer"); //all recent feed allYipsh2Header = By.XPath("//*[@class=\"yips-list\"]/h2"); //compose new yip class composeYip = new ComposeNewYip(this.driver); //Search box class searchBox = new SearchBox(this.driver); //navigation control class navControl = new Navigationcontrol(this.driver); yipListControl = new YipsListControl(this.driver); }
public void TestSignIn(string user, string password, string errorMessage = null, string userErrorMessage = null, string passwordErrorMessage = null) { this.InitLoginPage(user, password, errorMessage, userErrorMessage, passwordErrorMessage); if (errorMessage == null && userErrorMessage == null && passwordErrorMessage == null) { Thread.Sleep(2000); //creates new homepage object HomePage homepage = new HomePage(driver); //verifies homepage title homepage.VerifyTitleAndFooter(); Thread.Sleep(2000); //creates instance of NavigationControl object Navigationcontrol navControl = new Navigationcontrol(driver); //signs out from homepage navControl.SignOut(); Thread.Sleep(2000); } }
[TestCase("user", "password")] //enters valid username and password public void TestUserNameInProfileContainer(string user, string password) { //calls helper method InitLoginPage InitLoginPage(user, password, null, null, null); Thread.Sleep(2000); //creates instance of NavigationControl object Navigationcontrol navControl = new Navigationcontrol(driver); //verifies navigation links VerifyNavigationControl(navControl); //clicks on profile link navControl.GotoProfile(); Thread.Sleep(2000); //creates new Explore page object ProfilePage profilePage = new ProfilePage(driver); //checks username in profile container profilePage.VerifyUserName("user"); }
[TestCase("pinkfloyd", "password")] //enters valid username and password public void TestUserProfileAndYippersHeader(string user, string password) { //calls helper method InitLoginPage InitLoginPage(user, password, null, null, null); Thread.Sleep(2000); //creates instance of NavigationControl object Navigationcontrol navControl = new Navigationcontrol(driver); //verifies navigation links VerifyNavigationControl(navControl); //clicks on profile link navControl.GotoProfile(); Thread.Sleep(2000); //creates new Explore page object ProfilepageTitleandFooter profilepageTitle = new ProfilepageTitleandFooter(driver); Thread.Sleep(2000); //checks user profile and yippers header profilepageTitle.VerifyUserProfileAndYippersHeader("PinkFloyd"); }
[TestCase("user", "password", "", "", "The New password field is required.")] //enters valid username and password, but invalid new password public void TestInvalidChangePasswordFields(string user, string password, string newPassword, string confirmNewPassword, string errorMessage) { //calls helper method InitLoginPage InitLoginPage(user, password, null, null, null); Thread.Sleep(2000); //creates instance of NavigationControl object Navigationcontrol navControl = new Navigationcontrol(driver); //verifies navigation links VerifyNavigationControl(navControl); //clicks on profile link navControl.GotoProfile(); Thread.Sleep(2000); //creates new Profile page object ProfilePageChangePassword changePassword = new ProfilePageChangePassword(driver); //sends current, new and confirm new password into textboxes changePassword.VerifyChangePassword(password, newPassword, confirmNewPassword); //verifies error message changePassword.VerifyErrorLabel(errorMessage); }
[TestCase("user", "password", "[]\\;'/", "[]\\;'/")] //enters valid username and password public void TestChangePasswordFields(string user, string password, string newPassword, string confirmNewPassword) { //calls helper method InitLoginPage InitLoginPage(user, password, null, null, null); Thread.Sleep(2000); //creates instance of NavigationControl object Navigationcontrol navControl = new Navigationcontrol(driver); //verifies navigation links VerifyNavigationControl(navControl); //clicks on profile link navControl.GotoProfile(); Thread.Sleep(2000); //creates new Profile page object ProfilePageChangePassword changePassword = new ProfilePageChangePassword(driver); changePassword.VerifyChangePassword(password, newPassword, confirmNewPassword); Thread.Sleep(2000); //clicks on sign-out link navControl.SignOut(); Thread.Sleep(2000); //sign in again with a new password InitLoginPage(user, newPassword, null, null, null); Thread.Sleep(2000); //creates new homepage object HomePage homepage = new HomePage(driver); //verifies homepage title homepage.VerifyTitleAndFooter(); //clicks on profile link navControl.GotoProfile(); Thread.Sleep(2000); //creates new Profile page object changePassword = new ProfilePageChangePassword(driver); //resets to original password changePassword.VerifyChangePassword(newPassword, password, password); }
[TestCase("user", "password")] //enters valid username and password public void TestComposeNewYip(string user, string password) { //calls helper method InitLoginPage InitLoginPage(user, password, null, null, null); Thread.Sleep(2000); //creates instance of composenewyip object ComposeNewYip newyip = new ComposeNewYip(driver); //sends 'Desired text' into textarea based the 'Count' mentioned and clicks on yip button newyip.ComposeYip("Wow!", 20, true); Thread.Sleep(2000); //calls verify method-- it checks the yiptext and the remaining count of charlabel newyip.Verify("", 140); Thread.Sleep(2000); //creates instance of NavigationControl object Navigationcontrol navControl = new Navigationcontrol(driver); //verifies navigation links VerifyNavigationControl(navControl); //signs out from homepage navControl.SignOut(); }