public async Task Should_Return_Access_Denied_When_Try_To_Update_Movie() { // Arrange int filmId = MoviesCatalog.GetMovies().First().Id; // Act Browser.Navigate().GoToUrl($"{Server.RootUri}/movies/edit/{filmId}"); // Assert Assert.Contains("Identity/Account/AccessDenied", Browser.Url); }
public Movies_Page_With_Signed_In_User(CustomWebApplicationFactory <Startup> _factory) { factory = _factory; client = factory .WithMoviesInDatabase(MoviesCatalog.GetMovies()) .WithUserLoggedIn( new MockIdentityBuilder() .WithName("Test User") .Identity) .CreateClient(); }
public async Task Should_Return_Access_Denied_When_Try_To_Visit_Delete_Movie_Page() { // Arrange int filmId = MoviesCatalog.GetMovies().First().Id; // Act var response = await client.GetAsync($"movies/delete/{filmId}"); response.EnsureSuccessStatusCode(); // Assert Assert.Contains("Identity/Account/AccessDenied", response.RequestMessage.RequestUri.LocalPath); }
public void Should_Display_Movies_List_In_Movies_Page() { // Arrange var movies = MoviesCatalog.GetMovies(); // Act Browser.Navigate().GoToUrl($"{Server.RootUri}/movies/Index"); var indexMoviePage = new IndexMoviePage(Browser); var movieTitlesRendered = indexMoviePage.MoviesRendered.Select(m => m.Title); // Assert foreach (var movie in movies) { Assert.Contains(movie.Title.Trim(), movieTitlesRendered); } }
public UI_Movies_With_Administrator_User(SeleniumServerFactory <Startup> server) { Server = server; Client = Server .WithMoviesInDatabase(MoviesCatalog.GetMovies()) .WithUserLoggedIn( new MockIdentityBuilder() .WithRole("Administrator") .Identity) .CreateClient(); var opts = new ChromeOptions(); opts.AddArgument("--headless"); opts.SetLoggingPreference(OpenQA.Selenium.LogType.Browser, LogLevel.All); var driver = new RemoteWebDriver(opts); Browser = driver; }
public void Should_Filter_Movies_By_Title() { // Arrange var movies = MoviesCatalog.GetMovies(); var firstTitle = movies.First().Title; int justOneFilm = 1; Browser.Navigate().GoToUrl($"{Server.RootUri}/movies/Index"); var indexMoviePage = new IndexMoviePage(Browser); indexMoviePage.FilterTitle = firstTitle; // Act indexMoviePage.SendSearchRequest(); indexMoviePage = new IndexMoviePage(Browser); var elements = indexMoviePage.MoviesRendered; // Assert Assert.Equal(justOneFilm, elements.Count); }
public void Should_Filter_Movies_By_Genre() { // Arrange var movies = MoviesCatalog.GetMovies(); var firstGenre = movies.First().Genre; int expected = 1; Browser.Navigate().GoToUrl($"{Server.RootUri}/movies/Index"); var indexMoviePage = new IndexMoviePage(Browser); indexMoviePage.SelectGenre(firstGenre); // Act indexMoviePage.SendSearchRequest(); indexMoviePage = new IndexMoviePage(Browser); var genresdisplayed = indexMoviePage.MoviesRendered.Select(m => m.Title); // Assert Assert.Equal(expected, genresdisplayed.Count()); }