選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

34 行
2.1 KiB

  1. import assert from 'node:assert/strict'
  2. import test from 'node:test'
  3. import { resolveBrowserProof, screenshotProofStatus } from './model-editor-report-evidence.mjs'
  4. const row = { title: '已保存蓝图', rawTitle: '已保存蓝图', status: 'PASS', startTime: '2026-09-06T07:00:00Z', duration: 10000 }
  5. const proof = { testTitle: row.title, status: 'PASS', recordedAt: '2026-09-06T07:00:05Z', kind: 'e2e' }
  6. test('本轮同标题且时间落在实际运行内的证据可关联', () => {
  7. assert.equal(resolveBrowserProof(proof, [row]).status, 'PASS')
  8. })
  9. test('定向重跑成功不得覆盖全量结果中仍然失败的同名用例', () => {
  10. assert.equal(resolveBrowserProof({ ...proof, recordedAt: '2026-09-06T08:00:05Z' }, [{ ...row, status: 'FAIL' }]).status, 'FAIL')
  11. })
  12. test('同名旧证据、未来重跑证据和没有时间的证据不计本轮通过', () => {
  13. for (const recordedAt of ['2026-09-06T06:00:05Z', '2026-09-06T08:00:05Z', undefined])
  14. assert.equal(resolveBrowserProof({ ...proof, recordedAt }, [row]).status, 'PENDING')
  15. })
  16. test('不以标题子串或重复同名跨配置结果推定关联', () => {
  17. assert.equal(resolveBrowserProof({ ...proof, testTitle: '保存' }, [row]).status, 'PENDING')
  18. assert.equal(resolveBrowserProof(proof, [row, { ...row }]).status, 'PENDING')
  19. })
  20. test('没有浏览器 testTitle 的单元证据保留自身状态', () => {
  21. const unit = { title: 'multi-track unit', status: 'PASS', kind: 'unit' }
  22. assert.deepEqual(resolveBrowserProof(unit, []), unit)
  23. })
  24. test('截图必须与当前通过用例的正式附件字节一致', () => {
  25. assert.equal(screenshotProofStatus([{ status: 'PASS', hashMatches: true }]), 'PASS')
  26. assert.equal(screenshotProofStatus([{ status: 'PASS', hashMatches: false }]), 'PENDING')
  27. assert.equal(screenshotProofStatus([]), 'PENDING')
  28. })
  29. test('失败或不稳定用例截图不因同名重拍而标通过', () => {
  30. assert.equal(screenshotProofStatus([{ status: 'FAIL', hashMatches: true }]), 'FAIL')
  31. assert.equal(screenshotProofStatus([{ status: 'PASS', hashMatches: true }, { status: 'WARN', hashMatches: true }]), 'WARN')
  32. })