# Netlify

Run one or multiple Endtest test suites after Netlify deployments with the official Endtest extension

Part of the Endtest documentation (Integrations). Canonical URL: https://endtest.io/docs/integrations/netlify

---
## Overview

The official Endtest Netlify extension allows you to run Endtest web tests automatically after a successful Netlify deployment.

The extension can:

- Start one Endtest test suite after a deployment goes live.
- Start multiple Endtest test suites in the same API call by using a label.
- Wait for every triggered execution to finish.
- Display the Endtest results in the Netlify deploy log.
- Report failed assertions and execution errors as an extension failure.
- Use a separate Endtest configuration for each Netlify project.
- Pass the current Netlify deployment URL to Endtest.

You can install the extension from the [Endtest page in the Netlify Extensions Directory](https://app.netlify.com/extensions/0e7j1jxj-endtest-netlify-extension).

The source code is available in the [Endtest Netlify Extension repository](https://github.com/endtest-technologies/endtest-netlify-extension).

## Requirements

Before using the extension, you need:

1. An Endtest account.
2. Your Endtest `App ID`.
3. Your Endtest `App Code`.
4. An Endtest API Request for starting the desired test execution or executions.
5. A Netlify account.
6. A Netlify project.

Your `App ID` and `App Code` can be found on the [Endtest Settings page](https://app.endtest.io/settings).

You can generate the API Request by following the instructions from the [Endtest API](https://endtest.io/docs/advanced/how-to-use-the-endtest-api) chapter.

## Install the Endtest extension

Open the [Endtest extension page on Netlify](https://app.netlify.com/extensions/0e7j1jxj-endtest-netlify-extension) and select **Install**.

Choose the Netlify team that contains the project where you want to use Endtest.

During installation, the extension requests permission to read, write, and delete project environment variables.

These permissions are used to:

- Save the Endtest configuration for each Netlify project.
- Enable or disable Endtest for a project.
- Read the saved configuration during a deployment.

The extension does not require access to your source-code repository.

## Configure Endtest for a Netlify project

After installing the extension:

1. Open the desired project in Netlify.
2. Select **Endtest** from the project navigation.
3. Enter your Endtest `App ID`.
4. Enter your Endtest `App Code`.
5. Paste the Endtest API Request.
6. Choose the maximum number of result checks.
7. Select **Save and enable Endtest**.

The Endtest configuration is stored separately for each Netlify project.

The extension creates and manages the following project-level environment variables:

```text
ENDTEST_ENABLED
ENDTEST_APP_ID
ENDTEST_APP_CODE
ENDTEST_API_REQUEST
ENDTEST_NUMBER_OF_LOOPS
```

These values are stored in Netlify and are not committed to your website repository.

## Endtest API Request

The API Request determines which Endtest test suite or test suites will run.

A typical API Request can include:

- Test suite or label.
- Browser.
- Browser version.
- Operating system.
- Screen resolution.
- Geolocation.
- Test cases.
- Execution notes.

You do not need to include `appId` or `appCode` in the saved API Request.

The extension automatically adds the `App ID` and `App Code` from the project configuration before starting the execution.

More information about supported API parameters is available in the [Endtest API](https://endtest.io/docs/advanced/how-to-use-the-endtest-api) chapter.

## Run a single test suite

Use the `suite` parameter to run one Endtest test suite.

Example:

```text
https://app.endtest.io/api.php?action=runWeb&suite=2945352&platform=windows&os=windows11&browser=chrome&browserVersion=latest&resolution=1280x1024&geolocation=sanfrancisco&cases=all&notes=
```

The Endtest API returns one execution hash:

```text
71frWqyL1YdAVfvlP63DgZ4TGYewnJoOij
```

The extension uses that hash to check the execution result until the test finishes or the configured polling period expires.

## Run multiple test suites with a label

Use the `label` parameter to run every Endtest test suite associated with the specified label.

Example:

```text
https://app.endtest.io/api.php?action=runWeb&label=Critical&platform=windows&os=windows11&browser=chrome&browserVersion=latest&resolution=1280x1024&geolocation=sanfrancisco&cases=all&notes=
```

In this example, Endtest starts every test suite associated with the `Critical` label.

The API returns the execution hashes as a comma-separated value:

```text
Udq2dphebLjy29dQr63xe7ZmPGkNZvz3T5,QNHWpc98OE6699qXg63SF2K8KIabRk9bLy
```

The extension:

1. Reads all returned execution hashes.
2. Sends all hashes to the Endtest `getResults` API endpoint.
3. Waits until a result is available for every execution.
4. Displays the individual result for every test suite.
5. Calculates combined failure and error totals.
6. Marks the extension as failed when any execution reports failed assertions, execution errors, or a failure status.

The extension uses a results request with the following structure:

```text
https://app.endtest.io/api.php?action=getResults&appId=APP_ID&appCode=APP_CODE&hash=HASH_1,HASH_2&format=json-light
```

The `json-light` response contains one result object for each execution:

```json
[
  {
    "test_suite_name": "Online Store with AI",
    "configuration": "Windows 11 Chrome Latest (v149) 1280 x 1024 San Francisco, US",
    "test_cases": 1,
    "passed": 0,
    "failed": 0,
    "errors": 0
  },
  {
    "test_suite_name": "Demo Shop",
    "configuration": "Windows 11 Chrome Latest (v149) 1280 x 1024 San Francisco, US",
    "test_cases": 1,
    "passed": 0,
    "failed": 0,
    "errors": 0
  }
]
```

The same extension configuration supports both single-suite and label-based executions. You only need to change the saved API Request.

## Use the current Netlify deployment URL

You can include the following placeholder anywhere inside the Endtest API Request:

```text
{{NETLIFY_DEPLOY_URL}}
```

Before starting the Endtest execution, the extension replaces the placeholder with the URL of the current Netlify deployment.

Example:

```text
https://app.endtest.io/api.php?action=runWeb&suite=123456&startUrl={{NETLIFY_DEPLOY_URL}}
```

The placeholder can also be used in a label-based request:

```text
https://app.endtest.io/api.php?action=runWeb&label=Critical&startUrl={{NETLIFY_DEPLOY_URL}}
```

This can be used to run tests against:

- Production deployments.
- Branch deployments.
- Deploy Previews.

The exact API parameter used for the start URL depends on how your Endtest test is configured.

## Choosing the number of result checks

The extension checks the Endtest execution results once every 30 seconds.

For example, when an execution normally takes approximately three minutes, you can use:

```text
Maximum result checks: 7
```

This allows up to 210 seconds:

```text
7 × 30 seconds = 210 seconds
```

Choose a value that is slightly higher than the normal duration of the slowest triggered test suite.

For a group of test suites that usually finishes within five minutes, you can use:

```text
Maximum result checks: 10
```

When multiple test suites are triggered, the extension continues polling until every execution has returned a final result.

If one or more executions do not finish within the configured polling period, the extension reports a timeout.

## Deployment behavior

The Endtest extension runs after the Netlify deployment has completed successfully.

For a single execution, the extension reports success when Endtest returns:

```text
Failed: 0
Errors: 0
```

For multiple executions, every result must contain:

```text
Failed: 0
Errors: 0
```

The extension reports a failure when:

- Any execution reports one or more failed assertions.
- Any execution reports one or more execution errors.
- Any execution enters an error or failure state.
- The API returns an invalid response.
- The API does not return a result for every triggered execution.
- One or more executions do not finish within the configured polling period.

A failed Endtest execution is displayed as an extension failure in the Netlify deploy log.

When multiple test suites are triggered, one failed suite causes the complete Endtest extension run to be marked as failed.

## Important limitation

Endtest runs after the Netlify deployment has completed. If Endtest reports failed assertions or execution errors, the extension is marked as failed in the deploy log, but the completed deployment remains live and is not removed, canceled, or rolled back.

This behavior allows Endtest to test the actual deployed URL.

The Netlify extension should therefore be used for post-deployment validation rather than as a deployment gate.

## Results displayed in Netlify

For a single execution, the extension can display information such as:

- Execution hash.
- Netlify deployment URL.
- Test suite name.
- Test configuration.
- Number of test cases.
- Number of passed assertions.
- Number of failed assertions.
- Number of execution errors.

Example:

```text
Execution hash: abc123
Netlify deployment: https://example.netlify.app
Test suite: Demo Shop
Configuration: Windows 11 Chrome Latest 1280 x 1024
Test cases: 5
Passed: 12
Failed: 0
Errors: 0
```

For multiple executions, the extension displays a combined summary followed by the result of each test suite.

Example:

```text
Executions: 2
Execution hashes: HASH_1, HASH_2
Netlify deployment: https://example.netlify.app
Total failed: 0
Total errors: 0

Execution 1 of 2
Execution hash: HASH_1
Test suite: Online Store with AI
Configuration: Windows 11 Chrome Latest 1280 x 1024
Test cases: 1
Passed: 0
Failed: 0
Errors: 0

Execution 2 of 2
Execution hash: HASH_2
Test suite: Demo Shop
Configuration: Windows 11 Chrome Latest 1280 x 1024
Test cases: 1
Passed: 0
Failed: 0
Errors: 0
```

The Endtest API response may contain the following fields:

- `test_suite_name` `{string}`: The name of the test suite.
- `configuration` `{string}`: The machine or mobile-device configuration used for the execution.
- `test_cases` `{int32}`: The number of test cases.
- `passed` `{int32}`: The number of assertions that passed.
- `failed` `{int32}`: The number of assertions that failed.
- `errors` `{int32}`: The number of execution errors.
- `start_time` `{timestamp}`: The execution start time.
- `end_time` `{timestamp}`: The execution end time.
- `detailed_logs` `{string}`: The detailed execution logs when the `json` format is used.
- `screenshots_and_video` `{string}`: Links to screenshots and video recordings when the `json` format is used.
- `test_case_management` `{string}`: The names, statuses, and external IDs of associated test cases.

The Results page for an execution has the following format:

```text
https://app.endtest.io/results?hash=EXECUTION_HASH
```

Each execution in a label-based run has its own Endtest Results page and execution hash.

## Tests without assertions

An Endtest execution can contain test steps without assertions.

In that case, the result can contain:

```text
Passed: 0
Failed: 0
Errors: 0
```

This is still considered a successful execution because Endtest reported no failed assertions and no execution errors.

The same behavior applies to multiple executions. Every execution can report zero passed assertions and still be successful when `failed` and `errors` are both zero.

## Disable Endtest for a project

To disable the integration:

1. Open the Netlify project.
2. Select **Endtest**.
3. Select **Disable Endtest**.

Disabling Endtest stops new executions for that project.

The saved `App ID`, `App Code`, and API Request are preserved, so the integration can be enabled again without re-entering the configuration.

## Security

The Endtest configuration is stored as project-level Netlify environment variables.

The credentials are not committed to the website repository.

The extension hides the `App Code` when it displays the API Request in the deploy log.

Because `ENDTEST_APP_CODE` is stored as a standard Netlify environment variable, users with sufficient access to the Netlify project may be able to view or edit it from the project settings.

## Troubleshooting

### Endtest does not run after a deployment

Check that:

- The Endtest extension is installed for the correct Netlify team.
- Endtest is enabled for the project.
- The `App ID` is correct.
- The `App Code` is correct.
- The API Request is a complete HTTPS URL.
- The Netlify deployment completed successfully.

The extension only starts Endtest after a successful deployment.

### Only one test suite runs

Check the saved API Request.

A request containing:

```text
suite=123456
```

runs one specific test suite.

To run multiple test suites, use a label:

```text
label=Critical
```

Every Endtest test suite associated with that label will be triggered.

### The configuration cannot be saved

Confirm that the extension has permission to read, write, and delete project environment variables.

If the permissions were changed after the extension was installed, uninstall and reinstall the extension so the installation receives the updated permissions.

### The API Request is rejected

Make sure that:

- The request starts with `https://`.
- The request uses a valid Endtest API action.
- The suite ID or label is valid.
- The browser, operating system, and other configuration parameters are supported.
- The API Request does not need to contain `appId` or `appCode`, because the extension adds them automatically.

### One or more execution results are missing

When a label triggers multiple test suites, Endtest returns multiple execution hashes.

The extension waits until the results response contains one final result for every returned hash.

If some executions take longer than others, increase the **Maximum result checks** value.

### The execution times out

Increase the **Maximum result checks** value.

Each result check occurs after a 30-second wait.

For example:

```text
10 checks × 30 seconds = 300 seconds
```

For label-based runs, choose a value that allows enough time for the slowest test suite to finish.

### The deployment remains live after a failed test

This is expected.

The Endtest extension runs after deployment so it can test the actual deployed URL.

A failed Endtest execution marks the extension as failed in the deploy log, but it cannot undo a deployment that has already completed.

## Manual API integration

The official Endtest extension is the recommended way to integrate Endtest with Netlify.

For custom workflows, you can call the Endtest API directly from a script or Netlify Function.

The custom integration must:

1. Send the API Request that starts the test execution or executions.
2. Save the execution hash or comma-separated execution hashes returned by Endtest.
3. Call the `getResults` API endpoint using the `App ID`, `App Code`, and returned hashes.
4. Continue checking until every execution finishes.
5. Report a failure when any execution returns failed assertions or execution errors.

For multiple executions, the results request has the following structure:

```text
https://app.endtest.io/api.php?action=getResults&appId=APP_ID&appCode=APP_CODE&hash=HASH_1,HASH_2&format=json-light
```

More information about direct API usage is available in the [Endtest API](https://endtest.io/docs/advanced/how-to-use-the-endtest-api) chapter.

## Additional resources

- [Install the Endtest Netlify extension](https://app.netlify.com/extensions/0e7j1jxj-endtest-netlify-extension)
- [Endtest Netlify Extension source code](https://github.com/endtest-technologies/endtest-netlify-extension)
- [Endtest API documentation](https://endtest.io/docs/advanced/how-to-use-the-endtest-api)
- [Endtest Settings](https://app.endtest.io/settings)
- [Endtest website](https://endtest.io/)
