aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/test/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-16 22:05:31 +0300
committerGravatar Vitaly Takmazov2018-04-16 22:05:31 +0300
commit516b3cf0032a6204711dc85cd42d2bf41b84e999 (patch)
tree1e31f5153260979e80d63866e6a0f070e0c32c4e /juick-www/src/test/java
parent90d77f71c53a6349c1fb3bcf81d6f9a2a630b3e6 (diff)
www: fix refreshing notifications counter
Diffstat (limited to 'juick-www/src/test/java')
-rw-r--r--juick-www/src/test/java/com/juick/WebAppTests.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/juick-www/src/test/java/com/juick/WebAppTests.java b/juick-www/src/test/java/com/juick/WebAppTests.java
index 4f9f4cc1..a0ec9737 100644
--- a/juick-www/src/test/java/com/juick/WebAppTests.java
+++ b/juick-www/src/test/java/com/juick/WebAppTests.java
@@ -394,4 +394,23 @@ public class WebAppTests {
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$.webcredentials.apps[0]", is(appId)));
}
+ @Test
+ public void notificationsTests() throws Exception {
+ MvcResult loginResult = mockMvc.perform(post("/login")
+ .param("username", freefdName)
+ .param("password", freefdPassword)).andReturn();
+ Cookie loginCookie = loginResult.getResponse().getCookie("juick-remember-me");
+ webClient.setCookieManager(new CookieManager());
+ webClient.getCookieManager().addCookie(
+ new com.gargoylesoftware.htmlunit.util.Cookie(loginCookie.getDomain(),
+ loginCookie.getName(),
+ loginCookie.getValue()));
+ int mid = messagesService.createMessage(ugnich.getUid(), "new test", null, null);
+ subscriptionService.subscribeMessage(messagesService.getMessage(mid), freefd);
+ int rid = messagesService.createReply(mid, 0, ugnich, "new reply", null);
+ HtmlPage discussionsPage = webClient.getPage("http://localhost:8080/?show=discuss");
+ assertThat(discussionsPage.querySelectorAll("#global a .badge").size(), is(1));
+ HtmlPage unreadThread = webClient.getPage(String.format("http://localhost:8080/ugnich/%d", mid));
+ assertThat(unreadThread.querySelectorAll("#global a .badge").size(), is(0));
+ }
}