Files
moreminimore-vibe/e2e-tests/undo.spec.ts
Will Chen 86e4005795 Parameterize undo e2e test (#1943)
<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Parameterizes the undo e2e test and adds a second run using native Git
via a shared helper.
> 
> - **Tests (e2e)**:
> - Refactor `e2e-tests/undo.spec.ts` to use `runUndoTest(po,
nativeGit)` helper.
> - Pass `nativeGit` through `po.setUp({ autoApprove: true, nativeGit
})`.
>     - Import `PageObject` from `helpers/test_helper`.
> - Add second test "undo with native git" alongside existing "undo"
test.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
2108a7d73669794f0052192e8b5a1ffac3d54ec1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Parameterized the undo e2e test to run with and without native Git,
improving coverage without duplicating code.

- **Refactors**
- Added runUndoTest(po, nativeGit) helper and passed nativeGit to setUp.
  - Split into two test cases: “undo” and “undo with native git”.
- Minor whitespace-only formatting updates in snapshot and fixture
files.

<sup>Written for commit 2108a7d73669794f0052192e8b5a1ffac3d54ec1.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-12 13:13:39 -08:00

43 lines
1.1 KiB
TypeScript

import { PageObject, testSkipIfWindows, Timeout } from "./helpers/test_helper";
import { expect } from "@playwright/test";
const runUndoTest = async (po: PageObject, nativeGit: boolean) => {
await po.setUp({ autoApprove: true, nativeGit });
await po.sendPrompt("tc=write-index");
await po.sendPrompt("tc=write-index-2");
const iframe = po.getPreviewIframeElement();
await expect(
iframe.contentFrame().getByText("Testing:write-index(2)!"),
).toBeVisible({
// This can be pretty slow because it's waiting for the app to build.
timeout: Timeout.LONG,
});
await po.clickUndo();
await expect(
iframe.contentFrame().getByText("Testing:write-index!"),
).toBeVisible({
// Also, could be slow.
timeout: Timeout.LONG,
});
await po.clickUndo();
await expect(
iframe.contentFrame().getByText("Welcome to Your Blank App"),
).toBeVisible({
// Also, could be slow.
timeout: Timeout.LONG,
});
};
testSkipIfWindows("undo", async ({ po }) => {
await runUndoTest(po, false);
});
testSkipIfWindows("undo with native git", async ({ po }) => {
await runUndoTest(po, true);
});