Metadata-Version: 2.1
Name: wopee_rf
Version: 2.7.3
Summary: Robot Framework visual testing library by Wopee.io — AI-powered autonomous test maintenance
Home-page: https://docs.wopee.io/robot-framework/
Keywords: robot framework,visual testing,visual regression,wopee,wopee.io,test automation,autonomous testing,ai testing
Author: Marcel Veselka
Author-email: help@wopee.io
Requires-Python: >=3.11,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Robot Framework
Classifier: Framework :: Robot Framework :: Library
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Requires-Dist: pydantic (>=2.8.2,<3.0.0)
Requires-Dist: pydantic-settings (>=2.4.0,<3.0.0)
Requires-Dist: python-dotenv (>=0.21.0)
Requires-Dist: robotframework (>=7.0)
Requires-Dist: wopee-sdk (>=1.2.1,<2.0.0)
Project-URL: Documentation, https://docs.wopee.io/robot-framework/
Description-Content-Type: text/markdown

# Wopee.io Visual Testing for Robot Framework

`wopee_rf` adds visual testing to your [Robot Framework](https://robotframework.org/) tests. Your test takes a screenshot at the steps you choose, [Wopee.io](https://wopee.io) compares it with the approved baseline, and you review the differences in [Commander](https://cmd.wopee.io).

The full guide is at [docs.wopee.io/robot-framework](https://docs.wopee.io/robot-framework/01-getting-started/).

## Install

Python 3.11 or newer:

```bash
pip install wopee_rf robotframework robotframework-browser
rfbrowser init chromium
```

For SeleniumLibrary, install `robotframework-seleniumlibrary` instead of `robotframework-browser`.

## Configure

Create a `.env` file next to your tests folder. Copy the URL, project UUID and API key from **More › Settings › API Keys** in Commander:

```bash
WOPEE_API_URL=https://api.wopee.io
WOPEE_PROJECT_UUID=your-project-uuid
WOPEE_API_KEY=your-api-key
WOPEE_SCREENSHOT_VALIDATION_ENABLED=true
WOPEE_DRIVER_LIBRARY=BrowserLibrary
```

Both last lines are required: without them nothing is sent to Wopee.io. Use `WOPEE_DRIVER_LIBRARY=SeleniumLibrary` for Selenium tests.

## Write a test

`tests/saucedemo.robot`:

```robotframework
*** Settings ***
Library     Browser
Library     wopee_rf.Standalone    dot_env_path=.env

Test Setup       New Page    https://www.saucedemo.com
Test Teardown    Stop Scenario

*** Variables ***
${USER}     standard_user
${SUITE}    Robot Framework demo ${{datetime.datetime.now().strftime('%Y-%m-%d %H:%M')}}

*** Test Cases ***
Login And Products
    Start Suite       suite_name=${SUITE}
    Start Scenario    scenario_name=Robot Framework: login and products
    ${login}=    Track Fullpage    step_name=Login page
    Fill Text    id=user-name    ${USER}
    Fill Text    id=password     secret_sauce
    Click        id=login-button
    Wait For Elements State    css=.inventory_list    visible
    ${products}=    Track Fullpage    step_name=Products
    Log To Console    \nLogin page: ${login.status} | Products: ${products.status}
```

Run it from the folder that holds `.env`:

```bash
robot -d reports tests/
```

The first run creates the baselines (status `new`). Approve them in **Runs** in Commander; later runs report `ok` or `unresolved`.

All keywords take named arguments only: `step_name=Login page`, not `Login page`.

## Keywords and listener

| Keyword          | What it does                                                    |
| ---------------- | --------------------------------------------------------------- |
| `Start Suite`    | Starts a run in Commander.                                      |
| `Start Scenario` | Starts a scenario that groups the screenshots of one test.      |
| `Track Fullpage` | Takes a full-page screenshot and compares it with the baseline. |
| `Track Viewport` | Takes a screenshot of the visible area and compares it.         |
| `Track`          | Compares a PNG image you pass in as base64.                     |
| `Stop Scenario`  | Finishes the scenario. Put it in `Test Teardown`.               |

To add visual testing to existing tests without changing them, run them with the listener `wopee_rf.Listener` and list the keywords to screenshot after in `WOPEE_TRACKED_KEYWORDS`:

```bash
WOPEE_TRACKED_KEYWORDS="Browser.New Page;Browser.Click" \
  robot -d reports --listener 'wopee_rf.Listener:dot_env_path=.env' tests/existing_test.robot
```

## Documentation

- [Getting started](https://docs.wopee.io/robot-framework/01-getting-started/): the complete example, step by step
- [Configuration and listener](https://docs.wopee.io/robot-framework/02-manual-setup/): all settings, the listener, SeleniumLibrary, branches, CI and troubleshooting
- [Template project](https://docs.wopee.io/robot-framework/03-setup-with-make/): start from a ready repository
- [Examples](https://docs.wopee.io/robot-framework/04-some-more-examples/): more tracking parameters, viewport screenshots, mobile apps and PDF documents

