diff --git a/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/CodeReviewNotificationTest.java b/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/CodeReviewNotificationTest.java new file mode 100644 index 00000000..c16a14a5 --- /dev/null +++ b/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/CodeReviewNotificationTest.java @@ -0,0 +1,479 @@ +package org.jtalks.tests.jcommune; + +import org.jtalks.tests.jcommune.webdriver.action.Branches; +import org.jtalks.tests.jcommune.webdriver.action.Notifications; +import org.jtalks.tests.jcommune.webdriver.action.Topics; +import org.jtalks.tests.jcommune.webdriver.action.Users; +import org.jtalks.tests.jcommune.webdriver.entity.branch.Branch; +import org.jtalks.tests.jcommune.webdriver.entity.topic.CodeReview; +import org.jtalks.tests.jcommune.webdriver.entity.topic.CodeReviewComment; +import org.jtalks.tests.jcommune.webdriver.entity.user.User; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric; +import static org.jtalks.tests.jcommune.webdriver.JCommuneSeleniumConfig.driver; +import static org.jtalks.tests.jcommune.webdriver.page.Pages.mainPage; + +/** + * @author Dmitry Yakushev + */ +public class CodeReviewNotificationTest { + + public final String NOTIFICATION_BRANCH = "Notification tests"; + public final String BRANCH_NAME_TO_MOVE_TOPIC_IN = "Notification tests branch 2"; + + @BeforeMethod(alwaysRun = true) + @Parameters({"appUrl"}) + public void setupCase(String appUrl) { + driver.get(appUrl); + mainPage.logOutIfLoggedIn(driver); + } + + @Test + public void autosubscribe_codeReviewStarterAutomaticallySubscribes() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + + Topics.assertIsSubscribed(codeReview); + } + + @Test + public void autosubscribe_codeReviewCommentatorAutomaticallySubscribes() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + Users.logout(); + + User codeReviewCommentator = Users.signUpAndSignIn(); + Topics.leaveCodeReviewComment(codeReview, new CodeReviewComment()); + + Topics.assertIsSubscribed(codeReview); + } + + @Test + public void createCodeReview_UserSubscribedToBranchReceivesBranchNotificationOnly() throws Exception{ + CodeReview codeReview = new CodeReview().withBranch(NOTIFICATION_BRANCH); + + User branchSubscriber = Users.signUpAndSignIn(); + Branches.subscribe(codeReview.getBranch()); + Users.logout(); + + User codeReviewStarter = Users.signUpAndSignIn(); + Topics.createCodeReview(codeReview); + Users.logout(); + + Users.signIn(branchSubscriber); + Branches.unsubscribeIgnoringFail(codeReview.getBranch()); + + Notifications.assertNotificationsOnTopicNotSent(codeReview, branchSubscriber); + Notifications.assertNotificationOnBranchSent(codeReview.getBranch(), branchSubscriber); + + } + + @Test + public void createCodeReview_UserNotSubscribedToBranchDoNotReciveNotifications() throws Exception{ + CodeReview codeReview = new CodeReview().withBranch(NOTIFICATION_BRANCH); + + User branchSubscriber = Users.signUpAndSignIn(); + Users.logout(); + + User codeReviewStarter = Users.signUpAndSignIn(); + Topics.createCodeReview(codeReview); + Users.logout(); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), branchSubscriber); + Notifications.assertNotificationsOnTopicNotSent(codeReview, branchSubscriber); + } + + @Test + public void createCodeReview_UserSubscribedToBranchDoNotReciveNotificationsIfCreatedCodeReviewHimself() throws Exception{ + CodeReview codeReview = new CodeReview().withBranch(NOTIFICATION_BRANCH); + + User branchSubscriber = Users.signUpAndSignIn(); + Branches.subscribe(codeReview.getBranch()); + Topics.createCodeReview(codeReview); + Branches.unsubscribeIgnoringFail(codeReview.getBranch()); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), branchSubscriber); + Notifications.assertNotificationsOnTopicNotSent(codeReview, branchSubscriber); + } + + @Test + public void addCommentToCodeReview_UserSubscribedToCodeReviewOnlyReceivesCodeReviewNotificationOnly() throws Exception { + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Users.logout(); + + User topicCommentator = Users.signUpAndSignIn(); + Topics.leaveCodeReviewComment(codeReview, new CodeReviewComment()); + + Notifications.assertNotificationOnTopicSent(codeReview, codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + } + + @Test + public void addCommentToCodeReview_UserSubscribedToBranchOnlyDoNotReceiveNotifications() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + Topics.unsubscribe(codeReview); + Branches.subscribe(codeReview.getBranch()); + Users.logout(); + + User topicCommentator = Users.signUpAndSignIn(); + Topics.leaveCodeReviewComment(codeReview, new CodeReviewComment()); + Users.logout(); + + Users.signIn(codeReviewStarter); + Branches.unsubscribeIgnoringFail(codeReview.getBranch()); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + + } + + @Test + public void addCommentToCodeReview_UserSubscribedBothToBranchAndCodReviewReceivesCodeReviewNotificationOnly() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Branches.subscribe(codeReview.getBranch()); + Users.logout(); + + User topicCommentator = Users.signUpAndSignIn(); + Topics.leaveCodeReviewComment(codeReview, new CodeReviewComment()); + Users.logout(); + + Users.signIn(codeReviewStarter); + Branches.unsubscribeIgnoringFail(codeReview.getBranch()); + + Notifications.assertNotificationOnTopicSent(codeReview, codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + } + + @Test + public void addCommentToCodeReview_UserSubscribedToCodeReviewDoNotReceiveNotificationsAboutHisOwnComments() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Topics.leaveCodeReviewComment(codeReview, new CodeReviewComment()); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + } + + @Test + public void addCommentToCodeReview_UnsubscribedUserDoNotReceiveNotifications() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + Topics.unsubscribe(codeReview); + Users.logout(); + + User topicCommentator = Users.signUpAndSignIn(); + Topics.leaveCodeReviewComment(codeReview, new CodeReviewComment()); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + } + + @Test + public void deleteCodeReview_UserSubscribedToCodeReviewOnlyReceivesCodeReviewNotificationOnly() throws Exception { + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Users.logout(); + + User codeReviewDeleter = Users.signUpAndSignIn(); + Topics.deleteTopic(codeReview); + + Notifications.assertNotificationOnTopicSent(codeReview, codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + } + + @Test + public void deleteCodeReview_UserSubscribedToBranchOnlyReceivesBranchNotificationOnly() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + Topics.unsubscribe(codeReview); + Branches.subscribe(codeReview.getBranch()); + Users.logout(); + + User codeReviewDeleter = Users.signUpAndSignIn(); + Topics.deleteTopic(codeReview); + Users.logout(); + + Users.signIn(codeReviewStarter); + Branches.unsubscribeIgnoringFail(codeReview.getBranch()); + + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + Notifications.assertNotificationOnBranchSent(codeReview.getBranch(), codeReviewStarter); + } + + @Test + public void deleteCodeReview_UserSubscribedBothToBranchAndCodeReviewReceivesCodeReviewNotificationOnly() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Branches.subscribe(codeReview.getBranch()); + Users.logout(); + + User codeReviewDeleter = Users.signUpAndSignIn(); + Topics.deleteTopic(codeReview); + + Users.signIn(codeReviewStarter); + Branches.unsubscribeIgnoringFail(codeReview.getBranch()); + + Notifications.assertNotificationOnTopicSent(codeReview, codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + + } + + @Test + public void deleteCodeReview_UserSubscribedToCodeReviewDoNotReceiveNotificationIfHeHimselfDeletedCodeReview() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Topics.deleteTopic(codeReview); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + } + + @Test + public void deleteCodeReview_UserSubscribedToBranchDoNotReceiveNotificationIfHeHimselfDeletedCodeReview() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + Branches.subscribe(codeReview.getBranch()); + Topics.unsubscribe(codeReview); + Topics.deleteTopic(codeReview); + Branches.unsubscribeIgnoringFail(codeReview.getBranch()); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + } + + @Test + public void deleteCodeReview_UnsubscribedUserDoNotReceiveNotifications() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + Topics.unsubscribe(codeReview); + Users.logout(); + + User codeReviewDeleter = Users.signUpAndSignIn(); + Topics.deleteTopic(codeReview); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + } + + @Test + public void moveCodeReview_UserSubscribedToCodeReviewOnlyReceivesCodeReviewNotificationOnly() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Branch oldBranch = codeReview.getBranch(); + Users.logout(); + + User codeReviewMover = Users.signUpAndSignIn(); + Topics.moveTopic(codeReview, BRANCH_NAME_TO_MOVE_TOPIC_IN); + + Notifications.assertNotificationOnTopicSent(codeReview, codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(oldBranch, codeReviewStarter); + } + + @Test + public void moveCodeReview_UserSubscribedToBranchOnlyDoNotReceiveNotification() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + Topics.unsubscribe(codeReview); + Branches.subscribe(codeReview.getBranch()); + Branch oldBranch = codeReview.getBranch(); + Users.logout(); + + User codeReviewMover = Users.signUpAndSignIn(); + Topics.moveTopic(codeReview, BRANCH_NAME_TO_MOVE_TOPIC_IN); + Users.logout(); + + Users.signIn(codeReviewStarter); + Branches.unsubscribeIgnoringFail(oldBranch); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(oldBranch, codeReviewStarter); + } + + @Test + public void moveCodeReview_UserSubscribedBothToBranchAndCodeReviewReceivesCodeReviewNotificationOnly() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Branches.subscribe(codeReview.getBranch()); + Branch oldBranch = codeReview.getBranch(); + Users.logout(); + + User codeReviewMover = Users.signUpAndSignIn(); + Topics.moveTopic(codeReview, BRANCH_NAME_TO_MOVE_TOPIC_IN); + Users.logout(); + + Users.signIn(codeReviewStarter); + Branches.unsubscribeIgnoringFail(oldBranch); + + Notifications.assertNotificationOnTopicSent(codeReview, codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(oldBranch, codeReviewStarter); + } + + @Test + public void moveCodeReview_UserSubscribedToCodeReviewDoNotReceiveNotificationIfHeHimselfMovedCodeReview() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Branch oldBranch = codeReview.getBranch(); + Topics.moveTopic(codeReview, BRANCH_NAME_TO_MOVE_TOPIC_IN); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(oldBranch, codeReviewStarter); + } + + @Test + public void moveCodeReview_UnsubscribedUserDoNotReceiveNotifications() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + Branch oldBranch = codeReview.getBranch(); + Topics.unsubscribe(codeReview); + Users.logout(); + + User codeReviewMover = Users.signUpAndSignIn(); + Topics.moveTopic(codeReview, BRANCH_NAME_TO_MOVE_TOPIC_IN); + Branches.unsubscribeIgnoringFail(codeReview.getBranch()); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(oldBranch, codeReviewStarter); + } + + @Test + public void editCodeReviewComment_UserSubscribedToCodeReviewOnlyDoNotReciveNotification() throws Exception { + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Users.logout(); + + User codeReviewCommentEditor = Users.signUpAndSignIn(); + Topics.leaveCodeReviewComment(codeReview); + CodeReviewComment codeReviewComment = codeReview.getComments().get(0); + // two lines above should be replaced by following: + // CodeReviewComment codeReviewComment = Topics.leaveCodeReviewComment(codeReview); + Topics.editCodeReviewComment(codeReview, codeReviewComment); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + } + + @Test + public void editCodeReviewComment_UserSubscribedToBranchOnlyDoNotReciveNotification() throws Exception { + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + Topics.unsubscribe(codeReview); + Branches.subscribe(codeReview.getBranch()); + Users.logout(); + + User codeReviewCommentEditor = Users.signUpAndSignIn(); + Topics.leaveCodeReviewComment(codeReview); + CodeReviewComment codeReviewComment = codeReview.getComments().get(0); + // two lines above should be replaced by following: + // CodeReviewComment codeReviewComment = Topics.leaveCodeReviewComment(codeReview); + Topics.editCodeReviewComment(codeReview, codeReviewComment); + Users.logout(); + + Users.signIn(codeReviewStarter); + Branches.unsubscribeIgnoringFail(codeReview.getBranch()); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + } + + @Test + public void deleteCodeReviewComment_UserSubscribedToCodeReviewOnlyReceivesCodeReviewNotificationOnly() throws Exception { + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Users.logout(); + + User codeReviewCommentDeleter = Users.signUpAndSignIn(); + Topics.leaveCodeReviewComment(codeReview); + CodeReviewComment codeReviewComment = codeReview.getComments().get(0); + // two lines above should be replaced by following: + // CodeReviewComment codeReviewComment = Topics.leaveCodeReviewComment(codeReview); + Topics.deleteCodeReviewComment(codeReview, codeReviewComment); + + Notifications.assertNotificationOnTopicSent(codeReview, codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + } + + @Test + public void deleteCodeReviewComment_UserSubscribedToBranchOnlyDoNotReceiveNotifications() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + Topics.unsubscribe(codeReview); + Branches.subscribe(codeReview.getBranch()); + Users.logout(); + + User codeReviewCommentDeleter = Users.signUpAndSignIn(); + Topics.leaveCodeReviewComment(codeReview); + CodeReviewComment codeReviewComment = codeReview.getComments().get(0); + // two lines above should be replaced by following: + // CodeReviewComment codeReviewComment = Topics.leaveCodeReviewComment(codeReview); + Topics.deleteCodeReviewComment(codeReview, codeReviewComment); + Users.logout(); + + Users.signIn(codeReviewStarter); + Branches.unsubscribeIgnoringFail(codeReview.getBranch()); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + } + + @Test + public void deleteCodeReviewComment_UserSubscribedBothToBranchAndCodeReviewReceivesCodeReviewNotificationOnly() throws Exception{ + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Branches.subscribe(codeReview.getBranch()); + Users.logout(); + + User codeReviewCommentDeleter = Users.signUpAndSignIn(); + Topics.leaveCodeReviewComment(codeReview); + CodeReviewComment codeReviewComment = codeReview.getComments().get(0); + // two lines above should be replaced by following: + // CodeReviewComment codeReviewComment = Topics.leaveCodeReviewComment(codeReview); + Topics.deleteCodeReviewComment(codeReview, codeReviewComment); + Users.logout(); + + Users.signIn(codeReviewStarter); + Branches.unsubscribeIgnoringFail(codeReview.getBranch()); + + Notifications.assertNotificationOnTopicSent(codeReview, codeReviewStarter); + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + } + + @Test + public void deleteCodeReviewComment_UserSubscribedToCodeReviewOnlyDoNotReceiveNotificationsIfHimselfDeletesComment() throws Exception { + User codeReviewStarter = Users.signUpAndSignIn(); + CodeReview codeReview = Topics.createCodeReview(new CodeReview().withBranch(NOTIFICATION_BRANCH)); + //We do not subscribe codeReviewStarter to topic explicitly, because he is automatically subscribed + Topics.leaveCodeReviewComment(codeReview); + CodeReviewComment codeReviewComment = codeReview.getComments().get(0); + // two lines above should be replaced by following: + // CodeReviewComment codeReviewComment = Topics.leaveCodeReviewComment(codeReview); + Topics.deleteCodeReviewComment(codeReview, codeReviewComment); + + Notifications.assertNotificationsOnBranchNotSent(codeReview.getBranch(), codeReviewStarter); + Notifications.assertNotificationsOnTopicNotSent(codeReview, codeReviewStarter); + } + +} \ No newline at end of file diff --git a/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/TopicNotificationTest.java b/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/TopicNotificationTest.java index c744e255..a62db822 100644 --- a/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/TopicNotificationTest.java +++ b/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/TopicNotificationTest.java @@ -66,7 +66,7 @@ public void editingTopic_shouldNotReceiveTopicAndBranchNotification() throws Exc Users.signIn(subscribedUser); Branches.unsubscribeIgnoringFail(topic.getBranch()); Notifications.assertNotificationsOnTopicNotSent(topic, subscribedUser);//need to be implemented - Notifications.assertNotificationsOnBranchNotSent(topic, subscribedUser);//need to be implemented + Notifications.assertNotificationsOnBranchNotSent(topic.getBranch(), subscribedUser);//need to be implemented } @Test @@ -85,7 +85,7 @@ public void editingTopic_ifSubscribedToBranchOnly_shouldNotReceiveBranchNotifica Users.signIn(subscribedUser); Branches.unsubscribeIgnoringFail(topic.getBranch()); Notifications.assertNotificationsOnTopicNotSent(topic, subscribedUser);//need to be implemented - Notifications.assertNotificationsOnBranchNotSent(topic, subscribedUser);//need to be implemented + Notifications.assertNotificationsOnBranchNotSent(topic.getBranch(), subscribedUser);//need to be implemented } @Test @@ -103,7 +103,7 @@ public void editingTopic_ifSubscribedToTopicOnly_shouldNotReceiveTopicNotificati Users.signIn(subscribedUser); Notifications.assertNotificationsOnTopicNotSent(topic, subscribedUser);//need to be implemented - Notifications.assertNotificationsOnBranchNotSent(topic, subscribedUser);//need to be implemented + Notifications.assertNotificationsOnBranchNotSent(topic.getBranch(), subscribedUser);//need to be implemented } @@ -169,7 +169,7 @@ public void userPostsInOwnTopic_ifSubscribedToBranchOnly_shouldNotReceiveBranchN Branches.subscribe(topic.getBranch()); Topics.postAnswer(topic, topic.getBranch().getTitle()); Branches.unsubscribeIgnoringFail(topic.getBranch()); - Notifications.assertNotificationsOnBranchNotSent(topic, user);//need to be implemented + Notifications.assertNotificationsOnBranchNotSent(topic.getBranch(), user);//need to be implemented } diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Notifications.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Notifications.java index bf5ded5c..6bbff93d 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Notifications.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Notifications.java @@ -4,9 +4,19 @@ import org.jtalks.tests.jcommune.webdriver.entity.topic.Topic; import org.jtalks.tests.jcommune.webdriver.entity.user.User; +import javax.jws.soap.SOAPBinding; + public class Notifications { - public static void assertNotificationsOnBranchNotSent(Topic topic, User user) { + public static void assertNotificationOnBranchSent(Branch branch, User user){ + throw new UnsupportedOperationException("To be implemented"); + } + + public static void assertNotificationsOnBranchNotSent(Branch branch, User user) { + throw new UnsupportedOperationException(); + } + + public static void assertNotificationOnTopicSent(Topic topic, User user){ throw new UnsupportedOperationException(); } @@ -21,4 +31,13 @@ public static void assertNotificationOnTopicSentBranchNotSent(Topic topic, User public static void assertNotificationOnTopicNotSentBranchSent(Topic topic, User user) { throw new UnsupportedOperationException(); } + + public static void assertNotificationsNotSent(Topic topic, User user){ + throw new UnsupportedOperationException("To be implemented"); + } + + + + + } diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Topics.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Topics.java index 4fc65521..b625256b 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Topics.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Topics.java @@ -307,7 +307,7 @@ public static CodeReview createCodeReview(CodeReview codeReview) return codeReview; } - public static void leaveCodeReviewComment(CodeReviewComment codeReviewComment) + public static void leaveCodeReviewComment(CodeReview codeReview, CodeReviewComment codeReviewComment) throws PermissionsDeniedException, ValidationException { topicPage.clickLineInCodeReviewForComment(codeReviewComment.getCommentedLineNumber()); topicPage.fillCodeReviewCommentBody(codeReviewComment); @@ -315,4 +315,24 @@ public static void leaveCodeReviewComment(CodeReviewComment codeReviewComment) assertCodeReviewFormValid(); } + public static void assertIsSubscribed(Topic topic){ + throw new UnsupportedOperationException("To be implemented"); + } + + public static void editCodeReviewComment(CodeReview codeReview, CodeReviewComment codeReviewComment){ + throw new UnsupportedOperationException("To be implemented"); + } + + public static void leaveCodeReviewComment(CodeReview codeReview){ + throw new UnsupportedOperationException("To be implemented"); + } + + //overloaded method below was added to avoid compilation errors + public static void leaveCodeReviewComment(CodeReviewComment codeReviewComment){ + throw new UnsupportedOperationException("To be implemented"); + } + + public static void deleteCodeReviewComment(CodeReview codeReview, CodeReviewComment codeReviewComment){ + throw new UnsupportedOperationException("To be implemented"); + } } diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/entity/topic/CodeReview.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/entity/topic/CodeReview.java index 713ddf3a..99b73737 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/entity/topic/CodeReview.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/entity/topic/CodeReview.java @@ -52,6 +52,10 @@ public CodeReview withTitle(String title){ return this; } + public CodeReview withBranch(String branchName) { + throw new UnsupportedOperationException("To be implemented"); + } + public String getContent() { return content; }