Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tip for refreshing the report #355

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion apps/site/docs/en/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ There are multiple agents in Midscene, each with its own constructor.
Here are the common options for all agents:

* `generateReport: boolean`: If true, the agent will generate a report file. Default is true.
* `autoPrintReportMsg: boolean`: If true, the agent will print the report message. Default is true.
* `autoPrintReportMsg: boolean`: If true, the agent will print the report message once generated. Default is true.
* `cacheId: string | undefined`: If set, the agent will use this cacheId to match the cache. Default is undefined.

And also, puppeteer agent has an extra option:
Expand Down
2 changes: 1 addition & 1 deletion apps/site/docs/zh/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Midscene 中每个 Agent 都有自己的构造函数。
这些 Agent 有一些相同的构造参数:

* `generateReport: boolean`: 如果为 true,则生成报告文件。默认值为 true。
* `autoPrintReportMsg: boolean`: 如果为 true,则打印报告消息。默认值为 true。
* `autoPrintReportMsg: boolean`: 如果为 true,则生成报告后自动打印报告信息。默认值为 true。
* `cacheId: string | undefined`: 如果配置,则使用此 cacheId 匹配缓存。默认值为 undefined。

在 puppeteer 中,还有一个额外的参数:
Expand Down
7 changes: 5 additions & 2 deletions packages/web-integration/src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@ export function reportFileName(tag = 'web') {
return `${reportTagName || tag}-${dateTimeInFileName}`;
}

export function printReportMsg(filepath: string) {
console.log('Midscene - report file updated:', filepath);
export function printReportMsg(
filepath: string,
prefix = 'Midscene - report file updated:',
) {
console.log(prefix, filepath);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/web-integration/src/playwright/ai-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const PlaywrightAiFixture = () => {
cacheId: `${taskFile}(${taskTitle})`,
groupName: taskTitle,
groupDescription: taskFile,
generateReport: false, // we will generate it in the reporter
generateReport: true,
});
}
return pageAgentMap[idForPage];
Expand Down
4 changes: 1 addition & 3 deletions packages/web-integration/src/playwright/reporter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ const testDataList: Array<ReportDumpWithAttributes> = [];
let filename: string;
function updateReport() {
const reportPath = writeDumpReport(filename, testDataList);
reportPath && printReportMsg(reportPath);
reportPath && printReportMsg(reportPath, 'Midscene - merged report file:');
}

class MidsceneReporter implements Reporter {
async onBegin(config: FullConfig, suite: Suite) {
if (!filename) {
filename = reportFileName('playwright-merged');
}
// const suites = suite.allTests();
// logger(`Starting the run with ${suites.length} tests`);
}

onTestBegin(test: TestCase, _result: TestResult) {
Expand Down
Loading