digital-ai-testing-mcp 2.1.1 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -13
- package/dist/api/webdriver.d.ts +61 -3
- package/dist/api/webdriver.d.ts.map +1 -1
- package/dist/api/webdriver.js +673 -33
- package/dist/api/webdriver.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/boilerplate-tools.d.ts +1 -1
- package/dist/tools/boilerplate-tools.d.ts.map +1 -1
- package/dist/tools/boilerplate-tools.js +217 -78
- package/dist/tools/boilerplate-tools.js.map +1 -1
- package/dist/tools/device-tools.d.ts +11 -0
- package/dist/tools/device-tools.d.ts.map +1 -1
- package/dist/tools/device-tools.js +25 -2
- package/dist/tools/device-tools.js.map +1 -1
- package/dist/tools/inspection-tools.d.ts.map +1 -1
- package/dist/tools/inspection-tools.js +219 -23
- package/dist/tools/inspection-tools.js.map +1 -1
- package/dist/tools/meta-tools.d.ts +1 -1
- package/dist/tools/meta-tools.d.ts.map +1 -1
- package/dist/tools/meta-tools.js +12 -1
- package/dist/tools/meta-tools.js.map +1 -1
- package/dist/tools/performance-tools.d.ts.map +1 -1
- package/dist/tools/performance-tools.js +6 -1
- package/dist/tools/performance-tools.js.map +1 -1
- package/dist/tools/reporting-tools.d.ts.map +1 -1
- package/dist/tools/reporting-tools.js +19 -1
- package/dist/tools/reporting-tools.js.map +1 -1
- package/dist/types/digital-ai.d.ts +10 -0
- package/dist/types/digital-ai.d.ts.map +1 -1
- package/dist/utils/test-orchestrator.d.ts +2 -0
- package/dist/utils/test-orchestrator.d.ts.map +1 -1
- package/dist/utils/test-orchestrator.js +2 -0
- package/dist/utils/test-orchestrator.js.map +1 -1
- package/package.json +3 -1
- package/resources/boilerplate/Android-Native/Java JUnit5/AndroidNative-oss-po.java +50 -0
- package/resources/boilerplate/Android-Native/Java JUnit5/AndroidNative-oss.java +23 -13
- package/resources/boilerplate/Android-Native/Java JUnit5/AndroidNative.java +19 -10
- package/resources/boilerplate/Android-Native/Java JUnit5/gradle-oss +4 -1
- package/resources/boilerplate/Android-Native/Java JUnit5/maven-oss +7 -1
- package/resources/boilerplate/Android-Native/NodeJS (WebDriver)/AndroidNative-po.js +13 -0
- package/resources/boilerplate/Android-Native/NodeJS (WebDriver)/AndroidNative.js +17 -11
- package/resources/boilerplate/Android-Native/NodeJS (WebDriver)/wdio-oss.conf.js +7 -2
- package/resources/boilerplate/Android-Native/NodeJS (WebDriver)/wdio.conf.js +10 -4
- package/resources/boilerplate/Android-Native/Python/AndroidNative-oss.py +30 -14
- package/resources/boilerplate/Android-Native/Python/AndroidNative.py +21 -5
- package/resources/boilerplate/Android-Native/Robot Framework/AndroidNative-oss.robot +28 -11
- package/resources/boilerplate/Android-Native/java TestNG/AndroidNative-oss-po.java +50 -0
- package/resources/boilerplate/Android-Native/java TestNG/AndroidNative-oss.java +23 -13
- package/resources/boilerplate/Android-Native/java TestNG/AndroidNative.java +19 -10
- package/resources/boilerplate/Android-Native/java TestNG/gradle-oss +4 -1
- package/resources/boilerplate/Android-Native/java TestNG/maven-oss +7 -1
- package/resources/boilerplate/iOS-Native/NodeJS (WebDriver)/iOSNative-po.js +13 -0
- package/resources/boilerplate/iOS-Native/NodeJS (WebDriver)/iOSNative.js +17 -11
- package/resources/boilerplate/iOS-Native/NodeJS (WebDriver)/wdio-oss.conf.js +4 -1
- package/resources/boilerplate/iOS-Native/NodeJS (WebDriver)/wdio.conf.js +2 -0
- package/resources/boilerplate/iOS-Native/Python/iOSNative-oss.py +31 -14
- package/resources/boilerplate/iOS-Native/Python/iOSNative.py +36 -15
- package/resources/boilerplate/iOS-Native/Robot Framework/iOSNative-oss.robot +28 -11
- package/resources/boilerplate/iOS-Native/java-JUnit5/gradle-oss +4 -1
- package/resources/boilerplate/iOS-Native/java-JUnit5/iOSNative-oss-po.java +47 -0
- package/resources/boilerplate/iOS-Native/java-JUnit5/iOSNative-oss.java +24 -13
- package/resources/boilerplate/iOS-Native/java-JUnit5/iOSNative.java +21 -11
- package/resources/boilerplate/iOS-Native/java-JUnit5/maven-oss +7 -1
- package/resources/boilerplate/iOS-Native/java-TestNG/gradle-oss +4 -1
- package/resources/boilerplate/iOS-Native/java-TestNG/iOSNative-oss-po.java +47 -0
- package/resources/boilerplate/iOS-Native/java-TestNG/iOSNative-oss.java +24 -13
- package/resources/boilerplate/iOS-Native/java-TestNG/iOSNative.java +21 -11
- package/resources/boilerplate/iOS-Native/java-TestNG/maven-oss +7 -1
- package/resources/boilerplate/shared/java-screens/AppScreen.java +29 -0
- package/resources/boilerplate/shared/java-screens/BaseScreen.java +42 -0
- package/resources/boilerplate/shared/java-screens/DashboardScreen.java +18 -0
- package/resources/boilerplate/shared/java-screens/LoginScreen.java +23 -0
- package/resources/boilerplate/shared/java-screens/PaymentScreen.java +34 -0
- package/resources/boilerplate/shared/node-screens/AppScreen.js +27 -0
- package/resources/boilerplate/shared/node-screens/DashboardScreen.js +13 -0
- package/resources/boilerplate/shared/node-screens/LoginScreen.js +18 -0
- package/resources/boilerplate/shared/node-screens/PaymentScreen.js +28 -0
- package/resources/boilerplate/shared/node-screens/PlaceholderScreen.js +21 -0
|
@@ -6,6 +6,8 @@ exports.config = {
|
|
|
6
6
|
path: '/wd/hub',
|
|
7
7
|
specs: ['./test/specs/iOSNative.js'],
|
|
8
8
|
exclude: [],
|
|
9
|
+
// Parallel runs: each spec file gets its own device session — raise this to the number of workers you want
|
|
10
|
+
// (check the project's maxDevelopmentLicense and free matching devices first) and split tests across spec files.
|
|
9
11
|
maxInstances: 1,
|
|
10
12
|
capabilities: [{
|
|
11
13
|
platformName: 'iOS',
|
|
@@ -17,7 +19,8 @@ exports.config = {
|
|
|
17
19
|
}],
|
|
18
20
|
logLevel: 'info',
|
|
19
21
|
bail: 0,
|
|
20
|
-
|
|
22
|
+
// Native apps on a device farm need longer than the wdio default: the first $() races app install + launch.
|
|
23
|
+
waitforTimeout: 45000,
|
|
21
24
|
connectionRetryTimeout: 120000,
|
|
22
25
|
connectionRetryCount: 3,
|
|
23
26
|
framework: 'mocha',
|
|
@@ -8,6 +8,8 @@ exports.config = {
|
|
|
8
8
|
path: '/wd/hub',
|
|
9
9
|
specs: ['./test/specs/iOSNative.js'],
|
|
10
10
|
exclude: [],
|
|
11
|
+
// Parallel runs: each spec file gets its own device session — raise this to the number of workers you want
|
|
12
|
+
// (check the project's maxDevelopmentLicense and free matching devices first) and split tests across spec files.
|
|
11
13
|
maxInstances: 1,
|
|
12
14
|
capabilities: [{
|
|
13
15
|
platformName: 'IOS',
|
|
@@ -2,6 +2,9 @@ import unittest
|
|
|
2
2
|
from appium import webdriver
|
|
3
3
|
from appium.options.common.base import AppiumOptions
|
|
4
4
|
from selenium.webdriver.common.by import By
|
|
5
|
+
from appium.webdriver.common.appiumby import AppiumBy
|
|
6
|
+
from selenium.webdriver.support.ui import WebDriverWait
|
|
7
|
+
from selenium.webdriver.support import expected_conditions as EC
|
|
5
8
|
|
|
6
9
|
|
|
7
10
|
class LocalIosTest(unittest.TestCase):
|
|
@@ -18,26 +21,40 @@ class LocalIosTest(unittest.TestCase):
|
|
|
18
21
|
options.set_capability('platformName', 'ios')
|
|
19
22
|
options.set_capability('digitalai:deviceQuery', "@os='ios' and @category='[Enter PHONE/TABLET here]'")
|
|
20
23
|
self.driver = webdriver.Remote("[Enter Instance here]/wd/hub", options=options)
|
|
21
|
-
|
|
24
|
+
|
|
25
|
+
def find(self, by, locator, timeout=20):
|
|
26
|
+
# Explicit wait: polls until the element is visible, then returns it. Used instead of an implicit wait — never
|
|
27
|
+
# mix the two (every miss then waits implicit + explicit, and the real timeout becomes unpredictable).
|
|
28
|
+
return WebDriverWait(self.driver, timeout).until(EC.visibility_of_element_located((by, locator)))
|
|
22
29
|
|
|
23
30
|
def testQuickStartIosNativeDemo(self):
|
|
24
31
|
# [BEGIN_DEMO_STEPS]
|
|
25
|
-
self.
|
|
26
|
-
self.
|
|
27
|
-
self.
|
|
28
|
-
self.
|
|
29
|
-
self.
|
|
30
|
-
self.
|
|
31
|
-
self.
|
|
32
|
-
self.
|
|
33
|
-
self.
|
|
34
|
-
self.
|
|
35
|
-
self.
|
|
32
|
+
self.find(AppiumBy.ACCESSIBILITY_ID, 'usernameTextField').send_keys('company')
|
|
33
|
+
self.find(AppiumBy.ACCESSIBILITY_ID, 'passwordTextField').send_keys('company')
|
|
34
|
+
self.find(AppiumBy.ACCESSIBILITY_ID, 'loginButton').click()
|
|
35
|
+
self.find(AppiumBy.ACCESSIBILITY_ID, 'makePaymentButton').click()
|
|
36
|
+
self.find(AppiumBy.ACCESSIBILITY_ID, 'phoneTextField').send_keys('1234567')
|
|
37
|
+
self.find(AppiumBy.ACCESSIBILITY_ID, 'nameTextField').send_keys('Jon Snow')
|
|
38
|
+
self.find(AppiumBy.ACCESSIBILITY_ID, 'amountTextField').send_keys('50')
|
|
39
|
+
self.find(AppiumBy.ACCESSIBILITY_ID, 'countryButton').click()
|
|
40
|
+
self.find(AppiumBy.ACCESSIBILITY_ID, 'Switzerland').click()
|
|
41
|
+
self.find(AppiumBy.ACCESSIBILITY_ID, 'sendPaymentButton').click()
|
|
42
|
+
self.find(AppiumBy.ACCESSIBILITY_ID, 'Yes').click()
|
|
36
43
|
# [END_DEMO_STEPS]
|
|
37
44
|
|
|
38
45
|
def tearDown(self):
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
# Guarded: when setUp fails the driver is None (or the session is already dead) and an unguarded quit() would
|
|
47
|
+
# replace the real error with its own. quit() always runs so a half-created session releases its device.
|
|
48
|
+
if self.driver is None:
|
|
49
|
+
return
|
|
50
|
+
try:
|
|
51
|
+
print('Report URL: ' + str(self.driver.capabilities.get('digitalai:reportUrl', 'n/a')))
|
|
52
|
+
except Exception:
|
|
53
|
+
pass
|
|
54
|
+
try:
|
|
55
|
+
self.driver.quit()
|
|
56
|
+
finally:
|
|
57
|
+
self.driver = None
|
|
41
58
|
|
|
42
59
|
|
|
43
60
|
if __name__ == '__main__':
|
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
import unittest
|
|
8
8
|
from appium import webdriver
|
|
9
9
|
from selenium.webdriver.common.by import By
|
|
10
|
+
from appium.webdriver.common.appiumby import AppiumBy
|
|
10
11
|
from appium.webdriver.webelement import WebElement
|
|
12
|
+
from selenium.webdriver.support.ui import WebDriverWait
|
|
13
|
+
from selenium.webdriver.support import expected_conditions as EC
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
class LocalIosTest(unittest.TestCase):
|
|
@@ -25,7 +28,6 @@ class LocalIosTest(unittest.TestCase):
|
|
|
25
28
|
'digitalai:deviceQuery': "@os='ios' and @category='[Enter PHONE/TABLET here]'",
|
|
26
29
|
}
|
|
27
30
|
self.driver = webdriver.Remote("[Enter Instance here]/wd/hub", desired_capabilities=desired_caps)
|
|
28
|
-
self.driver.implicitly_wait(10)
|
|
29
31
|
|
|
30
32
|
def _elem(self, raw):
|
|
31
33
|
# JWP sessions return element dicts rather than WebElement objects.
|
|
@@ -35,27 +37,46 @@ class LocalIosTest(unittest.TestCase):
|
|
|
35
37
|
return WebElement(self.driver, eid)
|
|
36
38
|
return raw
|
|
37
39
|
|
|
40
|
+
def _wait(self, by, locator, timeout=20):
|
|
41
|
+
# Explicit wait (presence, not visibility: a JWP session returns a raw dict that has no is_displayed()).
|
|
42
|
+
# Used instead of an implicit wait — never mix the two.
|
|
43
|
+
return self._elem(WebDriverWait(self.driver, timeout).until(EC.presence_of_element_located((by, locator))))
|
|
44
|
+
|
|
45
|
+
def _find(self, accessibility_id):
|
|
46
|
+
# accessibility id == the element's name attribute on iOS (identifier, else label); the Grid accepts it too.
|
|
47
|
+
return self._wait(AppiumBy.ACCESSIBILITY_ID, accessibility_id)
|
|
48
|
+
|
|
38
49
|
def _find_xpath(self, xpath):
|
|
39
|
-
return self.
|
|
50
|
+
return self._wait(By.XPATH, xpath)
|
|
40
51
|
|
|
41
52
|
def testQuickStartIosNativeDemo(self):
|
|
42
53
|
# [BEGIN_DEMO_STEPS]
|
|
43
|
-
self.
|
|
44
|
-
self.
|
|
45
|
-
self.
|
|
46
|
-
self.
|
|
47
|
-
self.
|
|
48
|
-
self.
|
|
49
|
-
self.
|
|
50
|
-
self.
|
|
51
|
-
self.
|
|
52
|
-
self.
|
|
53
|
-
self.
|
|
54
|
+
self._find("usernameTextField").send_keys('company')
|
|
55
|
+
self._find("passwordTextField").send_keys('company')
|
|
56
|
+
self._find("loginButton").click()
|
|
57
|
+
self._find("makePaymentButton").click()
|
|
58
|
+
self._find("phoneTextField").send_keys('1234567')
|
|
59
|
+
self._find("nameTextField").send_keys('Jon Snow')
|
|
60
|
+
self._find("amountTextField").send_keys('50')
|
|
61
|
+
self._find("countryButton").click()
|
|
62
|
+
self._find("Switzerland").click()
|
|
63
|
+
self._find("sendPaymentButton").click()
|
|
64
|
+
self._find("Yes").click()
|
|
54
65
|
# [END_DEMO_STEPS]
|
|
55
66
|
|
|
56
67
|
def tearDown(self):
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
# Guarded: when setUp fails the driver is None (or the session is already dead) and an unguarded quit() would
|
|
69
|
+
# replace the real error with its own. quit() always runs so a half-created session releases its device.
|
|
70
|
+
if self.driver is None:
|
|
71
|
+
return
|
|
72
|
+
try:
|
|
73
|
+
print('Report URL: ' + str(self.driver.desired_capabilities.get('digitalai:reportUrl', 'n/a')))
|
|
74
|
+
except Exception:
|
|
75
|
+
pass
|
|
76
|
+
try:
|
|
77
|
+
self.driver.quit()
|
|
78
|
+
finally:
|
|
79
|
+
self.driver = None
|
|
59
80
|
|
|
60
81
|
|
|
61
82
|
if __name__ == '__main__':
|
|
@@ -23,21 +23,38 @@ ${TEST_NAME} [Enter Test Name here]
|
|
|
23
23
|
Quick Start iOS Native Demo
|
|
24
24
|
Start Steps Group Test steps
|
|
25
25
|
# [BEGIN_DEMO_STEPS]
|
|
26
|
-
Input
|
|
27
|
-
Input
|
|
28
|
-
Click
|
|
29
|
-
Click
|
|
30
|
-
Input
|
|
31
|
-
Input
|
|
32
|
-
Input
|
|
33
|
-
Click
|
|
34
|
-
Click
|
|
35
|
-
Click
|
|
36
|
-
Click
|
|
26
|
+
Wait And Input accessibility_id=usernameTextField company
|
|
27
|
+
Wait And Input accessibility_id=passwordTextField company
|
|
28
|
+
Wait And Click accessibility_id=loginButton
|
|
29
|
+
Wait And Click accessibility_id=makePaymentButton
|
|
30
|
+
Wait And Input accessibility_id=phoneTextField 1234567
|
|
31
|
+
Wait And Input accessibility_id=nameTextField Jon Snow
|
|
32
|
+
Wait And Input accessibility_id=amountTextField 50
|
|
33
|
+
Wait And Click accessibility_id=countryButton
|
|
34
|
+
Wait And Click accessibility_id=Switzerland
|
|
35
|
+
Wait And Click accessibility_id=sendPaymentButton
|
|
36
|
+
Wait And Click accessibility_id=Yes
|
|
37
37
|
# [END_DEMO_STEPS]
|
|
38
38
|
Stop Steps Group
|
|
39
39
|
|
|
40
40
|
*** Keywords ***
|
|
41
|
+
Wait And Click
|
|
42
|
+
[Arguments] ${locator}
|
|
43
|
+
# Explicit wait before every interaction — AppiumLibrary's Click Element / Input Text do not wait on their own.
|
|
44
|
+
Wait Until Element Is Visible ${locator} 20s
|
|
45
|
+
Click Element ${locator}
|
|
46
|
+
|
|
47
|
+
Wait And Input
|
|
48
|
+
[Arguments] ${locator} ${text}
|
|
49
|
+
Wait Until Element Is Visible ${locator} 20s
|
|
50
|
+
Input Text ${locator} ${text}
|
|
51
|
+
|
|
52
|
+
# More AppiumLibrary keywords that fit a device farm (all built in, no extra library):
|
|
53
|
+
# Expect Text <text> visible timeout=20s polling assertion (also Expect Element <locator> visible)
|
|
54
|
+
# Scroll Element Into View <locator> reach content below the fold
|
|
55
|
+
# ${contexts}= Get Contexts / Switch To Context WEBVIEW_... / Switch To Context NATIVE_APP (hybrid screens)
|
|
56
|
+
# Background Application 5 lifecycle check
|
|
57
|
+
|
|
41
58
|
Open Cloud Session
|
|
42
59
|
Open Application ${REMOTE_URL} &{CAPABILITIES}
|
|
43
60
|
|
|
@@ -11,5 +11,8 @@ test {
|
|
|
11
11
|
dependencies {
|
|
12
12
|
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.10.2'
|
|
13
13
|
testRuntimeOnly group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.10.2'
|
|
14
|
-
|
|
14
|
+
// java-client 11 depends on selenium-api only ([4.50.0, 5.0)) and Gradle resolves the LOWEST version in a range —
|
|
15
|
+
// selenium-java pins the drivers and support classes explicitly
|
|
16
|
+
testImplementation group: 'io.appium', name: 'java-client', version: '11.0.0'
|
|
17
|
+
testImplementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.51.0'
|
|
15
18
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import io.appium.java_client.ios.IOSDriver;
|
|
2
|
+
import io.appium.java_client.ios.options.XCUITestOptions;
|
|
3
|
+
import org.junit.jupiter.api.*;
|
|
4
|
+
|
|
5
|
+
import screens.*;
|
|
6
|
+
|
|
7
|
+
import java.net.MalformedURLException;
|
|
8
|
+
import java.net.URI;
|
|
9
|
+
|
|
10
|
+
/** Page-object layout: the screens live in the screens package (BaseScreen + one class per screen); the test reads as the flow. */
|
|
11
|
+
public class LocaliOSTest {
|
|
12
|
+
|
|
13
|
+
private IOSDriver driver;
|
|
14
|
+
|
|
15
|
+
@BeforeEach
|
|
16
|
+
public void setUp() throws MalformedURLException {
|
|
17
|
+
XCUITestOptions options = new XCUITestOptions();
|
|
18
|
+
options.setCapability("digitalai:testName", "[Enter Test Name here]");
|
|
19
|
+
options.setCapability("digitalai:accessKey", "[Enter Your Access key here]");
|
|
20
|
+
options.setCapability("digitalai:deviceQuery", "@os='ios' and @category='[Enter PHONE/TABLET here]'");
|
|
21
|
+
options.setApp("cloud:com.experitest.ExperiBank");
|
|
22
|
+
options.setBundleId("com.experitest.ExperiBank");
|
|
23
|
+
driver = new IOSDriver(URI.create("[Enter Instance here]/wd/hub").toURL(), options);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@Test
|
|
27
|
+
public void quickStartiOSNativeDemo() {
|
|
28
|
+
// [BEGIN_DEMO_STEPS]
|
|
29
|
+
new LoginScreen(driver).login("company", "company")
|
|
30
|
+
.makePayment()
|
|
31
|
+
.fillPayment("0501234567", "John Snow", "50", "Switzerland")
|
|
32
|
+
.sendAndConfirm();
|
|
33
|
+
// [END_DEMO_STEPS]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@AfterEach
|
|
37
|
+
public void tearDown() {
|
|
38
|
+
if (driver == null) return;
|
|
39
|
+
try {
|
|
40
|
+
System.out.println("Report URL: " + driver.getCapabilities().getCapability("digitalai:reportUrl"));
|
|
41
|
+
System.out.println("Report Test ID: " + driver.getCapabilities().getCapability("digitalai:reportTestId"));
|
|
42
|
+
} catch (Exception ignored) {}
|
|
43
|
+
try {
|
|
44
|
+
driver.quit();
|
|
45
|
+
} catch (Exception ignored) {}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import io.appium.java_client.ios.IOSDriver;
|
|
2
2
|
import io.appium.java_client.ios.options.XCUITestOptions;
|
|
3
3
|
import org.junit.jupiter.api.*;
|
|
4
|
+
import io.appium.java_client.AppiumBy;
|
|
4
5
|
import org.openqa.selenium.By;
|
|
6
|
+
import org.openqa.selenium.WebElement;
|
|
7
|
+
import org.openqa.selenium.support.ui.ExpectedConditions;
|
|
8
|
+
import org.openqa.selenium.support.ui.WebDriverWait;
|
|
5
9
|
|
|
6
10
|
import java.net.MalformedURLException;
|
|
7
|
-
import java.net.
|
|
11
|
+
import java.net.URI;
|
|
12
|
+
import java.time.Duration;
|
|
8
13
|
|
|
9
14
|
public class LocaliOSTest {
|
|
10
15
|
|
|
@@ -18,23 +23,29 @@ public class LocaliOSTest {
|
|
|
18
23
|
options.setCapability("digitalai:deviceQuery", "@os='ios' and @category='[Enter PHONE/TABLET here]'");
|
|
19
24
|
options.setApp("cloud:com.experitest.ExperiBank");
|
|
20
25
|
options.setBundleId("com.experitest.ExperiBank");
|
|
21
|
-
driver = new IOSDriver(
|
|
26
|
+
driver = new IOSDriver(URI.create("[Enter Instance here]/wd/hub").toURL(), options);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Explicit wait: polls until the element is visible (20 s), then returns it. Used instead of an implicit wait —
|
|
30
|
+
// never mix the two (every miss then waits implicit + explicit, and the real timeout becomes unpredictable).
|
|
31
|
+
private WebElement find(By by) {
|
|
32
|
+
return new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.visibilityOfElementLocated(by));
|
|
22
33
|
}
|
|
23
34
|
|
|
24
35
|
@Test
|
|
25
36
|
public void quickStartiOSNativeDemo() {
|
|
26
37
|
// [BEGIN_DEMO_STEPS]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
find(AppiumBy.accessibilityId("usernameTextField")).sendKeys("company");
|
|
39
|
+
find(AppiumBy.accessibilityId("passwordTextField")).sendKeys("company");
|
|
40
|
+
find(AppiumBy.accessibilityId("loginButton")).click();
|
|
41
|
+
find(AppiumBy.accessibilityId("makePaymentButton")).click();
|
|
42
|
+
find(AppiumBy.accessibilityId("phoneTextField")).sendKeys("0501234567");
|
|
43
|
+
find(AppiumBy.accessibilityId("nameTextField")).sendKeys("John Snow");
|
|
44
|
+
find(AppiumBy.accessibilityId("amountTextField")).sendKeys("50");
|
|
45
|
+
find(AppiumBy.accessibilityId("countryButton")).click();
|
|
46
|
+
find(AppiumBy.accessibilityId("Switzerland")).click();
|
|
47
|
+
find(AppiumBy.accessibilityId("sendPaymentButton")).click();
|
|
48
|
+
find(AppiumBy.accessibilityId("Yes")).click();
|
|
38
49
|
// [END_DEMO_STEPS]
|
|
39
50
|
}
|
|
40
51
|
|
|
@@ -3,7 +3,11 @@ import io.appium.java_client.ios.IOSElement;
|
|
|
3
3
|
import io.appium.java_client.remote.IOSMobileCapabilityType;
|
|
4
4
|
import io.appium.java_client.remote.MobileCapabilityType;
|
|
5
5
|
import org.junit.jupiter.api.*;
|
|
6
|
+
import io.appium.java_client.MobileBy;
|
|
6
7
|
import org.openqa.selenium.By;
|
|
8
|
+
import org.openqa.selenium.WebElement;
|
|
9
|
+
import org.openqa.selenium.support.ui.ExpectedConditions;
|
|
10
|
+
import org.openqa.selenium.support.ui.WebDriverWait;
|
|
7
11
|
import org.openqa.selenium.ScreenOrientation;
|
|
8
12
|
import org.openqa.selenium.remote.DesiredCapabilities;
|
|
9
13
|
|
|
@@ -27,21 +31,27 @@ public class LocaliOSTest {
|
|
|
27
31
|
driver = new IOSDriver<>(new URL("[Enter Instance here]/wd/hub"), dc);
|
|
28
32
|
}
|
|
29
33
|
|
|
34
|
+
// Explicit wait (presence; 20 s) used instead of an implicit wait — never mix the two. Selenium 3 signature:
|
|
35
|
+
// java-client 7.x (required by the Appium Grid) pulls Selenium 3.141, whose WebDriverWait takes seconds as a long.
|
|
36
|
+
private WebElement find(By by) {
|
|
37
|
+
return new WebDriverWait(driver, 20).until(ExpectedConditions.presenceOfElementLocated(by));
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
@Test
|
|
31
41
|
public void quickStartiOSNativeDemo() {
|
|
32
42
|
// [BEGIN_DEMO_STEPS]
|
|
33
43
|
driver.rotate(ScreenOrientation.PORTRAIT);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
find(MobileBy.AccessibilityId("usernameTextField")).sendKeys("company");
|
|
45
|
+
find(MobileBy.AccessibilityId("passwordTextField")).sendKeys("company");
|
|
46
|
+
find(MobileBy.AccessibilityId("loginButton")).click();
|
|
47
|
+
find(MobileBy.AccessibilityId("makePaymentButton")).click();
|
|
48
|
+
find(MobileBy.AccessibilityId("phoneTextField")).sendKeys("0501234567");
|
|
49
|
+
find(MobileBy.AccessibilityId("nameTextField")).sendKeys("John Snow");
|
|
50
|
+
find(MobileBy.AccessibilityId("amountTextField")).sendKeys("50");
|
|
51
|
+
find(MobileBy.AccessibilityId("countryButton")).click();
|
|
52
|
+
find(MobileBy.AccessibilityId("Switzerland")).click();
|
|
53
|
+
find(MobileBy.AccessibilityId("sendPaymentButton")).click();
|
|
54
|
+
find(MobileBy.AccessibilityId("Yes")).click();
|
|
45
55
|
// [END_DEMO_STEPS]
|
|
46
56
|
}
|
|
47
57
|
|
|
@@ -33,10 +33,16 @@
|
|
|
33
33
|
<version>5.10.2</version>
|
|
34
34
|
<scope>test</scope>
|
|
35
35
|
</dependency>
|
|
36
|
+
<!-- java-client 11 depends on selenium-api only ([4.50.0, 5.0)); selenium-java brings the drivers and support classes -->
|
|
36
37
|
<dependency>
|
|
37
38
|
<groupId>io.appium</groupId>
|
|
38
39
|
<artifactId>java-client</artifactId>
|
|
39
|
-
<version>
|
|
40
|
+
<version>11.0.0</version>
|
|
41
|
+
</dependency>
|
|
42
|
+
<dependency>
|
|
43
|
+
<groupId>org.seleniumhq.selenium</groupId>
|
|
44
|
+
<artifactId>selenium-java</artifactId>
|
|
45
|
+
<version>4.51.0</version>
|
|
40
46
|
</dependency>
|
|
41
47
|
</dependencies>
|
|
42
48
|
</project>
|
|
@@ -9,5 +9,8 @@ test {
|
|
|
9
9
|
|
|
10
10
|
dependencies {
|
|
11
11
|
testImplementation group: 'org.testng', name: 'testng', version: '7.9.0'
|
|
12
|
-
|
|
12
|
+
// java-client 11 depends on selenium-api only ([4.50.0, 5.0)) and Gradle resolves the LOWEST version in a range —
|
|
13
|
+
// selenium-java pins the drivers and support classes explicitly
|
|
14
|
+
testImplementation group: 'io.appium', name: 'java-client', version: '11.0.0'
|
|
15
|
+
testImplementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.51.0'
|
|
13
16
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import io.appium.java_client.ios.IOSDriver;
|
|
2
|
+
import io.appium.java_client.ios.options.XCUITestOptions;
|
|
3
|
+
import org.testng.annotations.*;
|
|
4
|
+
|
|
5
|
+
import screens.*;
|
|
6
|
+
|
|
7
|
+
import java.net.MalformedURLException;
|
|
8
|
+
import java.net.URI;
|
|
9
|
+
|
|
10
|
+
/** Page-object layout: the screens live in the screens package (BaseScreen + one class per screen); the test reads as the flow. */
|
|
11
|
+
public class LocaliOSTest {
|
|
12
|
+
|
|
13
|
+
private IOSDriver driver;
|
|
14
|
+
|
|
15
|
+
@BeforeMethod
|
|
16
|
+
public void setUp() throws MalformedURLException {
|
|
17
|
+
XCUITestOptions options = new XCUITestOptions();
|
|
18
|
+
options.setCapability("digitalai:testName", "[Enter Test Name here]");
|
|
19
|
+
options.setCapability("digitalai:accessKey", "[Enter Your Access key here]");
|
|
20
|
+
options.setCapability("digitalai:deviceQuery", "@os='ios' and @category='[Enter PHONE/TABLET here]'");
|
|
21
|
+
options.setApp("cloud:com.experitest.ExperiBank");
|
|
22
|
+
options.setBundleId("com.experitest.ExperiBank");
|
|
23
|
+
driver = new IOSDriver(URI.create("[Enter Instance here]/wd/hub").toURL(), options);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@Test
|
|
27
|
+
public void quickStartiOSNativeDemo() {
|
|
28
|
+
// [BEGIN_DEMO_STEPS]
|
|
29
|
+
new LoginScreen(driver).login("company", "company")
|
|
30
|
+
.makePayment()
|
|
31
|
+
.fillPayment("0501234567", "John Snow", "50", "Switzerland")
|
|
32
|
+
.sendAndConfirm();
|
|
33
|
+
// [END_DEMO_STEPS]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@AfterMethod
|
|
37
|
+
public void tearDown() {
|
|
38
|
+
if (driver == null) return;
|
|
39
|
+
try {
|
|
40
|
+
System.out.println("Report URL: " + driver.getCapabilities().getCapability("digitalai:reportUrl"));
|
|
41
|
+
System.out.println("Report Test ID: " + driver.getCapabilities().getCapability("digitalai:reportTestId"));
|
|
42
|
+
} catch (Exception ignored) {}
|
|
43
|
+
try {
|
|
44
|
+
driver.quit();
|
|
45
|
+
} catch (Exception ignored) {}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import io.appium.java_client.ios.IOSDriver;
|
|
2
2
|
import io.appium.java_client.ios.options.XCUITestOptions;
|
|
3
3
|
import org.testng.annotations.*;
|
|
4
|
+
import io.appium.java_client.AppiumBy;
|
|
4
5
|
import org.openqa.selenium.By;
|
|
6
|
+
import org.openqa.selenium.WebElement;
|
|
7
|
+
import org.openqa.selenium.support.ui.ExpectedConditions;
|
|
8
|
+
import org.openqa.selenium.support.ui.WebDriverWait;
|
|
5
9
|
|
|
6
10
|
import java.net.MalformedURLException;
|
|
7
|
-
import java.net.
|
|
11
|
+
import java.net.URI;
|
|
12
|
+
import java.time.Duration;
|
|
8
13
|
|
|
9
14
|
public class LocaliOSTest {
|
|
10
15
|
|
|
@@ -18,23 +23,29 @@ public class LocaliOSTest {
|
|
|
18
23
|
options.setCapability("digitalai:deviceQuery", "@os='ios' and @category='[Enter PHONE/TABLET here]'");
|
|
19
24
|
options.setApp("cloud:com.experitest.ExperiBank");
|
|
20
25
|
options.setBundleId("com.experitest.ExperiBank");
|
|
21
|
-
driver = new IOSDriver(
|
|
26
|
+
driver = new IOSDriver(URI.create("[Enter Instance here]/wd/hub").toURL(), options);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Explicit wait: polls until the element is visible (20 s), then returns it. Used instead of an implicit wait —
|
|
30
|
+
// never mix the two (every miss then waits implicit + explicit, and the real timeout becomes unpredictable).
|
|
31
|
+
private WebElement find(By by) {
|
|
32
|
+
return new WebDriverWait(driver, Duration.ofSeconds(20)).until(ExpectedConditions.visibilityOfElementLocated(by));
|
|
22
33
|
}
|
|
23
34
|
|
|
24
35
|
@Test
|
|
25
36
|
public void quickStartiOSNativeDemo() {
|
|
26
37
|
// [BEGIN_DEMO_STEPS]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
find(AppiumBy.accessibilityId("usernameTextField")).sendKeys("company");
|
|
39
|
+
find(AppiumBy.accessibilityId("passwordTextField")).sendKeys("company");
|
|
40
|
+
find(AppiumBy.accessibilityId("loginButton")).click();
|
|
41
|
+
find(AppiumBy.accessibilityId("makePaymentButton")).click();
|
|
42
|
+
find(AppiumBy.accessibilityId("phoneTextField")).sendKeys("0501234567");
|
|
43
|
+
find(AppiumBy.accessibilityId("nameTextField")).sendKeys("John Snow");
|
|
44
|
+
find(AppiumBy.accessibilityId("amountTextField")).sendKeys("50");
|
|
45
|
+
find(AppiumBy.accessibilityId("countryButton")).click();
|
|
46
|
+
find(AppiumBy.accessibilityId("Switzerland")).click();
|
|
47
|
+
find(AppiumBy.accessibilityId("sendPaymentButton")).click();
|
|
48
|
+
find(AppiumBy.accessibilityId("Yes")).click();
|
|
38
49
|
// [END_DEMO_STEPS]
|
|
39
50
|
}
|
|
40
51
|
|
|
@@ -3,7 +3,11 @@ import io.appium.java_client.ios.IOSElement;
|
|
|
3
3
|
import io.appium.java_client.remote.IOSMobileCapabilityType;
|
|
4
4
|
import io.appium.java_client.remote.MobileCapabilityType;
|
|
5
5
|
import org.testng.annotations.*;
|
|
6
|
+
import io.appium.java_client.MobileBy;
|
|
6
7
|
import org.openqa.selenium.By;
|
|
8
|
+
import org.openqa.selenium.WebElement;
|
|
9
|
+
import org.openqa.selenium.support.ui.ExpectedConditions;
|
|
10
|
+
import org.openqa.selenium.support.ui.WebDriverWait;
|
|
7
11
|
import org.openqa.selenium.ScreenOrientation;
|
|
8
12
|
import org.openqa.selenium.remote.DesiredCapabilities;
|
|
9
13
|
|
|
@@ -27,21 +31,27 @@ public class LocaliOSTest {
|
|
|
27
31
|
driver = new IOSDriver<>(new URL("[Enter Instance here]/wd/hub"), dc);
|
|
28
32
|
}
|
|
29
33
|
|
|
34
|
+
// Explicit wait (presence; 20 s) used instead of an implicit wait — never mix the two. Selenium 3 signature:
|
|
35
|
+
// java-client 7.x (required by the Appium Grid) pulls Selenium 3.141, whose WebDriverWait takes seconds as a long.
|
|
36
|
+
private WebElement find(By by) {
|
|
37
|
+
return new WebDriverWait(driver, 20).until(ExpectedConditions.presenceOfElementLocated(by));
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
@Test
|
|
31
41
|
public void quickStartiOSNativeDemo() {
|
|
32
42
|
// [BEGIN_DEMO_STEPS]
|
|
33
43
|
driver.rotate(ScreenOrientation.PORTRAIT);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
find(MobileBy.AccessibilityId("usernameTextField")).sendKeys("company");
|
|
45
|
+
find(MobileBy.AccessibilityId("passwordTextField")).sendKeys("company");
|
|
46
|
+
find(MobileBy.AccessibilityId("loginButton")).click();
|
|
47
|
+
find(MobileBy.AccessibilityId("makePaymentButton")).click();
|
|
48
|
+
find(MobileBy.AccessibilityId("phoneTextField")).sendKeys("0501234567");
|
|
49
|
+
find(MobileBy.AccessibilityId("nameTextField")).sendKeys("John Snow");
|
|
50
|
+
find(MobileBy.AccessibilityId("amountTextField")).sendKeys("50");
|
|
51
|
+
find(MobileBy.AccessibilityId("countryButton")).click();
|
|
52
|
+
find(MobileBy.AccessibilityId("Switzerland")).click();
|
|
53
|
+
find(MobileBy.AccessibilityId("sendPaymentButton")).click();
|
|
54
|
+
find(MobileBy.AccessibilityId("Yes")).click();
|
|
45
55
|
// [END_DEMO_STEPS]
|
|
46
56
|
}
|
|
47
57
|
|
|
@@ -33,10 +33,16 @@
|
|
|
33
33
|
<version>7.9.0</version>
|
|
34
34
|
<scope>test</scope>
|
|
35
35
|
</dependency>
|
|
36
|
+
<!-- java-client 11 depends on selenium-api only ([4.50.0, 5.0)); selenium-java brings the drivers and support classes -->
|
|
36
37
|
<dependency>
|
|
37
38
|
<groupId>io.appium</groupId>
|
|
38
39
|
<artifactId>java-client</artifactId>
|
|
39
|
-
<version>
|
|
40
|
+
<version>11.0.0</version>
|
|
41
|
+
</dependency>
|
|
42
|
+
<dependency>
|
|
43
|
+
<groupId>org.seleniumhq.selenium</groupId>
|
|
44
|
+
<artifactId>selenium-java</artifactId>
|
|
45
|
+
<version>4.51.0</version>
|
|
40
46
|
</dependency>
|
|
41
47
|
</dependencies>
|
|
42
48
|
</project>
|