Package: nzme-skynet
Skynet - Test Automation Library @NZMEFeatures included:A python3.6+ library to automate web apps and mobile apps across range of browsers and devicesScripts to automate visual testingOut of box integration with cloud testing (e.g. Sauce Labs)Plugin to run REST api callsSupport for BDD scenarios and parallel execution runSupport for Mobile app testing, seeMobile app readmeCapture and manipulate HTTP traffic using browsermob-proxyInstall Skynet package:Install from source.$ git clone <repo>
    $ cd skynet
    $ python setup.py installSetup instructionsInstall pip, web browsers, EmulatorsPython 3.6+DownloadChrome browserandChrome DriverDownload Firefox. Firefox > v.47 requiresMarionettedriverTo verify drivers are workingcheck these instructionsInstallmobile dependenciesor docker solution e.g.Selenoid Android,docker-android(optional) Install Selenium Grid of choice e.g.Zalenium,Selenoid,docker-seleniumetc$ git clone <repo>
  $ cd skynet
  $ python3 -m venv skynet3-env
  $ source skynet3-env/bin/activate
  (skynet3-env) $ pip install -U pip
  (skynet3-env) $ pip install pipenv
  (skynet3-env) $ pipenv sync --devRun TestsYou can run all of the tests viatoxin your local(skynet3-env) $ deactivate
    $ sudo apt install python-tox
    $ toxFor detailed run:Setup test env$ source skynet3-env/bin/activate
    (skynet3-env) $ ./docker_compose.sh start
    (skynet3-env) $ curl -sSL http://localhost:4444/wd/hub/status | jq .value.ready | grep trueRun tests (with coverage)(skynet3-env) $ py.test -vvv --cov=nzme_skynet testTo run all the tests in parallel(skynet3-env) $ py.test -n <no_of_parallel_processes> testTo run individual tests(skynet3-env) $ py.text -q test/<test_name.py>Teardown test env(skynet3-env) $ ./docker_compose.sh stopBDD Test SetupTest setup is managed in a default configuration filetestsetup.iniwhich can be overridden on commandline.#------- Desktop Platforms -------#
[BROWSER]
#- Generic Selenium/Cloud capabilities -#
capabilities =  {
                "browserName": "chrome",
                "version": "ANY",
                "platform": "ANY",
                "goog:chromeOptions" : {
                    "args": ["--disable-gpu"],
                    "extensions": [],
                    "prefs": {}
                    }
                }
#- Framework specific capabilities -#
highlight = true
resolution = maximum # e.g. maximum, 1126x830
headless = false
mobileEmulation = # e.g. iPhone X, Galaxy S5 etc

#------- Mobile Platforms -------#
#- Generic Appium capabilities -#
[ANDROID]
capabilities = {
                "platformName": "Android",
                "platformVersion": "8.1",
                "deviceName": "Device 01"
                "udid": "emulator-5554",
                "appPackage": "appPackage",
                "appActivity": "appActivity",
                "app": "/path/to/my.app"
                }

[IOS]
capabilities = {
                "platformName": "iOS",
                "platformVersion": "11.0",
                "deviceName": "iPhone 7",
                "automationName": "XCUITest",
                "app": "/path/to/my.app"
                }

#------- Environmental -------#
#- Framework specific capabilities -#
[ENVIRONMENT]
testurl=https://www.google.co.nz/
local=true
selenium_grid_hub=http://127.0.0.1:4444/wd/hub
zalenium=falseThe capabilities key is "free-form" selenium/appium/cloud capabilities key-value pair that is passed on to the
framework.For desktop tests, one can remove the sections [Android] and [IOS], similarly for mobile tests
one can remove the section [BROWSER]. The section [ENVIRONMENT] is however mandatory.One can also have separate "testsetup.ini" files for different runs e.g.testsetup_browserstack.iniwith browserstack
specific capabilities only, ortestsetup_android.inifor android tests. This custom .ini can be passed as a
command line parameter for behave tests.(skynet3-env) $ behave -D configfile=testsetup_browserstack.ini --tags=@p1
(skynet3-env) $ behave -D configfile=testsetup_android.ini --tags=@android-app --tags=@p1The capabilities and environment key value options can also be updated on the commandline.(skynet3-env) $ behave -D browserName=firefox -D version=65.0 -D local=true -D headless=true --tags=@p1BDD Parallel Tests Run utilityAllows running BDD tests in parallel, hence saving on execution time.(skynet3-env)$nzme-behave-parallel-h
usage:Runbehaveinparallelmodeforscenarios[-h][--processesPROCESSES][--tagsTAGS][--defineDEFINE]optionalarguments:-h,--helpshowthishelpmessageandexit--processesPROCESSES,-pPROCESSESMaximumnumberofprocesses.Default=5--tagsTAGS,-tTAGSspecifybehavetagstorun--defineDEFINE,-DDEFINEDefineuser-specificdatafortheconfig.userdatadictionary.Example:-Dfoo=bartostoreitinconfig.userdata["foo"].E.g. to run 4 scenarios in parallel based on tags and override test configuration(skynet3-env)$nzme-behave-parallel-p4-tprod-Dlocal=false-DbrowserName=firefoxSupported Tags for use with BehaveWe use Behave as our BDD Runner, while skynet does not require you to use it, it does have some extra support built in.
You can tag the scenarios/feature files with the following platform tags to initialise appropriate driver.If no platform tag is specified, then the default platform of web/browser is used.@api
@android-app
@android-browser
@ios-app
@ios-browser