# Testiny Automation helpers

Use the Testiny automation helpers to import automated test case results into your Testiny Organization.

## Playwright reporter

The Testiny Playwright reporter directly imports test results into Testiny while the test is running.

Add the Testiny reporter to your Playwright configuration like this:

```typescript
const yourConfig = {
    ...
    reporter: [["@testiny/automation/reporters/playwright", {
        // enable or disable reporting to Testiny
        enable: true, 
        // defaults to Testiny Cloud App, set url for Testiny Server
        url: "",
        // optional: Testiny API key, defaults to environment variable TESTINY_API_KEY
        token: "tny_123...",
        // the name, key or id of the Testiny target project,
        project: "XYZ",
        // the name of the automation source to use - if the source does not exist it
        // will be created
        sourceName: "ui-test", 
        // optional: enables or disables attachment uploading, defaults to 'true'
        enableAttachments: true,
        // set to true to ignore errors and only log warnings instead, default to 'false'
        ignoreErrors: false,
        // completes automated test runs once the playwright run is complete
        // set to 'false' if multiple separate processes report into the same run(s)
        // and then use --complete-runs from '@testiny/cli' to close the run(s)
        completeRuns: true,
        // optional: your AUT version, will be added as aut_version
        autVersion: "1.2.3"
        // optional: the name of the CI environment, defaults to "auto"
        // will add multiple fields with the current CI context (e.g. build id, branch name, etc.)
        ciEnv: "gitlab",
        // optional: A list of field names to use for uniquely identifying test runs. 
        // Defaults to automatic detection from the CI environment
        runFields: ["ci_pipeline_id", "ci_job_id"],
        // optional: A pattern for creating test run titles out of field values, use %{field_name} as placeholders
        runTitlePattern: "Pipeline %{ci_pipeline_id} on branch %{vc_branch}"
        // optional: fixed field values which will be added to every test result
        fixedValues: {
            my_field: "test_456",
        },
        // optional: silent mode - do not log to stdout
        silent: false,
        // optional: specify list of annotation types to include on import
        customResultFields: ["type"],
        // optional: ID of a milestone to link newly created automation runs to
        milestoneId: "MS-123",
    }],
    ... more reporters
    ],
   ...
}
```
