plum-e2e 2.4.4 → 2.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/backend/server.js CHANGED
@@ -87,6 +87,11 @@ async function start() {
87
87
  return;
88
88
  }
89
89
 
90
+ // Sync automated flags from feature files on every startup
91
+ require('./services/reportService')
92
+ .syncAutomatedFromFeatures()
93
+ .catch(() => {});
94
+
90
95
  // chokidar v5+ is ESM-only — use dynamic import to stay compatible with CJS
91
96
  let chokidar;
92
97
  try {
@@ -109,6 +114,9 @@ async function start() {
109
114
  `📝 Tests changed (${event}: ${path.basename(filePath)}) — notifying clients`
110
115
  );
111
116
  io.emit('tests-changed');
117
+ require('./services/reportService')
118
+ .syncAutomatedFromFeatures()
119
+ .catch(() => {});
112
120
  }, 300);
113
121
  });
114
122
  console.log('👀 Watching for test file changes...');
@@ -400,12 +400,33 @@ const deleteReports = async (ids) => {
400
400
  await prisma.report.deleteMany({ where: { id: { in: ids } } });
401
401
  };
402
402
 
403
+ const FEATURES_DIR = path.join(__dirname, '../tests/features');
404
+
405
+ async function syncAutomatedFromFeatures() {
406
+ try {
407
+ if (!fs.existsSync(FEATURES_DIR)) return;
408
+ const tagSet = new Set();
409
+ for (const file of fs.readdirSync(FEATURES_DIR).filter((f) => f.endsWith('.feature'))) {
410
+ const content = fs.readFileSync(path.join(FEATURES_DIR, file), 'utf8');
411
+ for (const m of content.matchAll(/@(\S+)/g)) tagSet.add(m[1]);
412
+ }
413
+ if (tagSet.size === 0) return;
414
+ await prisma.testCase.updateMany({
415
+ where: { displayId: { in: [...tagSet] }, isAutomated: false },
416
+ data: { isAutomated: true }
417
+ });
418
+ } catch (e) {
419
+ console.error('[sync] syncAutomatedFromFeatures failed:', e.message);
420
+ }
421
+ }
422
+
403
423
  module.exports = {
404
424
  getAllReports,
405
425
  getLatestReportId,
406
426
  getReportDetail,
407
427
  saveReport,
408
428
  saveCombinedReport,
429
+ syncAutomatedFromFeatures,
409
430
  deleteReport,
410
431
  deleteReports
411
432
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plum-e2e",
3
- "version": "2.4.4",
3
+ "version": "2.4.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/silverlunah/plum.git"