Skip to content
This repository was archived by the owner on Jul 14, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const buildCmd = (): Command => {
"--persist",
"if we should write playwright config and files to current directory, you can then run 'npx playwright test' to run them again",
)
.option("--grep <substring>", "filter test cases by substring")
.action(async (options, command) => {
const resolvedTestTargetId = await resolveTestTargetId(
options.testTargetId,
Expand Down
30 changes: 21 additions & 9 deletions src/debugtopus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type DebugtopusOptions = {
environmentId?: string;
headless?: boolean;
persist?: boolean;
grep?: string;
};

const getPackageRootLevel = (appDir: string): string => {
Expand Down Expand Up @@ -180,20 +181,31 @@ export const runDebugtopus = async (options: DebugtopusOptions) => {
},
];
} else {
const testCases = await getTestCases(baseApiOptions);
const testCases = await getTestCases({
...baseApiOptions,
status: "ENABLED",
});
if (!testCases) {
throw new Error("no test cases found");
}

testCasesWithCode = await Promise.all(
testCases.map(async (testCase) => ({
code: await getPlaywrightCode({
testCaseId: testCase.id,
executionUrl: options.url,
...baseApiOptions,
}),
...testCase,
})),
testCases
.filter((testCase) =>
options.grep
? testCase.description
?.toLowerCase()
.includes(options.grep.toLowerCase())
: true,
)
.map(async (testCase) => ({
code: await getPlaywrightCode({
testCaseId: testCase.id,
executionUrl: options.url,
...baseApiOptions,
}),
...testCase,
})),
);
}

Expand Down
5 changes: 4 additions & 1 deletion src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ export const getNotifications = async (
export const getTestCase = async (
options: getTestCaseParams & { json?: boolean },
): Promise<void> => {
console.log(options);
const { data, error } = await client.GET(
"/apiKey/v2/test-targets/{testTargetId}/test-cases/{testCaseId}",
{
Expand Down Expand Up @@ -662,6 +661,7 @@ export const getPlaywrightCode = async (options: {

export const getTestCases = async (options: {
testTargetId: string;
status?: string;
json?: boolean;
}): Promise<TestCasesResponse> => {
const { data, error } = await client.GET(
Expand All @@ -671,6 +671,9 @@ export const getTestCases = async (options: {
path: {
testTargetId: options.testTargetId,
},
query: {
filter: JSON.stringify({ status: options.status }),
},
},
},
);
Expand Down