mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
128 lines
3.9 KiB
TypeScript
128 lines
3.9 KiB
TypeScript
import { test } from "./fixtures";
|
|
import { openAgentRoute, seedMockAgentWorkspace } from "./helpers/mock-agent";
|
|
import {
|
|
chooseQuestionOption,
|
|
continueToNextQuestion,
|
|
expectCurrentQuestion,
|
|
expectQuestionDismissEnabled,
|
|
expectQuestionHidden,
|
|
expectQuestionNavigationEnabled,
|
|
expectQuestionOptionSelected,
|
|
expectQuestionPrimaryActionDisabled,
|
|
expectQuestionPrimaryActionEnabled,
|
|
fillQuestionAnswer,
|
|
openQuestion,
|
|
submitQuestionAnswers,
|
|
waitForQuestionPrompt,
|
|
} from "./helpers/questions";
|
|
|
|
const TOTAL_QUESTIONS = 3;
|
|
const SURFACE_QUESTION = "Which surface should this apply to?";
|
|
const ROLLOUT_QUESTION = "Which rollout should we use?";
|
|
const SUCCESS_QUESTION = "What success criteria should we use?";
|
|
const REPO_URL_QUESTION = "What is the GitHub private repo URL to push to?";
|
|
const COMMIT_MESSAGE_QUESTION = "What should the first commit message be?";
|
|
|
|
test.describe("Question prompt pagination", () => {
|
|
test("shows one question at a time with numbered navigation", async ({ page }) => {
|
|
test.setTimeout(180_000);
|
|
|
|
const session = await seedMockAgentWorkspace({
|
|
repoPrefix: "question-pagination-",
|
|
title: "Question pagination e2e",
|
|
initialPrompt: "Emit synthetic questions.",
|
|
});
|
|
|
|
try {
|
|
await openAgentRoute(page, session);
|
|
await waitForQuestionPrompt(page, 120_000);
|
|
|
|
await expectCurrentQuestion(page, {
|
|
index: 1,
|
|
total: TOTAL_QUESTIONS,
|
|
question: SURFACE_QUESTION,
|
|
});
|
|
await expectQuestionHidden(page, ROLLOUT_QUESTION);
|
|
await expectQuestionHidden(page, SUCCESS_QUESTION);
|
|
|
|
await chooseQuestionOption(page, "App");
|
|
await expectCurrentQuestion(page, {
|
|
index: 2,
|
|
total: TOTAL_QUESTIONS,
|
|
question: ROLLOUT_QUESTION,
|
|
});
|
|
|
|
await openQuestion(page, { index: 1, total: TOTAL_QUESTIONS });
|
|
await expectCurrentQuestion(page, {
|
|
index: 1,
|
|
total: TOTAL_QUESTIONS,
|
|
question: SURFACE_QUESTION,
|
|
});
|
|
await expectQuestionOptionSelected(page, "App");
|
|
|
|
await openQuestion(page, { index: 2, total: TOTAL_QUESTIONS });
|
|
await chooseQuestionOption(page, "Behind feature flag");
|
|
await expectCurrentQuestion(page, {
|
|
index: 3,
|
|
total: TOTAL_QUESTIONS,
|
|
question: SUCCESS_QUESTION,
|
|
});
|
|
|
|
await fillQuestionAnswer(page, {
|
|
question: SUCCESS_QUESTION,
|
|
answer: "Only one prompt is visible at a time.",
|
|
});
|
|
await submitQuestionAnswers(page);
|
|
} finally {
|
|
await session.cleanup();
|
|
}
|
|
});
|
|
|
|
test("free-write questions use Next before final Submit", async ({ page }) => {
|
|
test.setTimeout(180_000);
|
|
|
|
const session = await seedMockAgentWorkspace({
|
|
repoPrefix: "question-free-write-",
|
|
title: "Question free-write e2e",
|
|
initialPrompt: "Emit synthetic questions: two free-write questions.",
|
|
});
|
|
|
|
try {
|
|
await openAgentRoute(page, session);
|
|
await waitForQuestionPrompt(page, 120_000);
|
|
|
|
await expectCurrentQuestion(page, {
|
|
index: 1,
|
|
total: 2,
|
|
question: REPO_URL_QUESTION,
|
|
});
|
|
|
|
await fillQuestionAnswer(page, {
|
|
question: REPO_URL_QUESTION,
|
|
answer: "git@github.com:user/private-repo.git",
|
|
});
|
|
|
|
await expectQuestionPrimaryActionEnabled(page, "Next");
|
|
await expectQuestionDismissEnabled(page);
|
|
await expectQuestionNavigationEnabled(page, { index: 2, total: 2 });
|
|
|
|
await continueToNextQuestion(page);
|
|
await expectCurrentQuestion(page, {
|
|
index: 2,
|
|
total: 2,
|
|
question: COMMIT_MESSAGE_QUESTION,
|
|
});
|
|
await expectQuestionPrimaryActionDisabled(page, "Submit");
|
|
|
|
await fillQuestionAnswer(page, {
|
|
question: COMMIT_MESSAGE_QUESTION,
|
|
answer: "Initialize private repo",
|
|
});
|
|
await expectQuestionPrimaryActionEnabled(page, "Submit");
|
|
await submitQuestionAnswers(page);
|
|
} finally {
|
|
await session.cleanup();
|
|
}
|
|
});
|
|
});
|