Metadata-Version: 2.4
Name: proxymail-qa
Version: 1.0.0
Summary: Test inboxes for sign-up, login and password-reset tests in Python: make a test address, then wait for the code or link from the email.
Author: Sidequest Explorers Inc
License-Expression: MIT
Project-URL: Homepage, https://proxymail.qa
Project-URL: Documentation, https://proxymail.qa/docs/python
Project-URL: Changelog, https://proxymail.qa/changelog
Project-URL: Issues, https://proxymail.qa/support
Keywords: email testing,otp,magic link,test inbox,pytest,selenium,playwright,sign-up testing
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Proxy Mail QA for Python

Test inboxes for sign-up, login and password-reset tests in Python, with pytest and Selenium or Playwright. Make a test address with a realistic test person, sign up with it in your app, then wait for the code or link from the email.

```bash
pip install proxymail-qa
```

It uses only the standard library and runs on Python 3.9 or later.

## A sign-up test

Create an API key in [app.proxymail.qa](https://app.proxymail.qa) → Project settings → API keys, and set it as `PROXYMAIL_QA_API_KEY` where your tests run.

```python
import re

from playwright.sync_api import Page, expect

from proxymail_qa import create_address, delete_address, now, wait_for_link


def test_sign_up_verifies_the_email(page: Page):
    account = create_address()
    page.goto("/signup")
    page.get_by_label("Email").fill(account["address"])
    page.get_by_label("Password").fill(account["password"])

    submitted = now()
    page.get_by_role("button", name="Sign up").click()

    page.goto(wait_for_link(account["address"], since=submitted))
    expect(page).to_have_url(re.compile("verified"))
    delete_address(account["address"])
```

`since` makes the wait ignore anything sent before the form was submitted. `wait_for_code` does the same for a code. The guide covers form values, account pools, checks on an email, two-factor codes and run reports: [proxymail.qa/docs/python](https://proxymail.qa/docs/python).

## Run reports in pytest

To have each call name its test, and failed tests and totals recorded in a run, import the hooks into `conftest.py`:

```python
from proxymail_qa import pytest_runtest_setup, pytest_runtest_teardown, pytest_runtest_logreport, pytest_sessionfinish
```

## Licence

MIT
