Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Appium with webdriver.io #18

Merged
merged 5 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,14 @@ Go to: ui_selenium folder
```
https://www.selenium.dev/documentation/webdriver/elements/locators/
https://www.selenium.dev/documentation/webdriver/elements/interactions/
```

## Appium with Webdriver.io UI Testing
```
Go to: ui_appium_webdriver folder
```
### Guides
```
https://webdriver.io/docs/api/appium/
https://appium.readthedocs.io/en/stable/en/commands/element/find-elements/#example-usage
```
2 changes: 2 additions & 0 deletions ui_appium_webdriver/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
14 changes: 14 additions & 0 deletions ui_appium_webdriver/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
]
}
104 changes: 104 additions & 0 deletions ui_appium_webdriver/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
7 changes: 7 additions & 0 deletions ui_appium_webdriver/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
semi: true,
trailingComma: "all",
singleQuote: true,
printWidth: 120,
tabWidth: 2
};
100 changes: 100 additions & 0 deletions ui_appium_webdriver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
## Installation
```
Install Node: https://nodejs.org/en/download/
```

## Android Studio Setup
Go to url:
```
https://developer.android.com/studio
```

## Webdriver.io Setup
In terminal, navigate to project root folder, then type:
```
npm install
```

## Appium Setup
In terminal, navigate to project root folder, then type:
```
npm install -g appium
appium driver install uiautomator2

Look at url to install and config appium with webdriver.io
https://webdriver.io/docs/appium-service/
```

## Appium Doctor
In terminal, navigate to project root folder, then type:
```
npm install -g @appium/doctor
appium-doctor

Informs missing connections e.g appium with Android Studio:

Common issues:
export ANDROID_HOME=~/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools

/usr/libexec/java_home - this gives u `/Library/Java/JavaVirtualMachines/jdk-18.0.1.1.jdk/Contents/Home`
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-18.0.1.1.jdk/Contents/Home
export PATH=${JAVA_HOME}/bin:$PATH
```
- Go to Android Studio, SDK Manager >> SDK Tools and choose Hide Obsolete Packages
- Install the “Android SDK Tools” which was marked as Obsolete

![screenshot](./readme-images/obsoleteSDK.png)


## Appium Inspector
```
https://inspector.appiumpro.com/ or https://github.com/appium/appium-inspector/releases

setup:
{
"platformName": "Android",
"appium:automationName": "UiAutomator2",
"appium:deviceName": "emulator-5554",
"appium:appWaitActivity": "com.swaglabsmobileapp.MainActivity",
"appium:app": "/Users/{NAME}/Documents/workspace/appium/sample/Android.SauceLabs.Mobile.Sample.app.2.7.1.apk"
}

To check listed devices:
In terminal do: `adb devices` then add to "appium:deviceName"
```


## Run your end-to-end tests
```
Android Studio Emulator - Go to Android Studio, new or existing project >> Device Manager, select and run device
npm run appium
npm run test:open
```
execute tests via GUI through emulator


## Lints and fixes files
```
npm run lint
```

## VS Code Setup for Cucumber assistence

### Cucumber (Gherkin) Full Support

- Create Folder called `.vscode`

- Add file called `settings.json`

- Within `settings.json` add:
```

{
"cucumberautocomplete.steps": ["tests/e2e/step_definitions/*.ts"],
"cucumberautocomplete.syncfeatures": "tests/e2e/*.feature",
"cucumberautocomplete.strictGherkinCompletion": false,
"cucumberautocomplete.smartSnippets": true,
"cucumberautocomplete.stepsInvariants": true
}
```
Binary file added ui_appium_webdriver/apk/Android.SauceLabs.apk
Binary file not shown.
Loading
Loading