public void TestPageNavigation() { SeleniumExtensions.ExecuteOnMultipleBrowsers(driver => { SignInHelper.SignInWithId(driver, UserConstants.SampleSteamId); Assert.IsFalse(NavigationEnabled(driver.FindElement(By.Id(SiteConstants.FirstPageAnchorId))), "Expected first page button to be disabled"); Assert.IsFalse(NavigationEnabled(driver.FindElement(By.Id(SiteConstants.PreviousPageAnchorId))), "Expected previous page button to be disabled"); var firstPageGames = TableHelper.ParseGameTable(driver); Navigate(driver, SiteConstants.NextPageAnchorId); var secondPageGames = TableHelper.ParseGameTable(driver); CollectionAssert.AssertDistinctSets(firstPageGames, secondPageGames, "Common games found in first and second table pages"); Navigate(driver, SiteConstants.FixedPageAnchorIdPrefix + "4"); var fourthPageGames = TableHelper.ParseGameTable(driver); CollectionAssert.AssertDistinctSets(firstPageGames, fourthPageGames, "Common games found in first and fourth table pages"); CollectionAssert.AssertDistinctSets(secondPageGames, fourthPageGames, "Common games found in second and fourth game pages"); Navigate(driver, SiteConstants.LastPageAnchorId); var lastPageGames = TableHelper.ParseGameTable(driver); CollectionAssert.AssertDistinctSets(firstPageGames, lastPageGames, "Common games found in first and last table pages"); CollectionAssert.AssertDistinctSets(secondPageGames, lastPageGames, "Common games found in second and last table pages"); CollectionAssert.AssertDistinctSets(fourthPageGames, lastPageGames, "Common games found in fourth and last table pages"); Assert.IsFalse(NavigationEnabled(driver.FindElement(By.Id(SiteConstants.NextPageAnchorId))), "Expected last page button to be disabled"); Assert.IsFalse(NavigationEnabled(driver.FindElement(By.Id(SiteConstants.LastPageAnchorId))), "Expected next page button to be disabled"); Navigate(driver, SiteConstants.PreviousPageAnchorId); var secondLastPageGames = TableHelper.ParseGameTable(driver); CollectionAssert.AssertDistinctSets(firstPageGames, secondLastPageGames, "Common games found in first and second last table pages"); CollectionAssert.AssertDistinctSets(secondPageGames, secondLastPageGames, "Common games found in second and second last table pages"); CollectionAssert.AssertDistinctSets(fourthPageGames, secondLastPageGames, "Common games found in fourth and second last table pages"); CollectionAssert.AssertDistinctSets(lastPageGames, secondLastPageGames, "Common games found in last and second last table pages"); Navigate(driver, SiteConstants.FirstPageAnchorId); CollectionAssert.AssertEqualSequences(firstPageGames, TableHelper.ParseGameTable(driver), "Inconsistent games in first table page"); foreach (var gamesPerPage in SiteConstants.GamesPerPageOptions) { new SelectElement(driver.FindElement(By.Id(SiteConstants.GamesPerPageSelectId))).SelectByValue(gamesPerPage.ToString(CultureInfo.InvariantCulture)); Assert.AreEqual(gamesPerPage, GetTablePageCount(driver), "Unexpected page game count"); } }); }