Selenium WebDriver compatible page-object model and utilities for Firefox Accounts
Перейти к файлу
pyup.io bot 2f44fa6d1a Update pytest-fxa to 1.2.0 (#241)
* Update pytest-fxa from 1.1.0 to 1.2.0

* Update pytest-fxa from 1.1.0 to 1.2.0
2018-06-15 16:02:06 -07:00
fxapom Updated switch_to_window to recent version (#196) 2018-02-16 17:13:49 -08:00
requirements Update pytest-fxa to 1.2.0 (#241) 2018-06-15 16:02:06 -07:00
tests Switch to using pytest-fxa for Firefox Accounts (#227) 2018-04-12 12:16:06 -07:00
.dockerignore Use a docker image to run the tests (#162) 2018-01-10 11:39:13 -08:00
.gitignore Use a docker image to run the tests (#162) 2018-01-10 11:39:13 -08:00
.travis.yml Use a docker image to run the tests (#162) 2018-01-10 11:39:13 -08:00
CHANGES.rst Update release notes for v1.10.1 2017-07-06 15:09:41 +01:00
Dockerfile Update to Firefox 60.0 (#234) 2018-05-08 12:14:05 -07:00
Jenkinsfile Update to Firefox 60.0 in Sauce Labs (#235) 2018-05-10 09:45:28 -07:00
LICENSE.txt Update license (#176) 2017-12-07 10:31:34 +00:00
README.rst Fix typo in README (#187) 2018-01-11 01:41:47 -08:00
setup.py Pin and update PyFxA + PyPOM dependencies 2018-03-21 13:48:35 -07:00
tox.ini Switch to using pytest-fxa for Firefox Accounts (#227) 2018-04-12 12:16:06 -07:00

README.rst

Firefox Accounts Page Object Model
==================================

`Selenium WebDriver <http://docs.seleniumhq.org/docs/03_webdriver.jsp>`_
compatible page-object model and utilities for
`Firefox Accounts <https://accounts.firefox.com>`_

.. image:: https://img.shields.io/pypi/l/fxapom.svg
   :target: https://github.com/mozilla/fxapom/blob/master/LICENSE.txt
   :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
.. 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

Overview
--------

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.

Installation
------------

To install FxAPOM:

.. code-block:: bash

  $ pip install fxapom

Usage
-----

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.

There are two constants available to you to specify the url for either the
development environment or the production environment, which are:

* ``fxapom.DEV_URL`` - the url for the development environment
* ``fxapom.PROD_URL`` - the url for the production environment

Example of creating an account on the development environment, using the
default:

.. code-block:: python

  from fxapom.fxapom import FxATestAccount
  account = FxATestAccount()

Example of creating an account on the development environment, specifying the
``DEV_URL``:

.. code-block:: python

  from fxapom.fxapom import DEV_URL, FxATestAccount
  account = FxATestAccount(DEV_URL)

To sign in via Firefox Accounts, use the ``sign_in`` method in the
``WebDriverFxA`` object, passing in the email address and password:

.. code-block:: python

  from fxapom.fxapom import WebDriverFxA
  fxa = WebDriverFxA(selenium)
  fxa.sign_in(email_address, password)

Note that we are passing ``selenium`` into the constructor of ``WebDriverFxA``,
which it then uses to interact with the Firefox Accounts web pages.

To create an account and then use it to sign in, use both tools described
above:

.. code-block:: python

  from fxapom.fxapom import FxATestAccount, WebDriverFxA
  account = FxATestAccount()
  fxa = WebDriverFxA(selenium)
  fxa.sign_in(account.email, account.password)

Contributing
------------

Fork the repository and submit PRs with bug fixes and enhancements,
contributions are very welcome. You can run the tests using
`Docker <https://www.docker.com/>`_:

.. code-block:: bash

  $ docker build -t fxapom .
  $ docker run -it fxapom tox

Resources
---------

- `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/>`_