SPB Git

Repository Public License

15-browser-data-entry.yaml 5.7 KB 165 lines yaml

1# ORIX OS Automation2# File: Workflows/Examples/15-browser-data-entry.yaml3# Description: Built-in automation: fills a two-page test form in the built-in browser, asks before submitting, and keeps a screenshot as evidence.4#5# Author: Simon-Pierre Boucher6# Contact: contact@spboucher.ai7#8# Limitations9# - Targets a TEST site: by default http://localhost:8765/form.html, which the user serves from the sample folder10#   (`python3 -m http.server 8765 --bind 127.0.0.1` inside it). Only the host named by the `host` parameter can be11#   opened: it is the declared browser permission, and navigation to any other host is blocked by the browser itself.12# - Plain http is accepted for this Mac's loopback addresses only; any other site must be https.13# - The selectors (#name, #email, #next, #plan, #terms, #submit, #result) match the sample pages; another site needs14#   other selectors. One browser session per run: the steps act on the page that is open.15# - Submitting a form is an external action: the workflow always stops for approval first. An unanswered approval leaves16#   the run WAITING_APPROVAL and nothing is submitted (the browser session is closed when the run ends).17# - Do not point this at a real site without reading its terms; no CAPTCHA, login or anti-bot measure is handled or bypassed.18# - The built-in browser is a private WebKit view: it shares no cookies, history or passwords with Safari.19apiVersion: orix.ai/v120kind: Automation21metadata:22  id: browser-data-entry23  name: Multi-step browser data entry on a test site24  description: >-25    Opens a local test form in the built-in browser, fills two pages of fields, asks for approval, submits,26    reads the confirmation, checks that it shows the submitted values and saves a screenshot as evidence.27  tags: [browser, forms, approval, test]28spec:29  triggers:30    - type: manual31  parameters:32    - name: host33      type: string34      default: localhost35      description: The only host the browser may open; it is the declared browser permission.36    - name: pageURL37      type: string38      default: http://${{ params.host }}:8765/form.html39      description: Address of the first page of the test form, on that host.40    - name: fullName41      type: string42      default: Ada Lovelace43      description: Value typed into the name field.44    - name: email45      type: string46      default: ada@example.com47      description: Value typed into the e-mail field.48    - name: plan49      type: string50      default: team51      description: Value chosen in the plan list on the second page (solo, team or company).52    - name: evidenceFolder53      type: path54      default: ~/ORIX Samples/browser-data-entry/Evidence55      description: Folder that receives the confirmation screenshot.56  permissions:57    filesystem:58      read: ["${{ params.evidenceFolder }}"]59      write: ["${{ params.evidenceFolder }}"]60    browser: ["${{ params.host }}"]61  budget:62    maxDurationSeconds: 60063    maxToolCalls: 3064  steps:65    - id: prepare66      tool: filesystem.mkdir67      with:68        path: ${{ params.evidenceFolder }}69    - id: open70      name: Open the form71      tool: browser.open72      with:73        url: ${{ params.pageURL }}74        timeoutSeconds: 3075    - id: formReady76      needs: [open]77      tool: browser.waitFor78      with:79        selector: "#name"80        state: visible81        timeoutSeconds: 1582    - id: fillName83      needs: [formReady]84      tool: browser.fill85      with:86        selector: "#name"87        value: ${{ params.fullName }}88    - id: fillEmail89      needs: [fillName]90      tool: browser.fill91      with:92        selector: "#email"93        value: ${{ params.email }}94    - id: next95      name: Go to the second page96      needs: [fillEmail]97      tool: browser.click98      with:99        selector: "#next"100    - id: detailsReady101      needs: [next]102      tool: browser.waitFor103      with:104        selector: "#plan"105        state: visible106        timeoutSeconds: 15107    - id: choosePlan108      needs: [detailsReady]109      tool: browser.fill110      with:111        selector: "#plan"112        value: ${{ params.plan }}113    - id: acceptTerms114      needs: [choosePlan]115      tool: browser.fill116      with:117        selector: "#terms"118        checked: true119    - id: confirm120      needs: [acceptTerms]121      approval: Submit the form at ${{ params.pageURL }} with name "${{ params.fullName }}", e-mail "${{ params.email }}" and plan "${{ params.plan }}"?122    - id: submit123      needs: [confirm]124      tool: browser.click125      with:126        selector: "#submit"127    - id: confirmation128      needs: [submit]129      tool: browser.waitFor130      with:131        selector: "#result"132        state: visible133        text: ${{ params.fullName }}134        timeoutSeconds: 15135    - id: readResult136      needs: [confirmation]137      tool: browser.read138      with:139        maxBytes: 20000140    - id: screenshot141      needs: [readResult, prepare]142      tool: browser.screenshot143      with:144        path: ${{ params.evidenceFolder }}/confirmation.png145        overwrite: true146    - id: close147      needs: [screenshot]148      tool: browser.close149    - id: check150      needs: [close]151      verify:152        - truthy: ${{ contains(steps.readResult.output.text, params.fullName) }}153        - truthy: ${{ contains(steps.readResult.output.text, params.email) }}154        - truthy: ${{ contains(steps.readResult.output.text, params.plan) }}155        - fileNonEmpty: ${{ params.evidenceFolder }}/confirmation.png156    - id: result157      needs: [check]158      output:159        confirmation: ${{ steps.readResult.output.text }}160        page: ${{ steps.readResult.output.url }}161        screenshot: ${{ params.evidenceFolder }}/confirmation.png162        screenshotSha256: ${{ steps.screenshot.output.sha256 }}163      artifacts:164        - ${{ params.evidenceFolder }}/confirmation.png165
Files main
Menu

Theme