> ## Documentation Index
> Fetch the complete documentation index at: https://docs.optexity.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Supabase Login Example

> Automating Supabase login and verifying the login was successful

Optexity can be used for any QA testing scenario. This example shows how to automate the Supabase login and verify the login was successful.

The automation:

* **Opens** the Supabase site
* **Fills** the email and password
* **Submits** the form and **verifies** the login was successful

Before starting, please look at the [Quickstart](/docs/building-automations/quickstart) guide to understand the basics of the optexity platform.

***

### Part 1: Record the base workflow

1. Go to the Supabase site and **record** a workflow that:
   * Navigates to the login page
   * Fills in the email and password
   * Submits the form and verifies the login was successful

2. After saving, you will see an `supabase_login` automation in your dashboard that contains only the **interaction actions** (clicks, fills, selects).
   We have also built this automation by default and you can find it in your dashboard.

<img src="https://mintcdn.com/optexity-c5be9f59/9YFafnW5H5KMxj_s/images/supabase_workflow.png?fit=max&auto=format&n=9YFafnW5H5KMxj_s&q=85&s=6add81032d9d99d340488236adf151f9" alt="Supabase Login Automation" width="2418" height="126" data-path="images/supabase_workflow.png" />

***

### Part 2: Refine the automation

Recording captures clicks and inputs, but you still need to:

* **Tighten** some interaction instructions
* **Add** a assertion action to verify the login was successful

#### 2.1. Add a assertion action to verify the login was successful

To verify the login was successful, add an `assertion_action` that verifies the login was successful:

```json theme={null}
{
    "assertion_action": {
        "assertion_action": {
            "llm": {
                "extraction_instructions": "Verify the login was successful"
            }
        }
    }
}
```

Adding this assertion action will verify the login was successful by checking for the dashboard elements or welcome message.

***

### Part 3: Run the `supabase_login` automation via inference

For a detailed explanation of the inference server, see the **Quickstart** guide. Below is the minimal flow to run this example.

#### 3.1. Start the inference server

From the project root:

```bash theme={null}
ENV_PATH=.env python optexity/inference/child_process.py --port 9000 --child_process_id 0
```

#### 3.2. Invoke the `supabase_login` endpoint

You can call the `supabase_login` automation via the `/inference` endpoint:

```bash theme={null}
curl -X POST http://localhost:9000/inference \
  -H "Content-Type: application/json" \
  -d '{
    "endpoint_name": "supabase_login",
    "input_parameters": {
      "username": ["test@test.com"],
      "password": ["password"]
    },
    "unique_parameter_names": []
  }'
```

While the request runs, the browser will execute the steps on your behalf. When the run finishes, you can:

* Inspect the **task run** and **assertion result** in the dashboard

You can now add cron or any other scheduling mechanism to run this automation periodically to QA test the website.

***

### Final Automation

```json theme={null}
{
    "url": "https://supabase.com",
    "nodes": [
        {
            "end_sleep_time": 1,
            "interaction_action": {
                "click_element": {
                    "command": "get_by_role(\"link\", name=\"Sign in\")",
                    "prompt_instructions": "Click the Sign in link"
                }
            }
        },
        {
            "end_sleep_time": 1,
            "interaction_action": {
                "input_text": {
                    "command": "get_by_role(\"textbox\", name=\"Email\")",
                    "input_text": "{username[0]}",
                    "prompt_instructions": "Enter the email"
                }
            }
        },
        {
            "end_sleep_time": 1,
            "interaction_action": {
                "input_text": {
                    "command": "get_by_role(\"textbox\", name=\"Password\")",
                    "input_text": "{password[0]}",
                    "prompt_instructions": "Enter the password"
                }
            }
        },
        {
            "end_sleep_time": 1,
            "interaction_action": {
                "click_element": {
                    "command": "get_by_role(\"button\", name=\"Sign In\")",
                    "prompt_instructions": "Click the Sign In button"
                }
            }
        },
        {
            "end_sleep_time": 0,
            "assertion_action": {
                "llm": {
                    "extraction_instructions": "Check if the login was successful"
                }
            }
        }
    ],
    "parameters": {
        "input_parameters": {
            "password": ["password"],
            "username": ["test@test.com"]
        },
        "generated_parameters": {}
    }
}
```
