This repository has been archived by the owner on Aug 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
ExtendedTest.java
executable file
·56 lines (41 loc) · 2.02 KB
/
ExtendedTest.java
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
package io.testproject.examples.sdk.tests;
import io.testproject.examples.sdk.pages.LoginPage;
import io.testproject.examples.sdk.pages.ProfilePage;
import io.testproject.java.annotations.v2.Parameter;
import io.testproject.java.annotations.v2.Test;
import io.testproject.java.enums.TakeScreenshotConditionType;
import io.testproject.java.sdk.v2.drivers.AndroidDriver;
import io.testproject.java.sdk.v2.enums.ExecutionResult;
import io.testproject.java.sdk.v2.exceptions.FailureException;
import io.testproject.java.sdk.v2.reporters.TestReporter;
import io.testproject.java.sdk.v2.tests.AndroidTest;
import io.testproject.java.sdk.v2.tests.helpers.AndroidTestHelper;
@Test(name = "Extended Test")
public class ExtendedTest implements AndroidTest {
@Parameter(defaultValue = "John Smith")
public String name;
@Parameter(defaultValue = "12345")
public String password;
@Parameter(defaultValue = "Earth")
public String country;
@Parameter(defaultValue = "Address")
public String address;
@Parameter(defaultValue = "someone@somewhere.tld")
public String email;
@Parameter(defaultValue = "+1 555 555 555")
public String phone;
public ExecutionResult execute(AndroidTestHelper helper) throws FailureException {
AndroidDriver driver = helper.getDriver();
TestReporter report = helper.getReporter();
driver.resetApp();
LoginPage loginPage = new LoginPage(driver);
report.step("Launched TestProject Demo app", loginPage.isDisplayed());
loginPage.login(name, password);
ProfilePage profilePage = new ProfilePage(driver);
report.step(String.format("Logged in with %s:%s", name, password), profilePage.isDisplayed());
profilePage.updateProfile(country, address, email, phone);
report.step("Profile information saved", profilePage.isSaved(), TakeScreenshotConditionType.Always);
report.result("Test completed successfully");
return ExecutionResult.PASSED;
}
}