forked from webdriverio/appium-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.login.spec.ts
39 lines (34 loc) · 1.62 KB
/
app.login.spec.ts
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
import TabBar from '../screenobjects/components/TabBar';
import LoginScreen from '../screenobjects/LoginScreen';
import NativeAlert from '../screenobjects/components/NativeAlert';
describe('WebdriverIO and Appium, when interacting with a login form,', () => {
beforeEach(async () => {
await TabBar.waitForTabBarShown();
await TabBar.openLogin();
await LoginScreen.waitForIsShown(true);
});
it('should be able login successfully', async () => {
// Always make sure you are on the right tab
await LoginScreen.tapOnLoginContainerButton();
// Submit the data
await LoginScreen.submitLoginForm({ username: '[email protected]', password: 'Test1234!' });
// Wait for the alert and validate it
await NativeAlert.waitForIsShown();
await expect(await NativeAlert.text()).toEqual('Success\nYou are logged in!');
// Close the alert
await NativeAlert.topOnButtonWithText('OK');
await NativeAlert.waitForIsShown(false);
});
it('should be able sign up successfully', async () => {
// Always make sure you are on the right tab
await LoginScreen.tapOnSignUpContainerButton();
// Submit the data
await LoginScreen.submitSignUpForm({ username: '[email protected]', password: 'Test1234!' });
// Wait for the alert and validate it
await NativeAlert.waitForIsShown();
await expect(await NativeAlert.text()).toEqual('Signed Up!\nYou successfully signed up!');
// Close the alert
await NativeAlert.topOnButtonWithText('OK');
await NativeAlert.waitForIsShown(false);
});
});