Skip to content

Commit 3b02505

Browse files
Merge pull request #3 from dmberezovskyii/PPA-0002
added Adnroid driver imp
2 parents 4738475 + 9a50527 commit 3b02505

File tree

8 files changed

+110
-11
lines changed

8 files changed

+110
-11
lines changed

.github/workflows/code_quality.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Qodana
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
- master
10+
- 'releases/*'
11+
12+
jobs:
13+
qodana:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
checks: write
19+
steps:
20+
# Check out the code
21+
- uses: actions/checkout@v3
22+
with:
23+
ref: ${{ github.event.pull_request.head.sha }}
24+
fetch-depth: 0
25+
26+
# Set up Python (you can specify the version you need)
27+
- name: Set up Python
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: '3.12' # Set this to your desired Python version
31+
32+
- name: Install Poetry
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install poetry
36+
37+
- name: Install dependencies with Poetry
38+
run: |
39+
poetry install
40+
41+
# Run Qodana scan
42+
- name: 'Qodana Scan'
43+
uses: JetBrains/[email protected]
44+
with:
45+
pr-mode: false
46+
args: --apply-fixes
47+
push-fixes: pull-request
48+
env:
49+
QODANA_TOKEN: ${{ secrets.QODANA }}

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Python
2020
uses: actions/setup-python@v3
2121
with:
22-
python-version: "3.10"
22+
python-version: "3.12"
2323

2424
- name: Install Poetry
2525
run: |

config/settings.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
default:
2+
DEBUG: True
23
APPIUM_SERVER: "http://localhost:4723/wd/hub"
34

45
stage:
5-
APPIUM_SERVER: "http://stage:4723/wd/hub"
6-
ANDROID_CAPS:
6+
DEBUG: True
7+
APPIUM_SERVER: "http://stage-address:4723/wd/hub"
8+
ANDROID:
79
platformName: "Android"
810
deviceName: "emulator"
9-
app: "/path/to/app.apk"
11+
app: ""
12+
platformVersion: "15"
13+
automationName: "uiautomator2"
14+
IOS:
15+
platformName: "iOS"
16+
deviceName: "iPhone 14"
17+
bundleId: "com.example.app"
18+
automationName: "XCUITest"
1019

1120
prod:
12-
APPIUM_SERVER: "http://prod:4723/wd/hub"
13-
IOS_CAPS:
21+
DEBUG: True
22+
APPIUM_SERVER: "http://prod-adress:4723/wd/hub"
23+
IOS:
1424
platformName: "iOS"
1525
deviceName: "iPhone 14"
1626
bundleId: "com.example.app"
27+
automationName: "XCUITest"

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dynaconf = "^3.2.10"
1818
requests = "^2.31"
1919
pytest-asyncio = "^0.24.0"
2020
pytest-html = "^4.1.1"
21+
Appium-Python-Client = "^4.5.1"
2122

2223
[tool.poetry.dev-dependencies]
2324
ruff = "^0.6.8"

src/drivers/android_driver.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from pathlib import Path
2+
3+
from config import settings
4+
5+
6+
class AndroidCaps:
7+
@staticmethod
8+
def get_caps():
9+
"""Generate and return Android capabilities, with adding dynamic 'app' path."""
10+
caps = settings.ANDROID.to_dict()
11+
12+
if not caps:
13+
raise ValueError("❌ ANDROID capabilities not found in settings.yaml")
14+
15+
caps["app"] = str(Path(__file__).resolve().parents[2] / "data/apps/app.apk")
16+
17+
return caps

src/drivers/driver_factory.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1+
from appium import webdriver
2+
3+
from config import settings
4+
from src.drivers.android_driver import AndroidCaps
5+
6+
17
class Driver:
2-
3-
@staticmethod
4-
def get_driver(platform: str):
5-
"""Get driver by platform"""
8+
@staticmethod
9+
def get_driver(platform: str):
10+
"""Get driver by platform, uses appropriate capabilities for Android or iOS."""
11+
if platform.lower() == "android":
12+
caps = AndroidCaps.get_caps()
13+
else:
14+
caps = settings.iOS.to_dict()
15+
16+
driver = webdriver.Remote(settings.APPIUM_SERVER, caps)
17+
return driver

src/drivers/ios_driver.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from appium.webdriver import webdriver
2+
3+
from config import settings
4+
5+
6+
class iOSDriver:
7+
@staticmethod
8+
def get_driver(platform: str):
9+
return settings.iOS.to_dict()

src/screens/base_screen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
class Screen:
2-
pass
2+
pass

0 commit comments

Comments
 (0)