-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path11.user-notifications.test.js
88 lines (81 loc) · 2.55 KB
/
11.user-notifications.test.js
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
describe(':ios: User Notifications', () => {
it('Init from push notification', async () => {
await device.launchApp({newInstance: true, userNotification: userNotificationPushTrigger});
await expect(element(by.text('From push'))).toBeVisible();
});
xit('Init from calendar notification', async () => {
await device.launchApp({newInstance: true, userNotification: userNotificationCalendarTrigger});
await expect(element(by.text('From calendar'))).toBeVisible();
});
it('Background push notification', async () => {
await device.launchApp({newInstance: true});
await device.sendToHome();
await device.launchApp({newInstance: false, userNotification: userNotificationPushTrigger});
await expect(element(by.text('From push'))).toBeVisible();
});
it('Background calendar notification', async () => {
await device.launchApp({newInstance: true});
await device.sendToHome();
await device.launchApp({newInstance: false, userNotification: userNotificationCalendarTrigger});
await expect(element(by.text('From calendar'))).toBeVisible();
});
it('Foreground push notifications', async () => {
await device.launchApp({newInstance: true});
await device.sendUserNotification(userNotificationCalendarTrigger);
await expect(element(by.text('From calendar'))).toBeVisible();
});
it('Foreground calendar notifications', async () => {
await device.launchApp({newInstance: true});
await device.sendUserNotification(userNotificationCalendarTrigger);
await expect(element(by.text('From calendar'))).toBeVisible();
});
});
const userNotificationPushTrigger = {
"trigger": {
"type": "push"
},
"title": "From push",
"subtitle": "Subtitle",
"body": "Body",
"badge": 1,
"payload": {
"key1": "value1",
"key2": "value2"
},
"category": "com.example.category",
"content-available": 0,
"action-identifier": "default"
};
const userNotificationCalendarTrigger = {
"trigger": {
"type": "calendar",
"date-components": {
"era": 1,
"year": 2017,
"month": 1,
"day": 1,
"hour": 0,
"minute": 0,
"second": 0,
"weekday": 0,
"weekdayOrdinal": 0,
"quarter": 1,
"weekOfMonth": 1,
"weekOfYear": 1,
"leapMonth": false
},
"repeats": true
},
"title": "From calendar",
"subtitle": "Subtitle",
"body": "From calendar",
"badge": 1,
"payload": {
"key1": "value1",
"key2": "value2"
},
"category": "com.example.category",
"user-text": "Hi there!",
"content-available": 0,
"action-identifier": "default"
};