# Pynt for Cypress

### Overview

Using Cypress for end-to-end testing in combination with Pynt for automated API security testing is a powerful approach to enhance the security of your web applications.

As part of its API security testing suite, Pynt allows integration with Cypress to automate security scans within your test suites to detect and mitigate vulnerabilities effectively.

### Prerequisites

Before integrating Pynt with Cypress, make sure Pynt's [prerequisites](https://docs.pynt.io/documentation/api-security-testing/prerequisites-for-running-pynt-scans) are met and follow the instructions to [install Pynt CLI](https://docs.pynt.io/documentation/onboarding/getting-started).

### How to Run Pynt with Cypress

Pynt allows you to run API Security tests from Cypress E2E tests using `pynt command`.

#### Basic Command

To run Pynt with Cypress, use the following command:

```bash
pynt command --cmd "npx cypress run"
```

This will execute your Cypress tests while Pynt captures all API traffic and performs security analysis.

#### Running Specific Test Files

To run a specific test file with Pynt:

```bash
pynt command --cmd "npx cypress run --spec cypress.spec.cy.js"
```

Or for tests in subdirectories:

```bash
pynt command --cmd "npx cypress run --spec cypress/e2e/api-tests.cy.js"
```

#### Example with Options

Here's a complete example with common Pynt options:

```bash
pynt command --cmd "npx cypress run" \
     --test-name "Cypress E2E Security Tests" \
     --application-name "My Application"
```

### Configuration Options

#### Self-Signed Certificates

If your client is. validating SSL and can accept self-signed certificates, use the `--self-signed` flag:

```bash
pynt command --cmd "npx cypress run" --self-signed
```

#### Custom CA Certificate

If your client needs a specific certificate, provide the path to it with `--ca-path`:

```bash
pynt command --cmd "npx cypress run" --ca-path /path/to/certificate.pem
```

#### Application Configuration

Link your scan to a specific application:

```bash
pynt command --cmd "npx cypress run" --application-name "My Web App"
```

#### Test Naming

Use the `--test-name` flag to give your security scan a meaningful name:

```bash
pynt command --cmd "npx cypress run" --test-name "Production E2E Security Tests"
```

#### Allow Errors

To continue security scanning even when tests fail:

```bash
pynt command --cmd "npx cypress run" --allow-errors
```

### Goat Example:

Here's a comprehensive example demonstrating Pynt with Cypress:

Download the test files:

{% file src="/files/XUo74WbfjMB0jYl61kiV" %}

{% file src="/files/UD48BHOvNNkFfRVokrq3" %}

Run Pynt

```bash
pynt command --cmd "npx cypress run --spec cypress.spec.cy.js"
```

This will start a Pynt scan on Goat APIs, result should look like:

<figure><img src="/files/cSmiJ876EdJvBuSlJUxX" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pynt.io/documentation/security-testing-integrations/pynt-with-testing-frameworks/pynt-for-cypress.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
