import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; import { containsPhpDiagnostic } from '../e2e/response-diagnostics.mjs'; test( 'response diagnostics catch plain and display_errors PHP failures without normal prose', () => { for ( const diagnostic of [ 'PHP Warning: Undefined variable $story', 'Warning: Undefined variable $story', 'Warning: Undefined variable $story
', 'PHP Notice: Undefined index: story', 'Notice: Undefined index: story', 'Notice: Undefined index: story
', 'PHP Fatal error: Uncaught Error', 'Fatal error: Uncaught Error', 'Fatal error: Uncaught Error
', 'PHP Parse error: unexpected token', 'Parse error: unexpected token', 'Parse error: unexpected token
', 'PHP Deprecated: Optional parameter', 'Deprecated: Optional parameter', 'Deprecated: Optional parameter
', ] ) { assert.equal( containsPhpDiagnostic( diagnostic ), true, diagnostic ); } for ( const prose of [ 'Warning signs can make a story more useful.', 'A notice board hangs beside the door.', 'The album Deprecated Futures is available now.', 'Fatal Error is the title of a fictional game.', 'Parse errors carefully when reviewing a compiler.', ] ) { assert.equal( containsPhpDiagnostic( prose ), false, prose ); } } ); test( 'WebKit native scroll uses a focused rail and a real keyboard gesture', async () => { const source = await readFile( 'tests/e2e/related-stories.spec.mjs', 'utf8' ); const helper = source.match( /async function scrollRailNatively[\s\S]*?\n}\n\ntest\.describe\.serial/, )?.[ 0 ]; assert.ok( helper, 'native scroll helper must remain inspectable' ); assert.doesNotMatch( helper, /track\.evaluate|\.scrollBy\s*\(/ ); assert.match( helper, /track\.focus\(\)[\s\S]*keyboard\.press\(\s*['"]ArrowRight['"]\s*\)/ ); } );