forked from wswebcreation/wswebcreation-react-native-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavigation.spec.js
49 lines (44 loc) · 2.04 KB
/
navigation.spec.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
import { screens } from '../screen-objects/base';
import { selectFirstChat } from '../screen-objects/chats';
import { headerBackButton, selectScreenFromTabBar } from '../screen-objects/navigation';
import { enterURL } from '../screen-objects/webview';
import { SCREENS, TABBAR } from '../support/constants';
describe('Navigate through the app', () => {
beforeEach(async () => {
await device.reloadReactNative();
});
it('should navigate through the app with the tabbar', async () => {
await selectScreenFromTabBar(TABBAR.WEBVIEW);
await expect(screens(SCREENS.WEBVIEW)).toBeVisible();
await selectScreenFromTabBar(TABBAR.CHATS);
await expect(screens(SCREENS.CHATS)).toBeVisible();
await selectScreenFromTabBar(TABBAR.HOME);
await expect(screens(SCREENS.HOME)).toBeVisible();
});
it('should navigate through the app by swiping', async () => {
await screens(SCREENS.HOME).swipe('left');
await expect(screens(SCREENS.WEBVIEW)).toBeVisible();
await screens(SCREENS.WEBVIEW).swipe('left', 'fast', 0.9);
await expect(screens(SCREENS.CHATS)).toBeVisible();
await screens(SCREENS.CHATS).swipe('right');
await expect(screens(SCREENS.WEBVIEW)).toBeVisible();
await screens(SCREENS.WEBVIEW).swipe('right');
await expect(screens(SCREENS.HOME)).toBeVisible();
});
it('should be able to use the back button in the webview header', async () => {
await selectScreenFromTabBar(TABBAR.WEBVIEW);
await expect(screens(SCREENS.WEBVIEW)).toBeVisible();
await enterURL('www.wswebcreation.nl');
await expect(headerBackButton()).toBeVisible();
await headerBackButton().tap();
await expect(screens(SCREENS.WEBVIEW)).toBeVisible();
});
it('should be able to use the back button in the chatbox header', async () => {
await selectScreenFromTabBar(TABBAR.CHATS);
await expect(screens(SCREENS.CHATS)).toBeVisible();
await selectFirstChat();
await expect(screens(SCREENS.CHAT_BOX)).toBeVisible();
await headerBackButton().tap();
await expect(screens(SCREENS.CHATS)).toBeVisible();
});
});