Git panel: share checkout actions + fix push loading (#20)

* Update files

* Git panel: share checkout actions

Hoist checkout-scoped async git actions into a shared store and keep primary Push CTA loading in-place. Also stabilize e2e git flows.

* Stabilize git panel async actions and fix e2e flakes
This commit is contained in:
Mohamed Boudra
2026-02-06 13:18:30 +07:00
committed by GitHub
parent d724988542
commit cf9ff07be6
27 changed files with 858 additions and 433 deletions

View File

@@ -425,18 +425,18 @@ export const createAgentWithConfig = async (page: Page, config: AgentConfig) =>
};
export const waitForPermissionPrompt = async (page: Page, timeout = 30000) => {
const promptText = page.getByText('How would you like to proceed?').first();
const promptText = page.getByTestId('permission-request-question').first();
await expect(promptText).toBeVisible({ timeout });
};
export const allowPermission = async (page: Page) => {
const allowButton = page.getByText('Allow', { exact: true }).first();
await expect(allowButton).toBeVisible({ timeout: 5000 });
await allowButton.click();
const acceptButton = page.getByTestId('permission-request-accept').first();
await expect(acceptButton).toBeVisible({ timeout: 5000 });
await acceptButton.click();
};
export const denyPermission = async (page: Page) => {
const denyButton = page.getByText('Deny', { exact: true }).first();
const denyButton = page.getByTestId('permission-request-deny').first();
await expect(denyButton).toBeVisible({ timeout: 5000 });
await denyButton.click();
};

View File

@@ -1,12 +1,10 @@
import { execSync } from 'node:child_process';
import { mkdtemp, writeFile, rm } from 'node:fs/promises';
import { mkdtemp, writeFile, rm, mkdir } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
type TempRepo = {
path: string;
owner?: string;
name?: string;
cleanup: () => Promise<void>;
};
@@ -15,10 +13,6 @@ export const createTempGitRepo = async (
options?: { withRemote?: boolean }
): Promise<TempRepo> => {
const repoPath = await mkdtemp(path.join(tmpdir(), prefix));
const repoName = `paseo-e2e-${Date.now().toString(36)}-${Math.random()
.toString(36)
.slice(2, 8)}`;
let owner: string | undefined;
const withRemote = options?.withRemote ?? false;
execSync('git init -b main', { cwd: repoPath, stdio: 'ignore' });
@@ -29,33 +23,17 @@ export const createTempGitRepo = async (
execSync('git commit -m "Initial commit"', { cwd: repoPath, stdio: 'ignore' });
if (withRemote) {
try {
owner = execSync('gh api user -q .login', { encoding: 'utf8' }).trim();
execSync(
`gh repo create ${repoName} --private --confirm --source=. --remote=origin --push`,
{
cwd: repoPath,
stdio: 'ignore',
}
);
} catch (error) {
await rm(repoPath, { recursive: true, force: true });
throw error;
}
// Deterministic local remote to avoid relying on external auth/network in e2e.
const remoteDir = path.join(repoPath, 'remote.git');
await mkdir(remoteDir, { recursive: true });
execSync(`git init --bare -b main ${remoteDir}`, { cwd: repoPath, stdio: 'ignore' });
execSync(`git remote add origin ${remoteDir}`, { cwd: repoPath, stdio: 'ignore' });
execSync('git push -u origin main', { cwd: repoPath, stdio: 'ignore' });
}
return {
path: repoPath,
owner,
name: repoName,
cleanup: async () => {
if (owner && withRemote) {
try {
execSync(`gh repo delete ${owner}/${repoName} --yes`, { stdio: 'ignore' });
} catch {
// Best-effort cleanup
}
}
await rm(repoPath, { recursive: true, force: true });
},
};