39 lines
1.7 KiB
PHP
39 lines
1.7 KiB
PHP
<?php
|
|
/**
|
|
* WEVIA QA HUB — Playwright + Selenium + NonReg
|
|
* Usage: /api/wevia-qa-hub.php?action=playwright|selenium|nonreg|full|status
|
|
*/
|
|
header('Content-Type: application/json');
|
|
$action = $_GET['action'] ?? $_POST['action'] ?? '';
|
|
|
|
switch ($action) {
|
|
case 'playwright':
|
|
$r = trim(shell_exec('timeout 120 python3 /tmp/pw-e2e.py 2>&1'));
|
|
echo $r ?: json_encode(['error'=>'playwright timeout']);
|
|
break;
|
|
case 'selenium':
|
|
$r = trim(shell_exec('timeout 90 python3 /tmp/sel-test.py 2>&1'));
|
|
echo $r ?: json_encode(['error'=>'selenium timeout']);
|
|
break;
|
|
case 'nonreg':
|
|
echo file_get_contents(__DIR__.'/nonreg-latest.json') ?: json_encode(['error'=>'no nonreg data']);
|
|
break;
|
|
case 'full':
|
|
$nr = json_decode(file_get_contents(__DIR__.'/nonreg-latest.json'), true);
|
|
$pw = json_decode(trim(shell_exec('timeout 120 python3 /tmp/pw-e2e.py 2>&1')), true);
|
|
echo json_encode([
|
|
'qa_hub' => 'WEVIA QA Hub v1.0',
|
|
'nonreg' => ['pass'=>$nr['pass']??0,'total'=>$nr['total']??0,'score'=>$nr['score']??0],
|
|
'playwright' => ['pass'=>$pw['pass']??0,'total'=>$pw['total']??0,'pct'=>$pw['pct']??0],
|
|
'timestamp' => date('c')
|
|
], JSON_PRETTY_PRINT);
|
|
break;
|
|
case 'status':
|
|
default:
|
|
echo json_encode([
|
|
'qa_hub' => 'WEVIA QA Hub v1.0',
|
|
'tools' => ['playwright'=>'python','selenium'=>'python+chromium','nonreg'=>'PHP'],
|
|
'endpoints' => ['playwright'=>'/api/wevia-qa-hub.php?action=playwright','selenium'=>'?action=selenium','nonreg'=>'?action=nonreg','full'=>'?action=full']
|
|
], JSON_PRETTY_PRINT);
|
|
}
|