Models module
Data models for Lynqa API: test steps, test data, and test run context.
This package groups the models by concern:
pylynqa.models.common— shared value objects (guidance, secrets, attachments).pylynqa.models.tests— test-run request/creation payloads.pylynqa.models.commands— browser command read models and the command parser.pylynqa.models.reports— step execution reports.pylynqa.models.errors— client exceptions.
Every public name is re-exported here, so from pylynqa.models import X keeps working.
- class pylynqa.models.AssertionChecking(assertion: str, checked: bool)
Bases:
objectA single assertion evaluated during a step.
- Parameters:
assertion – Human-readable assertion text.
checked – Whether the assertion evaluated to true.
- assertion: str
- checked: bool
- classmethod from_dict(d: dict) AssertionChecking
Build from a JSON-decoded dict.
- class pylynqa.models.AssertionsReport(assertions: list[AssertionChecking] = <factory>, screenshot: str | None = None)
Bases:
objectThe assertions evaluated for a step, present for
successorfailedsteps.- Parameters:
assertions – Individual assertion checks.
screenshot – UUID of the screenshot taken at assertion time.
- assertions: list[AssertionChecking]
- classmethod from_dict(d: dict) AssertionsReport
Build from a JSON-decoded dict.
- screenshot: str | None = None
- class pylynqa.models.Attachment(name: str, id: str)
Bases:
objectA file attachment returned by the API (server-assigned id).
- Parameters:
name – File name, e.g.
'invoice_260313.pdf'.id – UUID of the attachment assigned by the server.
- id: str
- name: str
- class pylynqa.models.ClickCommand(name: str, button: str | None = None, html_element: str | None = None, screenshot: str | None = None, response: ErrorResponse | ClickCommandSuccess | None = None)
Bases:
objectA
clickbrowser command executed during a step.- Parameters:
name – Command discriminator (
'click').button – Mouse button used, e.g.
'left'.html_element – Plain-text description of the targeted element, if any.
screenshot – Screenshot UUID captured after the command, if any.
response – Command outcome (
ErrorResponseorClickCommandSuccess).
- button: str | None = None
- classmethod from_dict(d: dict) ClickCommand
Build from a JSON-decoded command dict.
- html_element: str | None = None
- name: str
- response: ErrorResponse | ClickCommandSuccess | None = None
- screenshot: str | None = None
- class pylynqa.models.ClickCommandResponse(new_url: str | None = None)
Bases:
objectResult payload of a successful
clickcommand.- Parameters:
new_url – URL after the click, if navigation occurred.
- classmethod from_dict(d: dict) ClickCommandResponse
Build from a JSON-decoded response dict.
- new_url: str | None = None
- class pylynqa.models.ClickCommandSuccess(success: list[ClickCommandResponse] = <factory>)
Bases:
objectSuccess outcome of a
clickcommand.- Parameters:
success – One entry per resolved click.
- classmethod from_dict(d: dict) ClickCommandSuccess
Build from a JSON-decoded response dict.
- success: list[ClickCommandResponse]
- class pylynqa.models.CreateAttachment(name: str, data: str)
Bases:
objectA file attachment to include with a test run (creation only).
- Parameters:
name – File name, e.g.
'invoice_260313.pdf'.data – Base64-encoded data URI, e.g.
'data:text/plain;base64,SGVsbG8gd29ybGQh'.
- data: str
- name: str
- to_dict() dict
Transform to a JSON-compatible dict.
- class pylynqa.models.CreateGherkinTest(url: str, scenario: str, name: str | None = None, context: TestRunContext | None = None, guidance: list[TextualData] = <factory>, attachments: list[CreateAttachment] = <factory>, webhooks: list[str] = <factory>)
Bases:
objectA Gherkin (BDD) test to execute (creation payload).
Mirrors the
CreateGherkinTestschema. Used both byadd_gherkin_test_run()and, together withCreateTest, inside aadd_test_batch()call.- Parameters:
url – URL of the system under test.
scenario – Full Gherkin scenario text, including
Given,When, andThensteps.name – Optional human-readable name for this run.
context – Optional locale and secrets context.
guidance – Optional global guidance hints for the agent.
attachments – Optional files attached to the test run (base64-encoded).
webhooks – Optional list of webhook URLs to notify once the test run has ended.
- attachments: list[CreateAttachment]
- context: TestRunContext | None = None
- guidance: list[TextualData]
- name: str | None = None
- scenario: str
- to_dict() dict
Serialise to a JSON-compatible dict, omitting unset optional fields.
- Returns:
Dict with
urlandscenarioalways present.
- url: str
- webhooks: list[str]
- class pylynqa.models.CreateTest(url: str, steps: list[CreateTestStep] = <factory>, name: str | None = None, context: TestRunContext | None = None, guidance: list[TextualData] = <factory>, attachments: list[CreateAttachment] = <factory>, webhooks: list[str] = <factory>)
Bases:
objectA manual test to execute (creation payload).
Mirrors the
CreateTestschema. Used both byadd_test_run()and, together withCreateGherkinTest, inside aadd_test_batch()call.- Parameters:
url – URL of the system under test, e.g.
'https://example.com'.steps – Ordered list of test steps to execute.
name – Optional human-readable name for this run.
context – Optional locale and secrets context.
guidance – Optional global guidance hints for the agent.
attachments – Optional files attached to the test run (base64-encoded).
webhooks – Optional list of webhook URLs to notify once the test run has ended.
- attachments: list[CreateAttachment]
- context: TestRunContext | None = None
- guidance: list[TextualData]
- name: str | None = None
- steps: list[CreateTestStep]
- to_dict() dict
Serialise to a JSON-compatible dict, omitting unset optional fields.
- Returns:
Dict with
urlandstepsalways present.
- url: str
- webhooks: list[str]
- class pylynqa.models.CreateTestStep(action: str, expected_result: str | None = None, guidance: list[TextualData] = <factory>, attachments: list[CreateAttachment] = <factory>)
Bases:
objectA single step to include when creating a test run.
- Parameters:
action – Human-readable description of the action to perform, e.g.
'Click on the "Login" button'.expected_result – Optional assertion that should hold after the action is executed, e.g.
'The user is redirected to /dashboard'.guidance – Optional guidance hints to help the agent execute this step.
attachments – Optional file attachments for this step (base64-encoded).
- action: str
- attachments: list[CreateAttachment]
- expected_result: str | None = None
- guidance: list[TextualData]
- to_dict() dict
Serialise to a JSON-compatible dict.
- Returns:
Dict with
actionand, when set, optional fields.
- class pylynqa.models.DoubleClickCommand(name: str, button: str | None = None, html_element: str | None = None, screenshot: str | None = None, response: ErrorResponse | DoubleClickCommandSuccess | None = None)
Bases:
objectA
doubleClickbrowser command executed during a step.- Parameters:
name – Command discriminator (
'doubleClick').button – Mouse button used, e.g.
'left'.html_element – Plain-text description of the targeted element, if any.
screenshot – Screenshot UUID captured after the command, if any.
response – Command outcome (
ErrorResponseorDoubleClickCommandSuccess).
- button: str | None = None
- classmethod from_dict(d: dict) DoubleClickCommand
Build from a JSON-decoded command dict.
- html_element: str | None = None
- name: str
- response: ErrorResponse | DoubleClickCommandSuccess | None = None
- screenshot: str | None = None
- class pylynqa.models.DoubleClickCommandResponse(new_url: str | None = None)
Bases:
objectResult payload of a successful
doubleClickcommand.- Parameters:
new_url – URL after the double click, if navigation occurred.
- classmethod from_dict(d: dict) DoubleClickCommandResponse
Build from a JSON-decoded response dict.
- new_url: str | None = None
- class pylynqa.models.DoubleClickCommandSuccess(success: list[DoubleClickCommandResponse] = <factory>)
Bases:
objectSuccess outcome of a
doubleClickcommand.- Parameters:
success – One entry per resolved double click.
- classmethod from_dict(d: dict) DoubleClickCommandSuccess
Build from a JSON-decoded response dict.
- success: list[DoubleClickCommandResponse]
- class pylynqa.models.DragCommand(name: str, html_element: str | None = None, screenshot: str | None = None, response: ErrorResponse | DragCommandSuccess | None = None)
Bases:
objectA
dragbrowser command executed during a step.- Parameters:
name – Command discriminator (
'drag').html_element – Plain-text description of the targeted element, if any.
screenshot – Screenshot UUID captured after the command, if any.
response – Command outcome (
ErrorResponseorDragCommandSuccess).
- classmethod from_dict(d: dict) DragCommand
Build from a JSON-decoded command dict.
- html_element: str | None = None
- name: str
- response: ErrorResponse | DragCommandSuccess | None = None
- screenshot: str | None = None
- class pylynqa.models.DragCommandSuccess(success: bool = False)
Bases:
objectSuccess outcome of a
dragcommand.- Parameters:
success – Whether the drag succeeded.
- classmethod from_dict(d: dict) DragCommandSuccess
Build from a JSON-decoded response dict.
- success: bool = False
- class pylynqa.models.ErrorResponse(error: str)
Bases:
objectFailure outcome of a browser command.
- Parameters:
error – Machine-readable error cause, e.g.
'not_visible_element'or'host_not_reachable'.
- error: str
- classmethod from_dict(d: dict) ErrorResponse
Build from a JSON-decoded response dict.
- class pylynqa.models.FillCommand(name: str, value: str | None = None, html_element: str | None = None, screenshot: str | None = None, response: ErrorResponse | FillCommandSuccess | None = None)
Bases:
objectA
fillbrowser command executed during a step.- Parameters:
name – Command discriminator (
'fill').value – Value used to fill the input.
html_element – Plain-text description of the targeted element, if any.
screenshot – Screenshot UUID captured after the command, if any.
response – Command outcome (
ErrorResponseorFillCommandSuccess).
- classmethod from_dict(d: dict) FillCommand
Build from a JSON-decoded command dict.
- html_element: str | None = None
- name: str
- response: ErrorResponse | FillCommandSuccess | None = None
- screenshot: str | None = None
- value: str | None = None
- class pylynqa.models.FillCommandResponse(new_value: str | None = None)
Bases:
objectResult payload of a successful
fillcommand.- Parameters:
new_value – Value present in the field after filling.
- classmethod from_dict(d: dict) FillCommandResponse
Build from a JSON-decoded response dict.
- new_value: str | None = None
- class pylynqa.models.FillCommandSuccess(success: list[FillCommandResponse] = <factory>)
Bases:
objectSuccess outcome of a
fillcommand.- Parameters:
success – One entry per resolved fill.
- classmethod from_dict(d: dict) FillCommandSuccess
Build from a JSON-decoded response dict.
- success: list[FillCommandResponse]
- class pylynqa.models.GenericCommand(name: str, html_element: str | None = None, screenshot: str | None = None, raw: dict = <factory>)
Bases:
objectFallback command used when the
namediscriminator is not recognised.Preserves forward compatibility with command types introduced after this client was released.
- Parameters:
name – Raw command name.
html_element – Plain-text description of the targeted element, if any.
screenshot – Screenshot UUID captured after the command, if any.
raw – The unparsed command dict as received from the API.
- classmethod from_dict(d: dict) GenericCommand
Build from a JSON-decoded command dict.
- html_element: str | None = None
- name: str
- raw: dict
- screenshot: str | None = None
- class pylynqa.models.GotoCommand(name: str, url: str | None = None, html_element: str | None = None, screenshot: str | None = None, response: ErrorResponse | GotoCommandSuccess | None = None)
Bases:
objectA
gotobrowser command executed during a step.- Parameters:
name – Command discriminator (
'goto').url – URL to reach.
html_element – Plain-text description of the targeted element, if any.
screenshot – Screenshot UUID captured after the command, if any.
response – Command outcome (
ErrorResponseorGotoCommandSuccess).
- classmethod from_dict(d: dict) GotoCommand
Build from a JSON-decoded command dict.
- html_element: str | None = None
- name: str
- response: ErrorResponse | GotoCommandSuccess | None = None
- screenshot: str | None = None
- url: str | None = None
- class pylynqa.models.GotoCommandResponse(url: str | None = None)
Bases:
objectResult payload of a successful
gotocommand.- Parameters:
url – URL that was reached.
- classmethod from_dict(d: dict) GotoCommandResponse
Build from a JSON-decoded response dict.
- url: str | None = None
- class pylynqa.models.GotoCommandSuccess(success: list[GotoCommandResponse] = <factory>)
Bases:
objectSuccess outcome of a
gotocommand.- Parameters:
success – One entry per resolved navigation.
- classmethod from_dict(d: dict) GotoCommandSuccess
Build from a JSON-decoded response dict.
- success: list[GotoCommandResponse]
- class pylynqa.models.HoverCommand(name: str, html_element: str | None = None, screenshot: str | None = None, response: ErrorResponse | HoverCommandSuccess | None = None)
Bases:
objectA
hoverbrowser command executed during a step.- Parameters:
name – Command discriminator (
'hover').html_element – Plain-text description of the targeted element, if any.
screenshot – Screenshot UUID captured after the command, if any.
response – Command outcome (
ErrorResponseorHoverCommandSuccess).
- classmethod from_dict(d: dict) HoverCommand
Build from a JSON-decoded command dict.
- html_element: str | None = None
- name: str
- response: ErrorResponse | HoverCommandSuccess | None = None
- screenshot: str | None = None
- class pylynqa.models.HoverCommandSuccess(success: bool = False)
Bases:
objectSuccess outcome of a
hovercommand.- Parameters:
success – Whether the hover succeeded.
- classmethod from_dict(d: dict) HoverCommandSuccess
Build from a JSON-decoded response dict.
- success: bool = False
- exception pylynqa.models.LynqaClientError(status_code: int, error: str = '', message: str = '')
Bases:
ExceptionRaised when the Lynqa API returns a non-2xx HTTP response.
- Parameters:
status_code – HTTP status code returned by the server.
error – Short error label from the response body (e.g.
'Unauthorized').message – Human-readable description from the response body (e.g.
'Missing authentication method').
Common status codes:
400- Request body is malformed.401- Authentication failed (invalid or missing API key).403- Not enough credits to execute the test.404- Resource not found.410- Test run has expired.422- URL is not safe to test.429- Too many requests (rate limit exceeded).
- class pylynqa.models.PressKeyCommand(name: str, value: str | None = None, keys_sequence: list[str] = <factory>, html_element: str | None = None, screenshot: str | None = None, response: ErrorResponse | PressKeyCommandSuccess | None = None)
Bases:
objectA
pressKeybrowser command executed during a step.- Parameters:
name – Command discriminator (
'pressKey').value – Sequence of keys, comma separated.
keys_sequence – Sequence of keys as a list.
html_element – Plain-text description of the targeted element, if any.
screenshot – Screenshot UUID captured after the command, if any.
response – Command outcome (
ErrorResponseorPressKeyCommandSuccess).
- classmethod from_dict(d: dict) PressKeyCommand
Build from a JSON-decoded command dict.
- html_element: str | None = None
- keys_sequence: list[str]
- name: str
- response: ErrorResponse | PressKeyCommandSuccess | None = None
- screenshot: str | None = None
- value: str | None = None
- class pylynqa.models.PressKeyCommandResponse(new_url: str | None = None)
Bases:
objectResult payload of a successful
pressKeycommand.- Parameters:
new_url – URL after pressing the keys, if navigation occurred.
- classmethod from_dict(d: dict) PressKeyCommandResponse
Build from a JSON-decoded response dict.
- new_url: str | None = None
- class pylynqa.models.PressKeyCommandSuccess(success: list[PressKeyCommandResponse] = <factory>)
Bases:
objectSuccess outcome of a
pressKeycommand.- Parameters:
success – One entry per resolved key press.
- classmethod from_dict(d: dict) PressKeyCommandSuccess
Build from a JSON-decoded response dict.
- success: list[PressKeyCommandResponse]
- class pylynqa.models.ScrollCommand(name: str, html_element: str | None = None, screenshot: str | None = None, response: ErrorResponse | ScrollCommandSuccess | None = None)
Bases:
objectA
scrollbrowser command executed during a step.- Parameters:
name – Command discriminator (
'scroll').html_element – Plain-text description of the targeted element, if any.
screenshot – Screenshot UUID captured after the command, if any.
response – Command outcome (
ErrorResponseorScrollCommandSuccess).
- classmethod from_dict(d: dict) ScrollCommand
Build from a JSON-decoded command dict.
- html_element: str | None = None
- name: str
- response: ErrorResponse | ScrollCommandSuccess | None = None
- screenshot: str | None = None
- class pylynqa.models.ScrollCommandResponse(direction: str | None = None, delta: float | None = None)
Bases:
objectResult payload of a successful
scrollcommand.- Parameters:
direction – Direction of the scroll,
'up'or'down'.delta – Number of pixels scrolled.
- delta: float | None = None
- direction: str | None = None
- classmethod from_dict(d: dict) ScrollCommandResponse
Build from a JSON-decoded response dict.
- class pylynqa.models.ScrollCommandSuccess(success: list[ScrollCommandResponse] = <factory>)
Bases:
objectSuccess outcome of a
scrollcommand.- Parameters:
success – One entry per resolved scroll.
- classmethod from_dict(d: dict) ScrollCommandSuccess
Build from a JSON-decoded response dict.
- success: list[ScrollCommandResponse]
- class pylynqa.models.SelectCommand(name: str, value: str | None = None, options: list[str] = <factory>, html_element: str | None = None, screenshot: str | None = None, response: ErrorResponse | SelectCommandSuccess | None = None)
Bases:
objectA
selectbrowser command executed during a step.- Parameters:
name – Command discriminator (
'select').value – Concatenated selected options.
options – Selected options.
html_element – Plain-text description of the targeted element, if any.
screenshot – Screenshot UUID captured after the command, if any.
response – Command outcome (
ErrorResponseorSelectCommandSuccess).
- classmethod from_dict(d: dict) SelectCommand
Build from a JSON-decoded command dict.
- html_element: str | None = None
- name: str
- options: list[str]
- response: ErrorResponse | SelectCommandSuccess | None = None
- screenshot: str | None = None
- value: str | None = None
- class pylynqa.models.SelectCommandResponse(selected_options: list[str] = <factory>)
Bases:
objectResult payload of a successful
selectcommand.- Parameters:
selected_options – Options selected as a result of the command.
- classmethod from_dict(d: dict) SelectCommandResponse
Build from a JSON-decoded response dict.
- selected_options: list[str]
- class pylynqa.models.SelectCommandSuccess(success: list[SelectCommandResponse] = <factory>)
Bases:
objectSuccess outcome of a
selectcommand.- Parameters:
success – One entry per resolved select.
- classmethod from_dict(d: dict) SelectCommandSuccess
Build from a JSON-decoded response dict.
- success: list[SelectCommandResponse]
- class pylynqa.models.StepReport(commands: list[Command] = <factory>, status: str = '', start: str | None = None, end: str | None = None, assertions_report: AssertionsReport | None = None, test_verdict_cause: str | None = None, error: str | None = None)
Bases:
objectThe execution report of a single test step.
Depending on the step
statusonly some fields are populated (e.g.assertions_reportis present forsuccessorfailedsteps,erroronly forerrorsteps).- Parameters:
commands – Browser commands executed during this step.
status – Step execution status, e.g.
'success','failed','error'.start – Step start date (ISO 8601), present once the step has started.
end – Step end date (ISO 8601), present once the step has finished.
assertions_report – Assertions evaluated, present for
successorfailedsteps.test_verdict_cause – Human-readable failure reason, present when
statusisfailed.error – Internal error cause, present when
statusiserror.
- assertions_report: AssertionsReport | None = None
- commands: list[Command]
- end: str | None = None
- error: str | None = None
- classmethod from_dict(d: dict) StepReport
Build from a JSON-decoded step report dict.
- Parameters:
d – Step report dict as returned by the API.
- Returns:
A typed
StepReport.
- start: str | None = None
- status: str = ''
- test_verdict_cause: str | None = None
- class pylynqa.models.TestData(name: str, value: str)
Bases:
objectA name/value pair used to inject secrets or test data into test steps.
- Parameters:
name – Name of the data entry, e.g.
'password'.value – Value of the data entry, e.g.
'mys3cr3t!'.
- name: str
- to_dict() dict
Serialise to a JSON-compatible dict.
- Returns:
Dict with
nameandvalue.
- value: str
- class pylynqa.models.TestRunContext(browser_locale: str | None = None, client_datetime: str | None = None, secrets: list[TestData] = <factory>)
Bases:
objectOptional context attached to a test run.
Provides locale information and secrets that the Lynqa engine can use when executing the test steps.
- Parameters:
browser_locale – Browser locale code, formatted
(ISO 639-1)_(ISO 3166-1 alpha-2)(.UTF-8), e.g.'fr_FR','en_US.UTF-8', or'es_ES'. Defaults toen_USserver-side when omitted.client_datetime – Human-readable local date/time string passed to the agent, e.g.
'Thu Feb 26 2026 09:26:12 GMT+0100'.secrets – List of
TestDataentries that will be injected into the test steps at execution time.
- browser_locale: str | None = None
- client_datetime: str | None = None
- to_dict() dict
Serialise to a JSON-compatible dict, omitting unset fields.
- Returns:
Dict representation of the context.
- class pylynqa.models.TestRunsFilter(statuses: list[str] | None = None, relative_period: TimePeriod | None = None, start_date: str | None = None, end_date: str | None = None, api_key_ids: list[str] | None = None, test_run_ids: list[str] | None = None)
Bases:
objectFilter criteria for
query_test_runs().All fields are optional; omitted fields are not sent in the request body.
- Parameters:
statuses – Keep only runs with these statuses. Allowed values:
'waiting','running','success','failed','error','stopped','not_run'.relative_period – Relative time window, e.g.
TimePeriod(count=3, unit='h')for the last 3 hours.start_date – Start of an explicit date range (ISO 8601).
end_date – End of an explicit date range (ISO 8601).
api_key_ids – Keep only runs created by these API key IDs.
test_run_ids – Keep only runs with these IDs.
- api_key_ids: list[str] | None = None
- end_date: str | None = None
- relative_period: TimePeriod | None = None
- start_date: str | None = None
- statuses: list[str] | None = None
- test_run_ids: list[str] | None = None
- to_dict() dict
Transform to a JSON-compatible dict.
- class pylynqa.models.TestStep(action: str, expected_result: str | None = None, guidance: list[TextualData] = <factory>, attachments: list[Attachment] = <factory>)
Bases:
objectA single step returned by the API for a test run.
- Parameters:
action – Human-readable description of the action performed.
expected_result – Assertion associated with this step, if any.
guidance – Guidance hints attached to this step.
attachments – File attachments returned by the server (read-only, server-assigned ids).
- action: str
- attachments: list[Attachment]
- expected_result: str | None = None
- guidance: list[TextualData]
- class pylynqa.models.TextualData(text: str)
Bases:
objectA guidance hint passed to the Lynqa agent during test execution.
- Parameters:
text – Plain-text guidance, e.g.
'The user is between 18 and 49'.
- text: str
- to_dict() dict
Transform to a JSON-compatible dict.
- class pylynqa.models.TimePeriod(count: int, unit: str)
Bases:
objectA relative time window used in
TestRunsFilter.- Parameters:
count – Number of units, e.g.
3for “last 3 hours”.unit – Time unit —
'm'minutes,'h'hours,'d'days,'M'months.
- count: int
- to_dict() dict
Transform to a JSON-compatible dict.
- unit: str
- class pylynqa.models.TypeCommand(name: str, value: str | None = None, html_element: str | None = None, screenshot: str | None = None, response: ErrorResponse | TypeCommandSuccess | None = None)
Bases:
objectA
typebrowser command executed during a step.- Parameters:
name – Command discriminator (
'type').value – Value typed.
html_element – Plain-text description of the targeted element, if any.
screenshot – Screenshot UUID captured after the command, if any.
response – Command outcome (
ErrorResponseorTypeCommandSuccess).
- classmethod from_dict(d: dict) TypeCommand
Build from a JSON-decoded command dict.
- html_element: str | None = None
- name: str
- response: ErrorResponse | TypeCommandSuccess | None = None
- screenshot: str | None = None
- value: str | None = None
- class pylynqa.models.TypeCommandSuccess(success: bool = False)
Bases:
objectSuccess outcome of a
typecommand.- Parameters:
success – Whether the type succeeded.
- classmethod from_dict(d: dict) TypeCommandSuccess
Build from a JSON-decoded response dict.
- success: bool = False
- pylynqa.models.parse_command(d: dict) Command
Parse a single command dict into the matching typed command object.
Dispatches on the
namediscriminator. Unknown names fall back toGenericCommand.- Parameters:
d – JSON-decoded command dict.
- Returns:
A typed command object.