-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
NotificationTests.swift
60 lines (50 loc) · 2.01 KB
/
NotificationTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import UITestsFoundation
import XCTest
private extension String {
static let commentNotificationString = "commented on"
static let followNotificationString = "followed your blog"
static let likeNotificationString = "liked your post"
static let commentText = "Reply to comment from app"
static let comment = "Comment"
static let follow = "Follow"
static let like = "Like"
}
class NotificationTests: XCTestCase {
@MainActor
override func setUp() async throws {
setUpTestSuite()
try await WireMock.setUpScenario(scenario: "comment_flow")
try LoginFlow.login(email: WPUITestCredentials.testWPcomUserEmail)
}
override func tearDownWithError() throws {
takeScreenshotOfFailedTest()
}
func testViewNotification() throws {
try TabNavComponent()
.goToNotificationsScreen()
.openNotification(withSubstring: .commentNotificationString)
.verifyNotification(ofType: .comment)
.openNotification(withSubstring: .followNotificationString)
.verifyNotification(ofType: .follow)
.openNotification(withSubstring: .likeNotificationString)
.verifyNotification(ofType: .like)
}
func testReplyNotification() throws {
try TabNavComponent()
.goToNotificationsScreen()
.openNotification(withSubstring: .commentNotificationString)
.replyToComment(withText: .commentText)
.verifyReplySent()
}
func testLikeNotification() throws {
// Get number of likes before liking the notification
let (updatedNotificationsScreen, initialLikes) = try TabNavComponent()
.goToNotificationsScreen()
.openNotification(withSubstring: .commentNotificationString)
.getNumberOfLikesForNotification()!
// Tapping like and verify that like count increased
updatedNotificationsScreen
.likeComment()
.verifyCommentLiked(expectedLikes: initialLikes + 1)
}
}