Metadata-Version: 2.4
Name: pytest-html-nova-act
Version: 1.0.2
Summary: A Pytest Plugin for Amazon Nova Act Python SDK.
Author-email: Pytest Html Plugin for Amazon Nova Act <nova-act@amazon.com>
License-Expression: Apache-2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: setuptools; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Dynamic: license-file

# pytest-html-nova-act

pytest-html-nova-act is a [pytest](https://pytest.org) plugin that integrates HTML test reporting with [Amazon Nova Act SDK](https://github.com/aws/nova-act) capabilities. This plugin enhances [pytest-html](https://pytest-html.readthedocs.io) reports by adding Nova Act-specific features and metadata.

# Usage

## Requirements

- Python 3.11+
- pytest 8.0+
- pytest-html 4.0+
- nova-act 1.0+
- Nova Act API key
    - Visit [Nova Act home page](https://nova.amazon.com/act) to generate your API key and set it to the `NOVA_ACT_API_KEY` environment variable

## Installation

Install via pip:

```bash
pip install nova-act pytest pytest-html pytest-html-nova-act
```

## Configuration

Add to `pytest.ini`:

```
[pytest]
addopts = --html=reports/report.html --self-contained-html --add-nova-act-report
```

## Pytest Example

The below sample code shows how to create a pytest fixture which instantiates the Nova Act client, starts it, and stops it after the test completes. It also includes an example test.

```python
import pytest
from nova_act import NovaAct, BOOL_SCHEMA

@pytest.fixture()
def nova_session():
    nova = NovaAct(
        starting_page="https://nova.amazon.com/act",
        headless=True
    )
    nova.start()
    yield nova
    nova.stop()

def test_example(nova_session):
    nova_session.act("Click learn more")
    expected = True
    result = nova_session.act("Am I on the Amazon AGI Labs page?", schema=BOOL_SCHEMA)
    actual = result.matches_schema and result.parsed_response
    assert expected == actual
```

## Usage

```bash
pytest
```

Running the `pytest` command in a valid pytest project and using the pytest configuration and sample code mentioned above will result in:

1. Run tests using Nova Act
2. Embed Nova Act SDK logs and screenshots in the `pytest-html` report file in `reports/report.html`

## Resources

- [Amazon Nova Act SDK](https://github.com/aws/nova-act)
