2015-06-18 23:10:20 +03:00
|
|
|
Firefox Accounts Page Object Model
|
|
|
|
==================================
|
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
`Selenium WebDriver <http://docs.seleniumhq.org/docs/03_webdriver.jsp>`_
|
|
|
|
compatible page-object model and utilities for
|
|
|
|
`Firefox Accounts <https://accounts.firefox.com>`_
|
2015-06-18 23:10:20 +03:00
|
|
|
|
|
|
|
.. image:: https://img.shields.io/pypi/l/fxapom.svg
|
2017-12-07 13:31:34 +03:00
|
|
|
:target: https://github.com/mozilla/fxapom/blob/master/LICENSE.txt
|
2015-06-18 23:10:20 +03:00
|
|
|
:alt: License
|
|
|
|
.. image:: https://img.shields.io/pypi/v/fxapom.svg
|
|
|
|
:target: https://pypi.python.org/pypi/fxapom/
|
|
|
|
:alt: PyPI
|
|
|
|
.. image:: https://img.shields.io/travis/mozilla/fxapom.svg
|
|
|
|
:target: https://travis-ci.org/mozilla/fxapom/
|
|
|
|
:alt: Travis
|
|
|
|
.. image:: https://img.shields.io/github/issues-raw/mozilla/fxapom.svg
|
|
|
|
:target: https://github.com/mozilla/fxapom/issues
|
|
|
|
:alt: Issues
|
2017-01-07 12:36:40 +03:00
|
|
|
.. image:: https://pyup.io/repos/github/mozilla/fxapom/shield.svg
|
|
|
|
:target: https://pyup.io/repos/github/mozilla/fxapom/
|
|
|
|
:alt: Updates
|
|
|
|
.. image:: https://pyup.io/repos/github/mozilla/fxapom/python-3-shield.svg
|
|
|
|
:target: https://pyup.io/repos/github/mozilla/fxapom/
|
|
|
|
:alt: Python 3
|
2015-06-18 23:10:20 +03:00
|
|
|
|
|
|
|
Overview
|
|
|
|
--------
|
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
This package contains a utility to create a test Firefox Account on either the
|
|
|
|
dev or prod instance of Firefox Accounts, as well as a set of page objects that
|
|
|
|
can be used to interact with Firefox Accounts' sign in screens.
|
2015-06-18 23:10:20 +03:00
|
|
|
|
2016-02-05 16:37:48 +03:00
|
|
|
Installation
|
|
|
|
------------
|
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
To install FxAPOM:
|
2016-02-05 16:37:48 +03:00
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
.. code-block:: bash
|
2016-02-05 16:37:48 +03:00
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
$ pip install fxapom
|
2016-02-05 16:37:48 +03:00
|
|
|
|
2015-06-18 23:10:20 +03:00
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
To create a test Firefox Account, simply create an instance of the
|
|
|
|
``FxATestAccount`` object. You can pass the url for the Firefox Accounts API
|
|
|
|
server into the constructor or, if you know you want to create a development
|
|
|
|
Account, you can omit that argument.
|
2015-06-18 23:10:20 +03:00
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
There are two constants available to you to specify the url for either the
|
|
|
|
development environment or the production environment, which are:
|
2015-06-18 23:10:20 +03:00
|
|
|
|
|
|
|
* ``fxapom.DEV_URL`` - the url for the development environment
|
|
|
|
* ``fxapom.PROD_URL`` - the url for the production environment
|
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
Example of creating an account on the development environment, using the
|
|
|
|
default:
|
2015-06-18 23:10:20 +03:00
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
from fxapom.fxapom import FxATestAccount
|
2015-07-21 17:58:50 +03:00
|
|
|
account = FxATestAccount()
|
2015-06-18 23:10:20 +03:00
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
Example of creating an account on the development environment, specifying the
|
|
|
|
``DEV_URL``:
|
2015-06-18 23:10:20 +03:00
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
from fxapom.fxapom import DEV_URL, FxATestAccount
|
2015-07-21 17:58:50 +03:00
|
|
|
account = FxATestAccount(DEV_URL)
|
2015-06-18 23:10:20 +03:00
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
To sign in via Firefox Accounts, use the ``sign_in`` method in the
|
|
|
|
``WebDriverFxA`` object, passing in the email address and password:
|
2015-06-18 23:10:20 +03:00
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
from fxapom.fxapom import WebDriverFxA
|
2017-03-15 03:12:25 +03:00
|
|
|
fxa = WebDriverFxA(selenium)
|
2015-06-18 23:10:20 +03:00
|
|
|
fxa.sign_in(email_address, password)
|
|
|
|
|
2017-03-15 03:12:25 +03:00
|
|
|
Note that we are passing ``selenium`` into the constructor of ``WebDriverFxA``,
|
|
|
|
which it then uses to interact with the Firefox Accounts web pages.
|
2015-06-18 23:10:20 +03:00
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
To create an account and then use it to sign in, use both tools described
|
|
|
|
above:
|
2015-06-18 23:10:20 +03:00
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
from fxapom.fxapom import FxATestAccount, WebDriverFxA
|
2015-07-21 17:58:50 +03:00
|
|
|
account = FxATestAccount()
|
2017-03-15 03:12:25 +03:00
|
|
|
fxa = WebDriverFxA(selenium)
|
2015-07-21 17:58:50 +03:00
|
|
|
fxa.sign_in(account.email, account.password)
|
2015-06-18 23:10:20 +03:00
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
Contributing
|
|
|
|
------------
|
2015-06-18 23:10:20 +03:00
|
|
|
|
2017-10-23 18:50:41 +03:00
|
|
|
Fork the repository and submit PRs with bug fixes and enhancements,
|
|
|
|
contributions are very welcome. Tests can be run locally with
|
|
|
|
`tox <http://tox.readthedocs.io/en/latest/>`_.
|
2015-06-18 23:10:20 +03:00
|
|
|
|
2016-07-15 18:04:06 +03:00
|
|
|
Resources
|
|
|
|
---------
|
2015-06-18 23:10:20 +03:00
|
|
|
|
2016-07-15 18:04:06 +03:00
|
|
|
- `Release Notes <http://github.com/mozilla/fxapom/blob/master/CHANGES.rst>`_
|
|
|
|
- `Issue Tracker <http://github.com/mozilla/fxapom/issues>`_
|
|
|
|
- `Code <http://github.com/mozilla/fxapom/>`_
|