Skip to content

Commit

Permalink
Added TestAddComment
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusLarsen02 committed Nov 28, 2024
1 parent c4f10a0 commit 17304b7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Chirp/test/PlaywrightTests/UITests/CommentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ await Expect(Page.Locator("li").Filter(new() { HasText = "author" }).Locator("sm
await Expect(Page.GetByText("1", new() { Exact = true })).ToHaveTextAsync("1");
}

[Test]
public async Task TestAddComment()
{
await GenerateCheep(_testAuthor.author, "this is author");
await RazorPageUtils.Login(_testAuthor);
await Page.GotoAsync("/");
await Page.Locator("#messagelist div").Filter(new() { HasText = "—" }).GetByRole(AriaRole.Link).First.ClickAsync();
await Page.GetByPlaceholder("Write a comment").ClickAsync();
await Page.GetByPlaceholder("Write a comment").FillAsync("This is a comment");
await Page.GetByRole(AriaRole.Button, new() { Name = "Post" }).ClickAsync();
await Expect(Page.GetByText("This is a comment")).ToBeVisibleAsync();
}

[Test]
public async Task CannotPostCommentsWhenNotLoggedIn()
{
Expand Down

0 comments on commit 17304b7

Please sign in to comment.