Skip to content

Commit 67da65f

Browse files
authored
feat(java): ✨ added ios support (#346)
1 parent a9ceca9 commit 67da65f

File tree

99 files changed

+3349
-1732
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+3349
-1732
lines changed

.github/workflows/bs-app-upload.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,15 @@ jobs:
2626
username: ${{ env.BS_USER }}
2727
password: ${{ env.BS_KEY }}
2828
data: '{ "custom_id": "AndroidApp" }'
29-
files: '{ "file": "${{ github.workspace }}/core-java/src/test/resources/apps/android/saucedemo.apk" }'
29+
files: '{ "file": "${{ github.workspace }}/core-java/src/test/resources/apps/android/sauce-demo.apk" }'
30+
31+
- name: Upload iOS App
32+
id: ios_app_upload
33+
uses: fjogeleit/http-request-action@v1
34+
with:
35+
url: https://api-cloud.browserstack.com/app-automate/upload
36+
method: POST
37+
username: ${{ env.BS_USER }}
38+
password: ${{ env.BS_KEY }}
39+
data: '{ "custom_id": "IOSApp" }'
40+
files: '{ "file": "${{ github.workspace }}/core-java/src/test/resources/apps/ios/sauce-demo.ipa" }'

.github/workflows/test-core.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,24 @@ jobs:
8282
run: |
8383
npm install -g appium@next
8484
appium driver install uiautomator2
85+
appium driver install xcuitest
8586
8687
- name: Start Selenium Grid
8788
run: java -jar core-java/libs/selenium-server-4.7.0.jar standalone > core-java/selenium-grid.log &
8889

90+
- name: Launch iOS Simulator
91+
uses: futureware-tech/simulator-action@v2
92+
with:
93+
model: 'iPhone 14 Pro Max'
94+
os: 'iOS'
95+
os_version: 16.2
96+
shutdown_after_job: true
97+
8998
- name: All Test execution
9099
uses: reactivecircus/android-emulator-runner@v2
91100
if: github.event_name == 'push'
92101
with:
93-
avd-name: Nexus_6
102+
avd-name: Pixel_6_Pro
94103
api-level: 30
95104
target: google_apis
96105
arch: x86
@@ -104,7 +113,7 @@ jobs:
104113
uses: reactivecircus/android-emulator-runner@v2
105114
if: github.event_name == 'pull_request'
106115
with:
107-
avd-name: Nexus_6
116+
avd-name: Pixel_6_Pro
108117
api-level: 30
109118
target: google_apis
110119
arch: x86
@@ -128,6 +137,7 @@ jobs:
128137
${{ github.workspace }}/core-java/selenium-grid.log
129138
${{ github.workspace }}/core-java/target
130139
${{ github.workspace }}/core-java/reports
140+
${{ github.workspace }}/core-java/screenshots
131141
132142
analysis:
133143
if: github.event_name == 'push'

.github/workflows/test-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ jobs:
6868
${{ github.workspace }}/sample-tests/selenium-grid.log
6969
${{ github.workspace }}/sample-tests/target
7070
${{ github.workspace }}/sample-tests/reports
71+
${{ github.workspace }}/sample-java/screenshots

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ website/build
55
/core-java
66
.pnp.*
77
*.md*
8+
*.xml

.yarn/sdks/eslint/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint",
3-
"version": "8.30.0-sdk",
3+
"version": "8.32.0-sdk",
44
"main": "./lib/api.js",
55
"type": "commonjs"
66
}

.yarn/sdks/prettier/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "prettier",
3-
"version": "2.8.1-sdk",
3+
"version": "2.8.3-sdk",
44
"main": "./index.js",
55
"type": "commonjs"
66
}

README.md

Lines changed: 106 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</p>
3838

3939
<h4>
40-
<a href="https://BoykaFramework.github.io/boyka-framework/docs/intro">Documentation</a>
40+
<a href="https://boykaframework.github.io/boyka-framework/docs/intro">Documentation</a>
4141
<span> | </span>
4242
<a href="https://github.com/BoykaFramework/boyka-framework/issues/new/choose">Report Bug</a>
4343
<span> | </span>
@@ -63,6 +63,7 @@ This all gave me an idea of having a single framework which could solve all the
6363
- ✅ Support Rest API automation with schema validations and response body verification
6464
- ✅ Supports Web browser automation with support for Chrome, Edge, Firefox and Safari.
6565
- ✅ Supports Android native apps automation
66+
- ✅ Supports iOS native apps automation
6667
- ✅ Supports execution of Web tests on cloud platforms like BrowserStack and LambdaTest.
6768
- ✅ Highly configurable via `boyka-config.json`
6869
- ✅ Micro logging to log events of the test execution
@@ -72,7 +73,6 @@ This all gave me an idea of having a single framework which could solve all the
7273

7374
Following are the awesome features which will be implemented soon to the frameworks:
7475

75-
- Support for iOS automation
7676
- Support for GraphQL and SOAP API automation
7777
- Support video recording of the tests for Web and Mobile platforms
7878
- Support for more cloud platforms.
@@ -191,6 +191,7 @@ This is the configuration file for Boyka Framework named `boyka-config.json` sto
191191
"port": 4723,
192192
"base_path": "/wd/hub",
193193
"session_override": true,
194+
"driver": "UI_AUTOMATOR",
194195
"allow_insecure": [
195196
"get_server_logs"
196197
]
@@ -199,7 +200,6 @@ This is the configuration file for Boyka Framework named `boyka-config.json` sto
199200
"os": "ANDROID",
200201
"version": "11",
201202
"name": "Pixel_6_Pro",
202-
"automation": "UI_AUTOMATOR",
203203
"type": "VIRTUAL",
204204
"server_install_timeout": 60,
205205
"server_launch_timeout": 60,
@@ -209,13 +209,12 @@ This is the configuration file for Boyka Framework named `boyka-config.json` sto
209209
"max_swipe_until_found": 5
210210
},
211211
"application": {
212-
"path": "/apps/android/saucedemo.apk",
213-
"wait_activity": "com.swaglabsmobileapp.MainActivity",
212+
"path": "/apps/android/sauce-demo.apk",
214213
"install_timeout": 180
215214
},
216-
"avd": {
215+
"virtual_device": {
217216
"name": "Pixel_6_Pro",
218-
"headless": false
217+
"headless": true
219218
}
220219
}
221220
},
@@ -226,26 +225,99 @@ This is the configuration file for Boyka Framework named `boyka-config.json` sto
226225
"host": "hub-cloud.browserstack.com",
227226
"user_name": "${env:BS_USER}",
228227
"password": "${env:BS_KEY}",
229-
"base_path": "/wd/hub"
228+
"base_path": "/wd/hub",
229+
"driver": "UI_AUTOMATOR"
230230
},
231231
"device": {
232232
"os": "ANDROID",
233233
"version": "11.0",
234234
"name": "Google Pixel 5",
235-
"automation": "UI_AUTOMATOR",
236235
"type": "CLOUD",
237236
"ignore_unimportant_views": true,
238237
"application": {
239238
"path": "AndroidApp",
240239
"external": true,
241-
"wait_activity": "com.swaglabsmobileapp.MainActivity",
242240
"install_timeout": 180
243241
},
244242
"capabilities": {
245243
"projectName": "BrowserStack Android Project",
246244
"buildName": "Test BrowserStack Build",
247245
"sessionName": "Test BrowserStack Session",
248246
"appiumVersion": "2.0.0",
247+
"automationVersion": "latest",
248+
"deviceLogs": true,
249+
"networkLogs": true,
250+
"debug": true,
251+
"video": true,
252+
"appiumLogs": true
253+
}
254+
}
255+
},
256+
"test_local_sauce_ios": {
257+
"server": {
258+
"protocol": "HTTP",
259+
"host": "127.0.0.1",
260+
"port": 4724,
261+
"base_path": "/wd/hub",
262+
"session_override": true,
263+
"driver": "XCUI",
264+
"allow_insecure": [
265+
"get_server_logs"
266+
]
267+
},
268+
"device": {
269+
"os": "IOS",
270+
"version": "16.2",
271+
"name": "iPhone 14 Pro Max",
272+
"type": "VIRTUAL",
273+
"server_install_timeout": 60,
274+
"server_launch_timeout": 60,
275+
"connect_keyboard": false,
276+
"typing_speed": 30,
277+
"swipe": {
278+
"distance": 25,
279+
"max_swipe_until_found": 5
280+
},
281+
"virtual_device": {
282+
"headless": true,
283+
"launch_timeout": 180
284+
},
285+
"wda": {
286+
"launch_timeout": 120,
287+
"connection_timeout": 120
288+
},
289+
"application": {
290+
"path": "/apps/ios/sauce-demo.zip",
291+
"install_timeout": 180
292+
}
293+
}
294+
},
295+
"test_bs_ios": {
296+
"server": {
297+
"cloud": "BROWSER_STACK",
298+
"protocol": "HTTPS",
299+
"host": "hub-cloud.browserstack.com",
300+
"user_name": "${env:BS_USER}",
301+
"password": "${env:BS_KEY}",
302+
"base_path": "/wd/hub",
303+
"driver": "XCUI"
304+
},
305+
"device": {
306+
"os": "IOS",
307+
"version": "16",
308+
"name": "iPhone 14 Pro",
309+
"type": "CLOUD",
310+
"application": {
311+
"path": "IOSApp",
312+
"external": true,
313+
"install_timeout": 180
314+
},
315+
"capabilities": {
316+
"projectName": "BrowserStack iOS Project",
317+
"buildName": "Test BrowserStack Build",
318+
"sessionName": "Test BrowserStack Session",
319+
"appiumVersion": "2.0.0",
320+
"automationVersion": "latest",
249321
"deviceLogs": true,
250322
"networkLogs": true,
251323
"debug": true,
@@ -329,9 +401,9 @@ response.verifyTextField ("createdAt")
329401
</details>
330402

331403
<details>
332-
<summary>💻 Common Page Object for Web and Android</summary>
404+
<summary>💻 Common Page Object for Web, Android and iOS</summary>
333405

334-
This is how you can create a common page object for both Web and Android.
406+
This is how you can create a common page object for all Web, Android and iOS.
335407

336408
```java
337409
import io.appium.java_client.AppiumBy;
@@ -348,28 +420,23 @@ public class LoginPage {
348420
return LOGIN_PAGE;
349421
}
350422

351-
private final Locator loginBox = Locator.buildLocator ()
352-
.web (By.id ("login_button_container"))
353-
.android (AppiumBy.accessibilityId ("test-Login"))
354-
.name ("Login Box")
355-
.build ();
356423
private final Locator loginButton = Locator.buildLocator ()
357424
.web (By.id ("login-button"))
358425
.android (AppiumBy.accessibilityId ("test-LOGIN"))
426+
.ios (AppiumBy.accessibilityId ("test-LOGIN"))
359427
.name ("Login Button")
360-
.parent (this.loginBox)
361428
.build ();
362429
private final Locator password = Locator.buildLocator ()
363430
.web (By.id ("password"))
364431
.android (AppiumBy.accessibilityId ("test-Password"))
432+
.ios (AppiumBy.accessibilityId ("test-Password"))
365433
.name ("Password")
366-
.parent (this.loginBox)
367434
.build ();
368435
private final Locator username = Locator.buildLocator ()
369436
.web (By.id ("user-name"))
370437
.android (AppiumBy.accessibilityId ("test-Username"))
438+
.ios (AppiumBy.accessibilityId ("test-Username"))
371439
.name ("User Name")
372-
.parent (this.loginBox)
373440
.build ();
374441

375442
private LoginPage () {
@@ -381,9 +448,9 @@ public class LoginPage {
381448
</details>
382449

383450
<details>
384-
<summary>✅ Common Test flow for Web and Android</summary>
451+
<summary>✅ Common Test flow for Web, Android and iOS</summary>
385452

386-
This is how you can write common actions class for Web and Android together for the app which has similar flows on both the platforms.
453+
This is how you can write common actions class for Web, Android and iOS together for the app which has similar flows on both the platforms.
387454

388455
```java
389456
import static com.github.wasiqb.boyka.actions.DriverActions.navigate;
@@ -488,18 +555,22 @@ public class SauceDemoTest {
488555
## ☕ Examples
489556

490557
- API:
491-
- [How to configure Boyka for API Automation?](https://BoykaFramework.github.io/boyka-framework/docs/guides/api/setup-config)
492-
- [How to compose a request?](https://BoykaFramework.github.io/boyka-framework/docs/guides/api/compose-request)
493-
- [How to execute a request?](https://BoykaFramework.github.io/boyka-framework/docs/guides/api/execute-request)
494-
- [How to verify the response?](https://BoykaFramework.github.io/boyka-framework/docs/guides/api/verify-response)
495-
- Web:
496-
- [How to configure Boyka for Web Automation?](https://BoykaFramework.github.io/boyka-framework/docs/guides/web/setup-config)
497-
- [How to create page object?](https://BoykaFramework.github.io/boyka-framework/docs/guides/web/create-page-object)
498-
- [How to write test using the page object?](https://BoykaFramework.github.io/boyka-framework/docs/guides/web/write-test)
499-
- Mobile:
500-
- [How to configure Boyka for Web Automation?](https://boykaframework.github.io/boyka-framework/docs/guides/mobile/setup-config)
501-
- [How to create page object?](https://boykaframework.github.io/boyka-framework/docs/guides/mobile/create-page-object)
502-
- [How to write test using the page object?](https://boykaframework.github.io/boyka-framework/docs/guides/mobile/write-test)
558+
- [How to configure Boyka for API Automation?](https://boykaframework.github.io/boyka-framework/docs/guides/api/setup-config)
559+
- [How to compose a request?](https://boykaframework.github.io/boyka-framework/docs/guides/api/compose-request)
560+
- [How to execute a request?](https://boykaframework.github.io/boyka-framework/docs/guides/api/execute-request)
561+
- [How to verify the response?](https://boykaframework.github.io/boyka-framework/docs/guides/api/verify-response)
562+
- UI:
563+
- Web:
564+
- [How to configure Boyka for Web Automation?](https://boykaframework.github.io/boyka-framework/docs/guides/ui/web/setup-config)
565+
- [How to create page object for Web?](https://boykaframework.github.io/boyka-framework/docs/guides/ui/web/create-page-object)
566+
- Android:
567+
- [How to configure Boyka for Android Automation?](https://boykaframework.github.io/boyka-framework/docs/guides/ui/android/setup-config)
568+
- [How to update existing page object with Android locators?](https://boykaframework.github.io/boyka-framework/docs/guides/ui/android/create-page-object)
569+
- iOS:
570+
- [How to configure Boyka for iOS Automation?](https://boykaframework.github.io/boyka-framework/docs/guides/ui/ios/setup-config)
571+
- [How to update existing page object for iOS locators?](https://boykaframework.github.io/boyka-framework/docs/guides/ui/ios/create-page-object)
572+
- [How to create common application action class?](https://boykaframework.github.io/boyka-framework/docs/guides/ui/page-action)
573+
- [How to write test class using common action class?](https://boykaframework.github.io/boyka-framework/docs/guides/ui/write-test)
503574

504575
## 👾 Tech Stack
505576

@@ -560,7 +631,7 @@ Distributed under MIT [License](LICENSE).
560631

561632
- Join our [Discord server](https://discord.gg/dUg8K9DAsR) to discuss anything about the framework
562633
- Open a [new Discussion](https://github.com/BoykaFramework/boyka-framework/discussions/new) on GitHub to ask questions or to discuss ideas
563-
- Connect with me on [my Linktree](https://linktr.ee/BoykaFramework)
634+
- Connect with me on [my LinkFree links](https://linkfree.eddiehub.io/WasiqB)
564635

565636
## ⭐ Star History
566637

core-java/code-formatter/boyka-formatter.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<!--
2+
~ MIT License
3+
~
4+
~ Copyright (c) 2023, Wasiq Bhamla
5+
~
6+
~ Permission is hereby granted, free of charge, to any person obtaining a copy
7+
~ of this software and associated documentation files (the "Software"), to deal
8+
~ in the Software without restriction, including without limitation the rights
9+
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
~ copies of the Software, and to permit persons to whom the Software is
11+
~ furnished to do so, subject to the following conditions:
12+
~
13+
~ The above copyright notice and this permission notice shall be included in all
14+
~ copies or substantial portions of the Software.
15+
-->
16+
117
<code_scheme name="boyka-formatter" version="173">
218
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
319
<option name="SOFT_MARGINS" value="120" />

0 commit comments

Comments
 (0)