An automation CLI tool that creates the tests project for the Web, the API & the Mobile (iOS & Android) App / Browser. Runs various things like GeckoDriver, ChromeDriver & Appium internally for various stacks, browsers & modes.
$ npm install -g ga-wdio
conf/
which contains configuration files for running the tests accroding
to usage i.e. in cloud or local browsers.src/
folder is the main folder where the project's source files are located, which
contains subfolders.storage/
folder contains video, screenshots and log files which are generated according to
sessionId(storage folder is generated only after a test has been runned).├── conf
│ ├── browser-stack.conf.js
│ ├── chrome-headless.conf.js
│ ├── chrome.conf.js
│ ├── gecko-headless.conf.js
│ ├── gecko.conf.js
│ └── local.conf.js
├── src
│ ├── commons
│ ├── repo
│ ├── tests
│ ├── vendor
│ └── xpaths
└── storage
└── session_<Session-Number>
Based on Page Object Model, meaning it is based on page by page test execution & therefore we have divided things into sub-folders for easy test management.
/src/
which contains all the necessary files for the boilerplate, and
this folder contains directories like constants, containers & libraries.src/api.js
file is the main app our runner looks for fetching all the necessary
configurations & list of API(s) details.src/constants/
folder is the main folder where the project's source configurations are
located.src/containers/
folder keeps containers, meaning all of the APIs.src/libraries/
folder will have all the helper modules & store details files.└── src
├── constants
│ └── index.js
├── containers
│ └── employee (sample)
│ ├── index.js (sample)
│ ├── list.js (sample)
│ └── single.js (sample)
├── libraries
│ └── store.js
└── api.js
Based on API Object Model, meaning it is based on API by API test execution & therefore we have divided things into sub-folders for easy test management.
# src/api.js: The API needs two details to execute the tests, and those are domains & apis whereas the store is optional index.
Domains object is actually a key-value paired, where we require default index & you can add more indexes into the same object
api.domains = {
default: "https://geekyants.com/", // DEFAULT index is REQUIRED!
download: "https://dl.geekyants.com/" // OPTIONAL indexes...
};
Apis requires an Array of API container modules that would be tested, and the sequence of apis given would be the sequence of their execution.
api.apis = [
require("path/to/containers/api"),
require("path/to/containers/api")
];
Store
// How it works?
// Step #1: Create a Store (Object returning file if not exists)
// Step #2: Register store into the api.js file
api.store = {
token: undefined // undefined is just a default value!
};
// Step #3: Capture the variable (for eg. token) from response's body
expected.store = {
token: "body.data.jwtToken"
};
// Step #4: How to use the store variable now?
//
// I am using the token in the headers of index API below & to access
// that token you have to use special syntax ie. [<index-name>].
// Note: token is same as given in the Step #2 while registering the API app.
index.headers = {
"Content-Type": "application/json",
"Authorization": "Bearer [token]"
};
# src/containers/your-api-name.js:
Index | Is Required | Comment |
---|---|---|
name | No | Name of your API, just for the reporting purpose |
domain | No | Domain for your API, incase you don't provide this index we will use the default domain given in api.domains |
uri | Yes | URI for the API request |
method | Yes | The HTTP protocol method for the API |
query | No | Can be used only with the GET/HEAD method request |
body | No | Can be used only with the POST/PUT/PATCH method request |
timeout | No | Max API request timeout |
headers | No | Request headers that would override our default request headers |
expected | No | To check the response with the expected set of rules |
expected.headers | No | To check the response's headers & their value |
expected.body | No | To check the response's body indexes |
expected.store | No | To store something from the response's body into the store that you can use in other API |
/src/
which contains all the necessary files for the boilerplate, and
this folder contains directories like common, helpers, test & xpath.src/common
directory contains all the logic that is requires for a specific component or
page.src/helpers
directory contains reusable functions / modules.src/test
directory contains all the test cases.src/xpath
directory contains the xpaths for the different kinds of platform & this is why
we have added three more directories into it.src/xpath/web
contains the web xpathssrc/xpath/ios
contains the ios xpathssrc/xpath/android
contains the android xpaths├── conf
├── src
│ ├── common
│ ├── helpers
│ ├── test
│ └── xpath
│ ├── android
│ ├── ios
│ ├── web
│ └── index.js
├── store
└── .env
$ ga-wdio create --help
# Usage: create [options]
# Creates the boilerplate in the present directory
# Options:
# -h, --help output usage information
# Examples:
# ga-wdio create
$ ga-wdio run:web --help
# Usage: run [options]
# Runs the testing scripts with the options / stacks specified
# Options:
# -s, --stack <local> <browser-stack> <browser-stack-local> runs your tests on the local system or browser-stack (default: "local")
# -b, --browser <chrome> <firefox> web browser [chrome or firefox] (default: "chrome")
# -m, --mode [headless] sets the mode to run web-browser [for local only] (default: "head")
# -h, --help output usage information
# Examples:
# ga-wdio run . # Imp Note: This command will set all the default values
# ga-wdio run --stack=local --browser=chrome --mode=headless
# ga-wdio run --stack=browser-stack --browser=firefox
$ ga-wdio run:api --help
# Usage: run:api [options]
# [For API] Runs the testing scripts with the options specified
# Options:
# -h, --help output usage information
# Examples:
# ga-wdio run:api
$ ga-wdio run:ios --help
# Usage: run:ios [options]
# [For Mobile] Runs the testing scripts on iOS platform
# Options:
# -b, --browser <true> enables the mobile's browser testing (default: "false")
# -s, --stack <browser-stack> runs your tests on environments like browser-stack/local simulator
# -h, --help output usage information
# Examples:
# ga-wdio run:ios # Imp Note: This command will set all the default values
# ga-wdio run:ios --browser=true
# ga-wdio run:ios --stack=browser-stack
$ ga-wdio run:android --help
# Usage: run:android [options]
# [For Mobile] Runs the testing scripts on Android platform
# Options:
# -b, --browser <true> enables the mobile's browser testing (default: "false")
# -s, --stack <browser-stack> runs your tests on environments like browser-stack or local simulator (default: "local")
# -h, --help output usage information
# Examples:
# ga-wdio run:android # Imp Note: This command will set all the default values
# ga-wdio run:android --browser=true
# ga-wdio run:android --stack=browser-stack
$ ga-wdio check:appium --help
# Usage: check:appium [options]
# [For Mobile] Checks the necessary & optional dependencies for appium
# Options:
# -h, --help output usage information
$ ga-wdio upload:app --help
# Usage: upload:app [options]
# Returns: app_url, custom_id & shareable_id
# Uploads IPA or APK file to browser stack & returns the app url with custom ID
# Options:
# -f, --file </path/to/file> runs your tests on the local system or browser-stack
# -u, --username <username> browser-stack username
# -p, --password <password> browser-stack password
# -c, --customId <MyApp> your custom ID for the app
# -h, --help output usage information
# Examples:
# ga-wdio upload:app --file=/path/to/file --username=faizahmed --password=somethingsecret --customId=MyApp
GA WDIO is MIT licensed, as found in the LICENSE file.
Version currently being supported with security updates.
Version | Supported |
---|---|
1.3.4 | ✔ |
<= 1.3.3 | ✖️ |
To create a vulnerability report please use the common issues template & if you want to reach out to me directly please feel to contact me @ faiz@geekyants.com.