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.49 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(() => {
TabBar.waitForTabBarShown();
TabBar.openLogin();
LoginScreen.waitForIsShown(true);
});
it('should be able login successfully', () => {
// Always make sure you are on the right tab
LoginScreen.loginContainerButton.click();
// Submit the data
LoginScreen.submitLoginForm({ username: 'test@webdriver.io', password: 'Test1234!' });
// Wait for the alert and validate it
NativeAlert.waitForIsShown();
expect(NativeAlert.text()).toEqual('Success\nYou are logged in!');
// Close the alert
NativeAlert.pressButton('OK');
NativeAlert.waitForIsShown(false);
});
it('should be able sign up successfully', () => {
// Always make sure you are on the right tab
LoginScreen.signUpContainerButton.click();
// Submit the data
LoginScreen.submitSignUpForm({ username: 'test@webdriver.io', password: 'Test1234!' });
// Wait for the alert and validate it
NativeAlert.waitForIsShown();
expect(NativeAlert.text()).toEqual('Signed Up!\nYou successfully signed up!');
// Close the alert
NativeAlert.pressButton('OK');
NativeAlert.waitForIsShown(false);
});
});