Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions src/components/CollapsibleCode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React, {useState} from "react";
import CodeBlock from "@theme/CodeBlock";

export default function CollapsibleCode({
code,
language = "json",
previewLines = 10,
}) {
const [expanded, setExpanded] = useState(false);
const codeLines = code.trim().split("\n");
const visibleCode = expanded
? code.trim()
: codeLines.slice(0, previewLines).join("\n") + "\n# ...";

const handleCopy = () => {
try {
navigator.clipboard.writeText(code.trim());
const btn = document.getElementById("copy-full-code");
if (btn) {
const originalText = btn.innerText;
btn.innerText = "Copied!";
setTimeout(() => (btn.innerText = originalText), 2000);
}
} catch (err) {
console.error("Failed to copy code:", err);
}
};

return (
<div className="margin-vert--md">
{/* Pass the full code to CodeBlock so default copy button works */}
<CodeBlock language={language}>{visibleCode}</CodeBlock>

<div
style={{
display: "flex",
gap: "10px",
justifyContent: "flex-end",
marginTop: "-8px", // Pulls buttons closer to code block
}}
>
{codeLines.length > previewLines && (
<button
onClick={() => setExpanded(!expanded)}
className="button button--sm button--secondary"
>
{expanded ? "Show Less" : "Show More"}
</button>
)}
<button
id="copy-full-code"
onClick={handleCopy}
className="button button--sm button--primary"
>
Copy
</button>
</div>
</div>
);
}
4 changes: 0 additions & 4 deletions versioned_docs/version-3.0.0/ci-cd/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

## Shell Scripts

GitHub scripts are the easiest way to integrate Keploy with GitHub. We will be using [express-mongoose](https://github.com/keploy/samples-typescript/tree/main/express-mongoose) sample-application for the example. You can either add the following script to yout `github workflow` or create a new worflow `.github/workflows/keploy-test.yml`:-

Check failure on line 24 in versioned_docs/version-3.0.0/ci-cd/github.md

View workflow job for this annotation

GitHub Actions / vale

[vale] versioned_docs/version-3.0.0/ci-cd/github.md#L24

[Vale.Spelling] Did you really mean 'yout'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'yout'?", "location": {"path": "versioned_docs/version-3.0.0/ci-cd/github.md", "range": {"start": {"line": 24, "column": 257}}}, "severity": "ERROR"}

Check failure on line 24 in versioned_docs/version-3.0.0/ci-cd/github.md

View workflow job for this annotation

GitHub Actions / vale

[vale] versioned_docs/version-3.0.0/ci-cd/github.md#L24

[Vale.Spelling] Did you really mean 'worflow'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'worflow'?", "location": {"path": "versioned_docs/version-3.0.0/ci-cd/github.md", "range": {"start": {"line": 24, "column": 296}}}, "severity": "ERROR"}

```yaml
- name: Checkout Commit
Expand All @@ -34,10 +34,6 @@
...
```

> **Note: if you are using `arm_64` as runner use below to download keploy binary**

`curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_arm64.tar.gz" | tar xz --overwrite -C /tmp`

### Example with Scripts

While using [express-mongoose](https://github.com/keploy/samples-typescript/tree/main/express-mongoose) sample-application with keploy test in GitHub CI, the workflow would like:-
Expand Down
12 changes: 3 additions & 9 deletions versioned_docs/version-3.0.0/ci-cd/gitlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
...
```

> **Note: if you are using `arm_64` as runner use below to download keploy binary**

`curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_arm64.tar.gz" | tar xz --overwrite -C /tmp`

Now that we have Keploy installed, and all ready, we need switch to path where `keploy` folder is present in our application and install all the application related dependencies. Since we are using [flask-mongo](https://github.com/keploy/samples-python) sample-application, steps in our `script:` would look like below:-

```yaml
Expand All @@ -66,17 +62,15 @@

### 📝 Note

Did you notice some weird stuff in the pipeline? Like `kmod`, `linux-headers`, `/sys/kernel/debug`...and thought, _"Wait, am I hacking the kernel or something?"_ 😅
Did you notice some weird stuff in the pipeline? Like `kmod`, `linux-headers`, `/sys/kernel/debug`

Don’t worry — these are just there because **Keploy uses eBPF** (a cool Linux feature) to trace your app’s behavior.

Check failure on line 67 in versioned_docs/version-3.0.0/ci-cd/gitlab.md

View workflow job for this annotation

GitHub Actions / vale

[vale] versioned_docs/version-3.0.0/ci-cd/gitlab.md#L67

[Google.EmDash] Don't put a space before or after a dash.
Raw output
{"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "versioned_docs/version-3.0.0/ci-cd/gitlab.md", "range": {"start": {"line": 67, "column": 12}}}, "severity": "ERROR"}

So we install `kmod`, `linux-headers-generic`, and `bpfcc-tools` to make that tracing possible.

Some CI systems don’t have `/sys/kernel/debug` and `/sys/kernel/tracing` by default, so we create them and mount `debugfs` and `tracefs` — it’s like giving Keploy the **backstage pass** it needs to watch your app in action.

No black magic. Just some low-level Linux stuff helping your tests run like magic! 🪄✨
Some CI systems don’t have `/sys/kernel/debug` and `/sys/kernel/tracing` by default, so we create them and mount `debugfs` and `tracefs`

We will get to see output : -
We would output something like below:-

```sh
$ keploy test -c "python3 app.py" --delay 50
Expand Down Expand Up @@ -145,6 +139,6 @@

### 📦 Need the Full Pipeline?

If you’re thinking, “This pipeline looks cool, but I need the _whole thing_ to integrate with your application!” — well, you're in luck! Check it out [here](https://github.com/keploy/samples-python) and get ready to copy-paste your way to success! ✨🚀

Check failure on line 142 in versioned_docs/version-3.0.0/ci-cd/gitlab.md

View workflow job for this annotation

GitHub Actions / vale

[vale] versioned_docs/version-3.0.0/ci-cd/gitlab.md#L142

[Google.EmDash] Don't put a space before or after a dash.
Raw output
{"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "versioned_docs/version-3.0.0/ci-cd/gitlab.md", "range": {"start": {"line": 142, "column": 113}}}, "severity": "ERROR"}

Hope this helps you out, if you still have any questions, reach out to us .
10 changes: 2 additions & 8 deletions versioned_docs/version-3.0.0/ci-cd/jenkins.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
## Prerequisites

- Jenkins installed and running
- Sudo access with `"NOPASSWORD"` via `jenkins ALL=(ALL) NOPASSWD: ALL`.

Check failure on line 22 in versioned_docs/version-3.0.0/ci-cd/jenkins.md

View workflow job for this annotation

GitHub Actions / vale

[vale] versioned_docs/version-3.0.0/ci-cd/jenkins.md#L22

[Vale.Spelling] Did you really mean 'Sudo'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'Sudo'?", "location": {"path": "versioned_docs/version-3.0.0/ci-cd/jenkins.md", "range": {"start": {"line": 22, "column": 3}}}, "severity": "ERROR"}

Open terminal and run`sudo visudo` command to open the sudoers file and add the below line at the end of the file.

Check failure on line 24 in versioned_docs/version-3.0.0/ci-cd/jenkins.md

View workflow job for this annotation

GitHub Actions / vale

[vale] versioned_docs/version-3.0.0/ci-cd/jenkins.md#L24

[Vale.Spelling] Did you really mean 'sudoers'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'sudoers'?", "location": {"path": "versioned_docs/version-3.0.0/ci-cd/jenkins.md", "range": {"start": {"line": 24, "column": 56}}}, "severity": "ERROR"}

```sh
jenkins ALL=(ALL) NOPASSWD: ALL
Expand All @@ -47,10 +47,6 @@

```

> **Note: if you are using `arm_64` as runner use below to download keploy binary**

`curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_arm64.tar.gz" | tar xz --overwrite -C /tmp`

### Example

Now that we have Keploy installed, and all ready, we need switch to path where `keploy` folder is present in our application and install all the application related dependencies. Since we are using [gin-mongo](https://github.com/keploy/samples-go/tree/main/gin-mongo) sample-application, steps in our `script` would look like below:-
Expand Down Expand Up @@ -106,15 +102,13 @@

### 📝 Note

Did you notice some weird stuff in the pipeline? Like `kmod`, `linux-headers`, `/sys/kernel/debug`...and thought, _"Wait, am I hacking the kernel or something?"_ 😅
Did you notice some weird stuff in the pipeline? Like `kmod`, `linux-headers`, `/sys/kernel/debug`

Don’t worry — these are just there because **Keploy uses eBPF** (a cool Linux feature) to trace your app’s behavior.

Check failure on line 107 in versioned_docs/version-3.0.0/ci-cd/jenkins.md

View workflow job for this annotation

GitHub Actions / vale

[vale] versioned_docs/version-3.0.0/ci-cd/jenkins.md#L107

[Google.EmDash] Don't put a space before or after a dash.
Raw output
{"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "versioned_docs/version-3.0.0/ci-cd/jenkins.md", "range": {"start": {"line": 107, "column": 12}}}, "severity": "ERROR"}

So we install `kmod`, `linux-headers-generic`, and `bpfcc-tools` to make that tracing possible.

Some CI systems don’t have `/sys/kernel/debug` and `/sys/kernel/tracing` by default, so we create them and mount `debugfs` and `tracefs` — it’s like giving Keploy the **backstage pass** it needs to watch your app in action.

No black magic. Just some low-level Linux stuff helping your tests run like magic! 🪄✨
Some CI systems don’t have `/sys/kernel/debug` and `/sys/kernel/tracing` by default, so we create them and mount `debugfs` and `tracefs`

We would output something like below:-

Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-3.0.0/keploy-cloud/deduplication.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: deduplication
title: Remove Duplicates Tests 🧹
sidebar_label: Remove Duplicate Tests 🧹
title: Remove Duplicates Tests
sidebar_label: Remove Duplicate Tests
tags:
- explanation
- feature guide
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-3.0.0/keploy-cloud/installation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: cloud-installation
title: Keploy Cloud Installation
sidebar_label: Installation 🛠️
sidebar_label: Installation
tags:
- explanation
- feature guide
Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-3.0.0/keploy-cloud/keploy-console.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: keploy-console
title: Keploy Console 📘
sidebar_label: Keploy Console 🛠️
title: Keploy Console
sidebar_label: Keploy Console
tags:
- explanation
- feature guide
Expand Down Expand Up @@ -68,7 +68,7 @@

<img src="/docs/img/keploy-cloud/noise.png?raw=true" alt="Noise"/>

You'd see the changes in the test-case file locally, new noisy fields are added under noise param in the test case.

Check failure on line 71 in versioned_docs/version-3.0.0/keploy-cloud/keploy-console.md

View workflow job for this annotation

GitHub Actions / vale

[vale] versioned_docs/version-3.0.0/keploy-cloud/keploy-console.md#L71

[Vale.Spelling] Did you really mean 'param'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'param'?", "location": {"path": "versioned_docs/version-3.0.0/keploy-cloud/keploy-console.md", "range": {"start": {"line": 71, "column": 93}}}, "severity": "ERROR"}

<img src="/docs/img/keploy-cloud/denoise.png?raw=true" alt="De-noise"/>

Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-3.0.0/keploy-cloud/mock-registry.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: mock-registry
title: Mock Registry
sidebar_label: Mock Registry 📦
sidebar_label: Mock Registry
tags:
- explanation
- feature guide
Expand All @@ -15,7 +15,7 @@

Mock Registry uploads mock files to cloud storage, keeping the application's repository lightweight and manageable.

When dealing with large mock files during tests, committing them to git repositories can be cumbersome. **Uploading such mocks to cloud storage** instead helps maintain a clean and performant repository, reducing complexity.

Check failure on line 18 in versioned_docs/version-3.0.0/keploy-cloud/mock-registry.md

View workflow job for this annotation

GitHub Actions / vale

[vale] versioned_docs/version-3.0.0/keploy-cloud/mock-registry.md#L18

[Vale.Spelling] Did you really mean 'performant'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'performant'?", "location": {"path": "versioned_docs/version-3.0.0/keploy-cloud/mock-registry.md", "range": {"start": {"line": 18, "column": 182}}}, "severity": "ERROR"}

## Usage 🛠️

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: application-settings
title: Keploy Cloud Application Settings Guide
description: Learn how to configure application settings in Keploy Cloud. Manage environments, toggle features, and optimize your testing setup with this step-by-step guide.

sidebar_label: Add Application 📝
sidebar_label: Add Application
tags:
- explanation
- feature guide
Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-3.0.0/keploy-cloud/testgeneration.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: auto-test-generation
title: Auto Test Generation 🚀
sidebar_label: Test Generation 🚀
title: Auto Test Generation
sidebar_label: Test Generation
tags:
- Auto Test Generation
- OpenAPI
Expand Down Expand Up @@ -416,7 +416,7 @@

## Generate test-cases

Now that we have our schema file, we need to create create jar file since we are using java sample-application :-

Check failure on line 419 in versioned_docs/version-3.0.0/keploy-cloud/testgeneration.md

View workflow job for this annotation

GitHub Actions / vale

[vale] versioned_docs/version-3.0.0/keploy-cloud/testgeneration.md#L419

[Vale.Repetition] 'create' is repeated!
Raw output
{"message": "[Vale.Repetition] 'create' is repeated!", "location": {"path": "versioned_docs/version-3.0.0/keploy-cloud/testgeneration.md", "range": {"start": {"line": 419, "column": 46}}}, "severity": "ERROR"}

```sh
mvn clean install -DskipTests
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-3.0.0/keploy-cloud/time-freezing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: time-freezing
title: Time Freezing
sidebar_label: Time Freezing 🥶
sidebar_label: Time Freezing
tags:
- explanation
- feature guide
Expand Down Expand Up @@ -46,7 +46,7 @@
uname -a
```

2. Download the the appropriate time freeze agent for your architecture & set the `LD_PRELOAD` Environment Variable in your Dockerfile

Check failure on line 49 in versioned_docs/version-3.0.0/keploy-cloud/time-freezing.md

View workflow job for this annotation

GitHub Actions / vale

[vale] versioned_docs/version-3.0.0/keploy-cloud/time-freezing.md#L49

[Vale.Repetition] 'the' is repeated!
Raw output
{"message": "[Vale.Repetition] 'the' is repeated!", "location": {"path": "versioned_docs/version-3.0.0/keploy-cloud/time-freezing.md", "range": {"start": {"line": 49, "column": 13}}}, "severity": "ERROR"}

### For Golang(Go) Applications -

Expand Down
Loading
Loading