|
- import assert from 'node:assert/strict'
- import test from 'node:test'
- import { matchesSceneScreenshotAttachment, isSceneUnitProof } from './scene-editor-report-evidence.mjs'
- test('extensionless Playwright attachment name associates with the original PNG', () => {
- assert.equal(matchesSceneScreenshotAttachment('33-fox.png', { name: '33-fox', path: 'attachments/33-fox-<hash>.png' }), true)
- })
- test('exact filename and portable Windows attachment path are recognized', () => {
- assert.equal(matchesSceneScreenshotAttachment('33-fox.png', { name: '33-fox.png' }), true)
- assert.equal(matchesSceneScreenshotAttachment('33-fox.png', { name: 'screenshot', path: 'E:\\report\\screenshots\\33-fox.png' }), true)
- })
- test('neighboring names never become a screenshot association', () => {
- assert.equal(matchesSceneScreenshotAttachment('33-fox.png', { name: '33-fox-failure', path: 'attachments/failure.png' }), false)
- assert.equal(matchesSceneScreenshotAttachment('33-fox.png', { name: '34-truck' }), false)
- })
- test('unit titles remain unit evidence and browser titles use the final Playwright run', () => {
- assert.equal(isSceneUnitProof({ kind: 'unit', testTitle: 'unit case' }), true)
- assert.equal(isSceneUnitProof({ kind: 'api', testTitle: 'API contract' }), true)
- assert.equal(isSceneUnitProof({ kind: 'browser', testTitle: 'UI case' }), false)
- assert.equal(isSceneUnitProof({ kind: '真实UI+只读投影', testTitle: 'UI case' }), false)
- })
|