Skip to content
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
57 changes: 1 addition & 56 deletions .github/workflows/tests_bidi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,12 @@ jobs:
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run biditest -- --retries=${{ matrix.isPullRequest && 2 || 0 }} --project=${{ matrix.channel }}*
env:
PWTEST_USE_BIDI_EXPECTATIONS: ${{ matrix.isPullRequest && '1' || '' }}
# Name the report after the channel so that the publish job can merge all of
# them into one directory without collisions.
- name: Name the csv report after the channel
if: ${{ !cancelled() && hashFiles('test-results/report.csv') != '' }}
run: cp test-results/report.csv "$RUNNER_TEMP/${{ matrix.channel }}.csv"

- name: Upload csv report to GitHub
if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: csv-report-${{ matrix.channel }}
path: ${{ runner.temp }}/${{ matrix.channel }}.csv
path: test-results/report.csv
retention-days: 7

- name: Upload json report to GitHub
Expand All @@ -87,52 +81,3 @@ jobs:
uses: ./.github/actions/upload-parquet-report
with:
job_name: ${{ matrix.channel }}

- name: Add report to the job summary
if: ${{ !cancelled() && hashFiles('test-results/report.md') != '' }}
run: cat test-results/report.md >> "$GITHUB_STEP_SUMMARY"

publish_reports:
name: Publish reports
needs: test_bidi
if: ${{ !cancelled() && github.ref == 'refs/heads/main' && github.repository == 'microsoft/playwright' }}
runs-on: ubuntu-24.04
permissions:
contents: write # This is required to push to the bidi-reports branch
steps:
- name: Download csv reports
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: csv-report-*
merge-multiple: true
path: csv-reports
- name: Publish the reports to the bidi-reports branch
run: |
git init -q "$RUNNER_TEMP/reports"
cd "$RUNNER_TEMP/reports"
git remote add origin "https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git"
git fetch --depth=1 origin bidi-reports
git reset --hard FETCH_HEAD
channels=()
for file in "$GITHUB_WORKSPACE"/csv-reports/*.csv; do
channel=$(basename "$file" .csv)
cp "$file" "$channel.csv"
channels+=("$channel")
done
git add -A
if git diff --cached --quiet; then
echo "No changes since the last run."
exit 0
fi
git commit -q -m "bidi: results for ${GITHUB_SHA:0:9}"
git push origin HEAD:bidi-reports
for channel in "${channels[@]}"; do
echo "Report url: https://github.com/$GITHUB_REPOSITORY/blob/bidi-reports/$channel.csv"
echo "Raw report url: https://github.com/ghraw/$GITHUB_REPOSITORY/bidi-reports/$channel.csv"
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: microsoft-playwright-automation[bot]
GIT_AUTHOR_EMAIL: 203992400+microsoft-playwright-automation[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: microsoft-playwright-automation[bot]
GIT_COMMITTER_EMAIL: 203992400+microsoft-playwright-automation[bot]@users.noreply.github.com
26 changes: 0 additions & 26 deletions tests/bidi/csvReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import path from 'path';

type ReporterOptions = {
outputFile?: string,
markdownFile?: string,
configDir: string,
};

Expand Down Expand Up @@ -77,15 +76,10 @@ class CsvReporter implements Reporter {
}
}
const reportFile = path.resolve(this._options.configDir, this._options.outputFile || 'test-results.csv');
const markdownFile = this._options.markdownFile && path.resolve(this._options.configDir, this._options.markdownFile);
this._pendingWrite = (async () => {
await fs.promises.mkdir(path.dirname(reportFile), { recursive: true });
const csv = [header, ...rows].map(r => r.map(csvEscape).join(',')).join('\n');
await fs.promises.writeFile(reportFile, csv);
if (markdownFile) {
await fs.promises.mkdir(path.dirname(markdownFile), { recursive: true });
await fs.promises.writeFile(markdownFile, markdownTable(rows));
}
})();
}

Expand All @@ -104,24 +98,4 @@ function csvEscape(str) {
return str;
}

// GitHub job summaries are capped at 1MiB, so keep the rendered table bounded.
const maxMarkdownRows = 500;

function markdownTable(rows: string[][]): string {
const lines = [
`### ${rows.length} failing tests`,
'',
`| ${header.join(' | ')} |`,
`| ${header.map(() => '---').join(' | ')} |`,
...rows.slice(0, maxMarkdownRows).map(row => `| ${row.map(markdownEscape).join(' | ')} |`),
];
if (rows.length > maxMarkdownRows)
lines.push('', `_...and ${rows.length - maxMarkdownRows} more, see the csv report._`);
return lines.join('\n') + '\n';
}

function markdownEscape(str: string): string {
return str.replace(/[\\|`<>]/g, c => '\\' + c);
}

export default CsvReporter;
2 changes: 1 addition & 1 deletion tests/bidi/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const reporters = () => {
['json', { outputFile: path.join(outputDir, 'report.json') }],
['blob'],
['../config/parquetReporter.ts'],
['./csvReporter', { outputFile: path.join(outputDir, 'report.csv'), markdownFile: path.join(outputDir, 'report.md') }],
['./csvReporter', { outputFile: path.join(outputDir, 'report.csv') }],
['./expectationReporter', { rebase: false }],
] : [
['html', { open: 'on-failure' }],
Expand Down
Loading