-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Damjan Smickovski
authored and
Damjan Smickovski
committed
Jun 27, 2023
0 parents
commit bd701f5
Showing
8 changed files
with
2,384 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '8' | ||
|
||
- name: Set up Android SDK | ||
uses: android-actions/setup-android@v2 | ||
|
||
- name: Create and start emulator | ||
run: | | ||
echo "y" | sdkmanager "system-images;android-30;google_apis;x86" | ||
echo "no" | avdmanager create avd --force --name Pixel_3a_API_30_x86 --package "system-images;android-30;google_apis;x86" --device "pixel_3a" | ||
$ANDROID_HOME/emulator/emulator -avd Pixel_3a_API_30_x86 -no-snapshot -no-window -no-audio -gpu swiftshader_indirect & | ||
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82' | ||
- name: Install and start Appium | ||
run: | | ||
yarn global add appium@next | ||
appium & | ||
- name: Run tests | ||
env: | ||
LOG_LEVEL: debug | ||
APPIUM_PORT: 4723 | ||
APPIUM_HOST: localhost | ||
run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
mochawesome-report | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"require": [ | ||
"ts-node/register" | ||
], | ||
"extension": [ | ||
"ts" | ||
], | ||
"spec": "src/tests/**/*.ts", | ||
"timeout": 50000, | ||
"watch-files": [ | ||
"src/tests/**/*.ts" | ||
], | ||
"recursive": true, | ||
"reporter": "mochawesome", | ||
"reporterOptions": { | ||
"reportFilename": "customReportFilename", | ||
"quiet": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import dotenv from 'dotenv'; | ||
|
||
dotenv.config(); | ||
|
||
|
||
const { APPIUM_HOST, APPIUM_PORT, LOG_LEVEL } = process.env; | ||
|
||
if (!APPIUM_HOST) { | ||
throw new Error("Missing APPIUM_HOST") | ||
} | ||
|
||
if (!APPIUM_PORT) { | ||
throw new Error("Missing APPIUM_PORT") | ||
} | ||
|
||
const capabilitiesAndroid = { | ||
platformName: 'Android', | ||
'appium:automationName': 'UiAutomator2', | ||
'appium:deviceName': 'Android', | ||
'appium:appPackage': 'com.android.settings', | ||
'appium:appActivity': '.Settings', | ||
}; | ||
|
||
const capabilitiesIOS = { | ||
// For demo purposes not implemented | ||
}; | ||
|
||
|
||
export const getConfig = (platform: 'android' | 'ios') => { | ||
return { | ||
host: APPIUM_HOST, | ||
port: parseInt(APPIUM_PORT), | ||
logLevel: LOG_LEVEL || 'info', | ||
capabilities: platform === 'android' ? capabilitiesAndroid : capabilitiesIOS, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "appium_test", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"ext": "ts, js", | ||
"scripts": { | ||
"test": "mocha -r tsconfig-paths/register -r ts-node/register" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.3.2", | ||
"ts-node": "^10.9.1", | ||
"webdriverio": "^8.11.2" | ||
}, | ||
"dependencies": { | ||
"@types/mocha": "^10.0.1", | ||
"dotenv": "^16.3.1", | ||
"mocha": "^10.2.0", | ||
"mochawesome": "^7.1.3", | ||
"strip-ansi": "6.0.0", | ||
"tsconfig-paths": "^4.2.0", | ||
"typescript": "^5.1.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
const { remote } = require('webdriverio'); | ||
import { getConfig } from '../../appium-conf'; | ||
|
||
describe("Settings suite", async () => { | ||
const config = getConfig('android'); | ||
|
||
it("should open settings", async () => { | ||
const driver = await remote(config); | ||
try { | ||
const batteryItem = await driver.$('//*[@text="Battery"]'); | ||
await batteryItem.click(); | ||
} finally { | ||
await driver.pause(1000); | ||
await driver.deleteSession(); | ||
} | ||
}); | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"module": "CommonJS", | ||
"esModuleInterop": true, | ||
"resolveJsonModule": true, | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true, | ||
"outDir": "dist", | ||
"baseUrl": "./src", | ||
"paths": { | ||
"@tests/*": [ | ||
"tests/*" | ||
], | ||
}, | ||
"strict": true | ||
}, | ||
"include": [ | ||
"src/**/*", | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} |
Oops, something went wrong.