mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 08:07:49 +00:00
The result pane starts from the base and every change, conflicting or not, gets Accept / Ignore next to its side; accepting one side of a conflict still lets the other side be appended, and the modifier key resolves using that side directly. Adds Resolve Simple Conflicts (word-level), Apply Non-Conflicting Changes from the left, right or both (optionally on opening), Revert Conflict Resolution, Accept Yours / Accept Theirs / Cancel / Apply, Compare Contents between any two versions, and undo back to the conflicted state. CRLF and UTF-16 files are written back exactly, deleted sides and binary files are handled, and the commands are registered as merge.* actions. Refs #826 Co-authored-by: ntbang0901 <121003585+ntbang0901@users.noreply.github.com>
53 lines
2.0 KiB
TypeScript
53 lines
2.0 KiB
TypeScript
/** Shared helpers: open the workbench with the injected sample project and fail on page errors. */
|
|
import { expect, test as base, type Page } from "@playwright/test";
|
|
|
|
export const PROJECT = "acme-api";
|
|
|
|
export const test = base.extend<{ workbench: Page }>({
|
|
// Every spec presses ⌘-shortcuts; CodeMirror picks Mod-key bindings from navigator.platform, not the user agent,
|
|
// so without this they silently become Ctrl on the Linux CI.
|
|
page: async ({ page }, provide) => {
|
|
await page.addInitScript(() => Object.defineProperty(Navigator.prototype, "platform", { get: () => "MacIntel" }));
|
|
await provide(page);
|
|
},
|
|
workbench: async ({ page }, provide) => {
|
|
const errors: string[] = [];
|
|
page.on("pageerror", (e) => errors.push(e.message));
|
|
await page.goto("/");
|
|
await expect(page.getByRole("tree", { name: "Project" })).toBeVisible();
|
|
await expect(page.getByRole("treeitem", { name: /acme-api/ })).toBeVisible();
|
|
await provide(page);
|
|
expect(errors, "uncaught page errors").toEqual([]);
|
|
},
|
|
});
|
|
|
|
export { expect };
|
|
|
|
/** Tool windows currently laid out (visible) in the workbench. */
|
|
export async function visibleToolWindows(page: Page): Promise<string[]> {
|
|
return page
|
|
.locator("section[aria-label]")
|
|
.evaluateAll((els) =>
|
|
els
|
|
.filter((e) => (e as HTMLElement).offsetParent !== null && e.getBoundingClientRect().width > 0)
|
|
.map((e) => e.getAttribute("aria-label") ?? ""),
|
|
);
|
|
}
|
|
|
|
export async function doubleShift(page: Page) {
|
|
await page.keyboard.press("Shift");
|
|
await page.keyboard.press("Shift");
|
|
}
|
|
|
|
/** Opens a top-level sample file from the Project tree and waits for the editor. */
|
|
export async function openFromTree(page: Page, name: string) {
|
|
await page.getByRole("treeitem", { name, exact: true }).dblclick();
|
|
await expect(page.getByRole("tablist", { name: "Editor tabs" }).getByRole("tab", { name })).toHaveAttribute(
|
|
"aria-selected",
|
|
"true",
|
|
);
|
|
const editor = page.locator(".cm-editor").first();
|
|
await expect(editor.locator(".cm-content")).not.toBeEmpty();
|
|
return editor;
|
|
}
|