@@ -221,15 +221,29 @@ jobs:
221221 name : playwright-artifacts
222222 path : playwright-artifacts
223223
224+ - name : Fetch gh-pages branch
225+ run : |
226+ git fetch origin gh-pages:gh-pages
227+ mkdir gh-pages
228+ git --work-tree=gh-pages checkout gh-pages -- .
229+
224230 - name : Update PR description
225231 uses : actions/github-script@v6
226232 with :
227233 github-token : ${{secrets.GITHUB_TOKEN}}
228234 script : |
229235 const fs = require('fs');
230236 const testResultsPath = 'playwright-artifacts/test-results.json';
237+ const mainTestResultsPath = 'gh-pages/main/test-results.json';
231238 let testResults;
239+ let mainTestResults;
240+ let testComparison = {
241+ new: [],
242+ skipped: [],
243+ deleted: []
244+ };
232245
246+ // Read current PR test results
233247 if (fs.existsSync(testResultsPath)) {
234248 const rawData = fs.readFileSync(testResultsPath);
235249 const data = JSON.parse(rawData);
@@ -238,11 +252,60 @@ jobs:
238252 passed: data.stats.expected,
239253 failed: data.stats.unexpected,
240254 flaky: data.stats.flaky,
241- skipped: data.stats.skipped
255+ skipped: data.stats.skipped,
256+ tests: data.suites.flatMap(suite =>
257+ suite.specs.map(spec => ({
258+ title: `${suite.title} ${spec.title}`,
259+ status: spec.ok ? 'passed' : spec.skipped ? 'skipped' : 'failed'
260+ }))
261+ )
242262 };
243263 } else {
244264 console.log('Test results file not found');
245- testResults = { total: 0, passed: 0, failed: 0, flaky: 0, skipped: 0 };
265+ testResults = { total: 0, passed: 0, failed: 0, flaky: 0, skipped: 0, tests: [] };
266+ }
267+
268+ // Read main branch test results
269+ if (fs.existsSync(mainTestResultsPath)) {
270+ const rawData = fs.readFileSync(mainTestResultsPath);
271+ const data = JSON.parse(rawData);
272+ mainTestResults = {
273+ tests: data.suites.flatMap(suite =>
274+ suite.specs.map(spec => ({
275+ title: `${suite.title} ${spec.title}`,
276+ status: spec.ok ? 'passed' : spec.skipped ? 'skipped' : 'failed'
277+ }))
278+ )
279+ };
280+
281+ // Compare tests
282+ const currentTests = new Set(testResults.tests.map(t => t.title));
283+ const mainTests = new Set(mainTestResults.tests.map(t => t.title));
284+
285+ // Find new tests
286+ testResults.tests.forEach(test => {
287+ if (!mainTests.has(test.title)) {
288+ testComparison.new.push(test.title);
289+ }
290+ });
291+
292+ // Find deleted tests
293+ mainTestResults.tests.forEach(test => {
294+ if (!currentTests.has(test.title)) {
295+ testComparison.deleted.push(test.title);
296+ }
297+ });
298+
299+ // Find newly skipped tests
300+ testResults.tests.forEach(test => {
301+ const mainTest = mainTestResults.tests.find(t => t.title === test.title);
302+ if (mainTest && mainTest.status !== 'skipped' && test.status === 'skipped') {
303+ testComparison.skipped.push(test.title);
304+ }
305+ });
306+ } else {
307+ console.log('Main branch test results file not found');
308+ mainTestResults = { tests: [] };
246309 }
247310
248311 const reportUrl = `https://${context.repo.owner}.github.io/${context.repo.repo}/${context.issue.number}/`;
@@ -274,6 +337,28 @@ jobs:
274337 |:-----:|:------:|:------:|:-----:|:-------:|
275338 | ${testResults.total} | ${testResults.passed} | ${testResults.failed} | ${testResults.flaky} | ${testResults.skipped} |
276339
340+ <details>
341+ <summary>Test Changes Summary</summary>
342+
343+ ${testComparison.new.length > 0 ? `
344+ #### 🆕 New Tests:
345+ ${testComparison.new.map(test => `- ${test}`).join('\n')}
346+ ` : ''}
347+
348+ ${testComparison.skipped.length > 0 ? `
349+ #### ⏭️ Newly Skipped Tests:
350+ ${testComparison.skipped.map(test => `- ${test}`).join('\n')}
351+ ` : ''}
352+
353+ ${testComparison.deleted.length > 0 ? `
354+ #### 🗑️ Deleted Tests:
355+ ${testComparison.deleted.map(test => `- ${test}`).join('\n')}
356+ ` : ''}
357+
358+ ${testComparison.new.length === 0 && testComparison.skipped.length === 0 && testComparison.deleted.length === 0 ?
359+ '✅ No test changes detected' : ''}
360+ </details>
361+
277362 ### Bundle Size: ${bundleStatus}
278363 Current: ${formatSize(currentSize)} | Main: ${formatSize(mainSize)}
279364 Diff: ${diff > 0 ? '+' : ''}${formatSize(Math.abs(diff))} (${percent === 'N/A' ? 'N/A' : `${percent}%`})
0 commit comments