> For the complete documentation index, see [llms.txt](https://docs.bugbug.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bugbug.io/workflow-tips/edit-and-rewind.md).

# Edit & Rewind

Edit & Rewind lets you pause a running test, fix or record steps, move the playback position back, and continue from there. You don't have to run the whole test from the beginning after every fix.

Edit & Rewind works in local runs, in a browser window opened by the BugBug extension.

## The problem: fixing a long test

Imagine a test that takes 5 minutes to run. End-to-end tests should be as short as possible, but in reality they often aren't.

Without Edit & Rewind, fixing it looks like this:

1. Run the test and wait 5 minutes.
2. The test fails.
3. Fix the broken steps or record new ones.
4. Run the test from the beginning and wait another 5 minutes to reach the fixed part.
5. If it still fails, repeat. This takes **a lot** of time.

## Fixing a test with Edit & Rewind

1. Run the test. It fails or you pause it.
2. Fix the broken steps or record new ones.
3. Move the playback position back to the place you want to check. **You don't have to start from the beginning.**
4. Continue the test from that position.
5. If it still fails, fix it again and rewind again. You only re-run the steps you fixed.

With Edit & Rewind, you can <mark style="background-color:green;">greatly reduce the time spent on maintaining tests</mark>.

{% embed url="<https://vimeo.com/1017561827>" %}
Edit & Rewind in action
{% endembed %}

## Controls you use

When the test is paused, the test header has these buttons:

* **Run next step and pause** - run one step and pause again
* **Resume** - continue the test to the end
* **Record** - record new steps from the current position
* **Stop** - stop the test

Click **+** between steps to choose where to continue:

* **Set playback here** - move the playback position to this point without running anything
* **Record from here** - record new steps at this point
* **Resume from here** - continue the test from this point
* **Resume and pause here** - continue the test and pause again at this point

To get to a point in the test without running it to the end, use [Run and pause here](https://docs.bugbug.io/running-tests/run-and-pause-here.md) or a [breakpoint](https://docs.bugbug.io/running-tests/run-and-pause-here.md#breakpoints).

## When else Edit & Rewind helps

1. **Recording new steps in several places of a test**

   Pause the test and record steps, then move the playback position and record again where needed.
2. **Recording new steps in the middle of a test without waiting for the whole run**

   Use **Run and pause here** at the point where you want to add steps, set the right app state in the test window, and start recording.
3. **Debugging a test step by step**

   Pause the test and use **Run next step and pause**. Rewind and replay as many times as you like.

<figure><img src="https://3168433179-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKixgeBPbLvnD0l1eiV%2Fuploads%2Fqig01LcU1N7eqK9eWvkq%2Fimage.png?alt=media&amp;token=d8759564-e7a9-4023-b12b-06eea513e487" alt=""><figcaption><p>You after using Edit &#x26; Rewind functionality. Source <a href="https://www.reddit.com/r/wholesomememes/comments/evgnfp/resting_is_important_to_your_wellbeing/">https://www.reddit.com/r/wholesomememes/comments/evgnfp/resting_is_important_to_your_wellbeing/</a></p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.bugbug.io/workflow-tips/edit-and-rewind.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
