Skip to content
Closed
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
3 changes: 3 additions & 0 deletions VKUI/reporter/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
playwrightReportURL:
required: false
description: 'HTML Playwright Report URL for publish comment'
axeReportURL:
required: false
description: 'HTML Axe Accessibility Report URL for publish comment'
token:
required: false
description: 'token with access to your repository'
Expand Down
3 changes: 2 additions & 1 deletion VKUI/reporter/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ async function run(): Promise<void> {
}

const playwrightReportURL = core.getInput('playwrightReportURL', { required: false });
const axeReportURL = core.getInput('axeReportURL', { required: false });
const token = core.getInput('token', { required: false });

if (playwrightReportURL && token) {
jobs.push(playwrightReport(playwrightReportURL, token));
jobs.push(playwrightReport(token, playwrightReportURL, axeReportURL));
}

await Promise.all(jobs);
Expand Down
24 changes: 22 additions & 2 deletions VKUI/reporter/src/playwrightReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ function hasFailedScreenshots() {
return isDataDirExist || isTraceDirExist;
}

export async function playwrightReport(url: string, token: string) {
export async function playwrightReport(
token: string,
playwrightReportUrl: string,
axeReportUrl?: string,
) {
const gh = github.getOctokit(token);
const comment = new GitHubCommentBuilder(gh);

Expand All @@ -22,7 +26,23 @@ export async function playwrightReport(url: string, token: string) {
message.push('> ⚠️ Some screenshots were failed. See Playwright Report. \n\n');
}

message.push(`<a href="${url}" target="_blank">Playwright Report</a>`.replace(/(^|\n) +/g, ''));
message.push(
`<a href="${playwrightReportUrl}" target="_blank">Playwright Report</a>`.replace(
/(^|\n) +/g,
'',
),
);

if (axeReportUrl) {
message.push('## ♿ a11y tests\n\n');

message.push(
`<a href="${axeReportUrl}" target="_blank">Axe Accessibility Report</a>`.replace(
/(^|\n) +/g,
'',
),
);
}

comment.add(message.join(' '));
await comment.write();
Expand Down