{ "info": { "author": "Jonathan Griffin", "author_email": "jgriffin@mozilla.com", "bugtrack_url": null, "classifiers": [], "description": "Introduction\n============\n\nGaiatest is a Python package based on\n[Marionette](https://developer.mozilla.org/en-US/docs/Marionette), which is\ndesigned specifically for writing tests against\n[Gaia](https://github.com/mozilla-b2g/gaia).\n\nPrerequisites\n=============\n\nYou will need a\n[Marionette enabled Firefox build](https://developer.mozilla.org/en-US/docs/Marionette/Builds)\nthat you can\n[successfully connect to](https://developer.mozilla.org/en-US/docs/Marionette/Connecting_to_B2G).\n\nInstallation\n============\n\nIf you only want to run the tests without developing gaia-ui-tests further:\n\n pip install gaiatest\n\nor\n\n easy_install gaiatest\n\nYou can now skip down to the \"Risks\" section. On the other hand, if you want to\nmodify gaia-ui-tests, do this instead:\n\n git clone https://github.com/mozilla-b2g/gaia.git\n\nThe next command will install several python packages on your system such as\nmarionette, gaiatest, and other Mozilla packages. Before you run\n`python setup.py develop`, consider setting-up a virtual environment. This is\nentirely optional.\n\n virtualenv env_name\n source env_name/bin/activate\n\nWith the virtual environment activated, the python packages will be installed\nunder the `env_name` folder instead of disturbing your main system.\n\nFinally, do:\n\n cd gaia/tests/python/gaia-ui-tests\n python setup.py develop\n\nRisks\n=====\n\nPlease visit\n[this page](https://developer.mozilla.org/en-US/docs/Gaia_Test_Runner)\nto understand and acknowledge the risks involved when running these tests.\nYou have to modify your testvars.json file (see the **Test Variables** section \nbelow,) showing your acknowledgement of the risks, to run the tests.\n\nCommand line interface\n======================\n\nA helpful command line tool is provided for interacting with Gaia. For full\nusage details run `gcli --help` and for help on a specific command use `gcli\n --help`.\n\nFor example, to unlock the device, set brightness to 100%, connect to an\nunsecured network, and launch the Settings app:\n\n```bash\n$ gcli unlock\n$ gcli setsetting screen.brightness 1\n$ gcli connectwifi MozillaGuest\n$ gcli launchapp Settings\n```\n\nRunning Tests\n=============\n\nTo run tests using gaia test, your command-line will vary a little bit\ndepending on what device you're using. The general format is:\n\n gaiatest [options] /path/to/test_foo.py\n\nOptions:\n\n --emulator arm --homedir /path/to/emulator: use these options to\n let Marionette launch an emulator for you in which to run a test\n --address : use this option to run a test on an emulator\n which you've manually launched yourself, a real device, or a b2g\n desktop build. If you've used port forwarding as described below,\n you'd specify --address localhost:2828\n --testvars= (see the Test Variables section below)\n --restart restart target instance between tests. This option will remove \n the /data/local/indexedDB and /data/b2g/mozilla folders and restore the \n device back to a common state\n --yocto gather power draw data while running tests \n (see https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Platform/Automated_testing/gaia-ui-tests/Gaia_UI_Tests_Run_Tests#Gathering_Power_Draw_Data)\n --timeout < time in milliseconds > to set default timeout values (30s for page load timeout, \n 10s for search timeout and 10s for script timeout) to a common specified value\n\nTesting on a Device\n===================\n\nYou must run a build of B2G on the device that has Marionette enabled.\nThe easiest way to do that is to grab a nightly `eng` build, like\n[this one for Unagi](https://pvtbuilds.mozilla.org/pub/mozilla.org/b2g/nightly/mozilla-b2g18-unagi-eng/latest/)\n(currently it requires a Mozilla LDAP login). Flash that to your device.\n\nYou should not enable Remote Debugging manually on the device because\nthere will be competing debuggers. See\n[bug 764913](https://bugzilla.mozilla.org/show_bug.cgi?id=764913).\n\nIf you are running the tests on a device connected via ADB (Android Debug\nBridge), you must additionally set up port forwarding from the device to your\nlocal machine. You can do this by running the command:\n\n adb forward tcp:2828 tcp:2828\n\nADB is available in emulator packages under out/host/linux\\_x86/bin.\nAlternatively, it may be downloaded as part of the\n[Android SDK](http://developer.android.com/sdk/index.html).\n\nTesting on Desktop build\n========================\n\nYou can download the latest build of the desktop client from\n[this location](http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-central),\nbut make sure you download the appropriate file for your operating system.\n\n* **Linux (32bit)**: b2g-[VERSION].multi.linux-i686.tar.bz2\n* **Linux (64bit)**: b2g-[VERSION].multi.linux-x86\\_64.tar.bz2\n* **Mac**: b2g-[VERSION].multi.mac64.dmg\n* **Windows**: b2g-[VERSION].multi.win32.zip\n\nOnce downloaded, you will need to extract the contents to a local folder.\n$B2G\\_HOME refers to the location of the local folder for the remainder of the\ndocumentation.\n\nIf a profile is specified when running the tests (recommended), a clone of the\nprofile will be used. This helps to ensure that all tests run in a clean state.\nHowever, if you also intend to launch and interact with the desktop build\nmanually, we recommend making a copy of the default profile and using the copy\nfor your tests. The location of the default profile is $B2G\\_HOME/gaia/profile.\n\nTo run the tests, use the following command:\n\n gaiatest --restart --type=b2g --app=b2gdesktop \\\n --binary=$B2G_HOME/b2g-bin \\\n --profile=$B2G_HOME/gaia/profile \\\n --testvars=path/to/filename.json \\\n gaia/tests/python/gaia-ui-tests/gaiatest/tests/manifest.ini \\\n\nYou should then start to see the tests running. The next two sections provide\ndetails on the test types used in the `--type` option and the test variables for\nthe `--testvars` option respectively.\n\nTest Types\n==========\nTests can be filtered by type, and the types are defined in the manifest files.\nTests can belong to multiple types, some types imply others, and some are\nmutually exclusive - for example a test cannot be both 'online' and 'offline'\nbut a test that is 'lan' is by definition 'online'. Be warned that despite these\nrules, there is no error checking on types, so you must take care when assigning\nthem. Default types are set in the [DEFAULT] section of a manifest file, and are\ninherited by manifest files referenced by an include.\n\nHere is a list of the types used, and when to use them:\n\n* b2g - this means the test is a B2G (Firefox OS) test. All tests must include\n this type.\n* antenna - these tests require an antenna (headphones) to be connected.\n* bluetooth - requires bluetooth to be available.\n* camera - these tests require use of a camera.\n* carrier - an active SIM card with carrier connection is required.\n* lan - a local area connection (not cell data) is required by these tests (see\n note below).\n* offline - specifically requires no online connection.\n* online - some sort of online connection (lan or carrier) is required.\n* qemu - these tests require the Firefox OS emulator to run.\n* sdcard - a storage device must be present.\n* wifi - this means a WiFi connection is required.\n\nYou may be thinking that there is only WiFi or cell data, and why the need for\nthe 'lan' test type. Well, these tests aren't only run on mobile devices... We\nalso run then on single-board computers known as\n[pandaboards](https://en.wikipedia.org/wiki/Panda_Board), which have an ethernet\nport, and on desktop builds, which share the host computer's connection. It is\nfor this reason that we need 'lan' to indicate a connection that is not cell\ndata. For an example of where online/lan/carrier are used take a look at the\nbrowser tests.\n\nTest Variables\n==============\nWe use the --testvars option to pass in local variables, particularly those that\ncannot be checked into the repository. For example in gaia-ui-tests these\nvariables can be your private login credentials, phone number or details of your\nWiFi connection.\n\nTo use it, copy\n`gaia/tests/python/gaia-ui-tests/gaiatest/testvars_template.json` to a different\nfilename but add it into .gitignore so you don't check it into your repository.\n\nWhen running your tests add the argument:\n --testvars=(filename).json\n\nVariables:\n\n`\"carrier\": {} (dict)` The carrier information of the test phone. This contains\nthe phone number, country and network of the SIM card.\n\n```\n\"carrier\":{\n \"phone_number\": \"\",\n \"country\": \"\",\n \"network\": \"\"\n}\n```\n`\"imei\": \"\" (string)` The 12 digit IMEI code of the test phone.\n`\"remote_phone_number\": \"\" (string)` A phone number that your device can call\nduring the tests (try not to be a nuisance!). Prefix the number with '+' and\nyour international dialing code.\n`\"wifi\":{}{ (dict)` This are the settings of your WiFi connection. Currently\nthis supports WPA/WEP/etc. You can add WiFi networks by doing the following\n(remember to replace \"KeyManagement\" and \"wep\" with the value your network\nsupports) :\n\n```\n\"wifi\": {\n \"ssid\": \"MyNetwork\",\n \"keyManagement\": \"WEP\",\n \"wep\": \"MyPassword\"\n}\n```\n\nWPA-PSK:\n```\n\"wifi\": {\n \"ssid\": \"MyNetwork\",\n \"keyManagement\": \"WPA-PSK\",\n \"psk\": \"MyPassword\"\n}\n```\n__Note__: Due to [Bug 775499](http://bugzil.la/775499), WiFi connections via\nWPA-EAP are not capable at this time.\n\n`\"email\": {} (dict)` The email login information used by the email tests. It can\ncontain different types of email accounts:\n\nGmail:\n```\n\"gmail\": {\n \"name\": \"\",\n \"email\": \"\",\n \"password\": \"\"\n }\n```\n\nOr different email protocols:\n```\n\"IMAP\": {\n \"name\": \"\",\n \"email\": \"\",\n \"password\": \"\",\n \"imap_hostname\": \"\",\n \"imap_name\": \"\",\n \"imap_port\": \"\",\n \"smtp_hostname\": \"\",\n \"smtp_name\": \"\",\n \"smtp_port\": \"\"\n}\n```\nOr:\n```\n\"ActiveSync\":{\n \"name\": \"\",\n \"email\": \"\",\n \"password\": \"\",\n \"active_sync_hostname\": \"\",\n \"active_sync_username\": \"\"\n}\n```\n`\"settings\": {} (dict)` Custom settings to override the Gaia default settings.\nThese will be set before each test run but are not mandatory.\n```\n\"settings:{\n \"\":\n}\"\n```\n__Note__: When running with no SIM card or offline the timezone may not be automatically updated to match the local timezone. In that case you may need to force the timezone to match the desired timezone using settings in testvars.json which will set it during the test setUp:\n\n```\n\"settings:{\n \"time.timezone\": ,\n \"time.timezone.user-selected\": \n}\"\n```\n\n\nDon't forget to acknowledged risks in your testvars file after you have visited\n[the Risks page](https://developer.mozilla.org/en-US/docs/Gaia_Test_Runner) to\nunderstand and acknowledge the risks involved when running these tests, or the\ntests will not be run.\n\nTest data Prerequisites\n=======================\n\nOccasionally a test will need data on the hardware that cannot be set during the\ntest setUp. The following tests need data set up before they can be run\nsuccessfully:\n\n`test_ftu` Requires a single record/contact saved onto the SIM card to test the\nSIM contact import\n\n\nWriting Tests\n=============\n\nTest writing for Marionette Python tests is described at\nhttps://developer.mozilla.org/en-US/docs/Marionette/Marionette_Python_Tests.\n\nAdditionally, gaiatest exposes some API's for managing Gaia's lockscreen and\napplication manager. See\nhttps://github.com/mozilla-b2g/gaia/blob/master/tests/python/gaiatest/gaia_test.py.\n\nAt the moment we don't have a specific style guide. Please follow the\nprevailing style of the existing tests. Use them as a template for writing\nyour tests.\nWe follow [PEP8](http://www.python.org/dev/peps/pep-0008/) for formatting,\nalthough we're pretty lenient on the 80-character line length.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://developer.mozilla.org/en-US/docs/Marionette", "keywords": "mozilla", "license": "MPL", "maintainer": null, "maintainer_email": null, "name": "gaiatest-v1.3", "package_url": "https://pypi.org/project/gaiatest-v1.3/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/gaiatest-v1.3/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://developer.mozilla.org/en-US/docs/Marionette" }, "release_url": "https://pypi.org/project/gaiatest-v1.3/0.2/", "requires_dist": null, "requires_python": null, "summary": "Marionette test automation client for Gaia", "version": "0.2" }, "last_serial": 3413841, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "595d61652b243330fd9b3819422df61d", "sha256": "d7bf207c494d93caf3707f4ce49e14bc7fa193e4ffbebcf150fb1ba750244517" }, "downloads": -1, "filename": "gaiatest-v1.3-0.1.tar.gz", "has_sig": false, "md5_digest": "595d61652b243330fd9b3819422df61d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2848251, "upload_time": "2014-06-06T14:30:18", "url": "https://files.pythonhosted.org/packages/ae/18/995136156b5c5a4b6e3607bb25e08c03080c7e3d5d6ef49fa4517d538baa/gaiatest-v1.3-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "1f5619470bb7e866c635006386208a1e", "sha256": "da8a038855303f249d87b1c9228269417a21aff247ed79bd479b51483f94f25e" }, "downloads": -1, "filename": "gaiatest-v1.3-0.2.tar.gz", "has_sig": false, "md5_digest": "1f5619470bb7e866c635006386208a1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2848073, "upload_time": "2014-06-26T11:33:34", "url": "https://files.pythonhosted.org/packages/15/43/829d279ee6bfee1d45bb3b176b2d946f17a5d4db30aa851dbe0d069ce8c1/gaiatest-v1.3-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1f5619470bb7e866c635006386208a1e", "sha256": "da8a038855303f249d87b1c9228269417a21aff247ed79bd479b51483f94f25e" }, "downloads": -1, "filename": "gaiatest-v1.3-0.2.tar.gz", "has_sig": false, "md5_digest": "1f5619470bb7e866c635006386208a1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2848073, "upload_time": "2014-06-26T11:33:34", "url": "https://files.pythonhosted.org/packages/15/43/829d279ee6bfee1d45bb3b176b2d946f17a5d4db30aa851dbe0d069ce8c1/gaiatest-v1.3-0.2.tar.gz" } ] }