refactor(e2e): remove old custom test runner
This commit is contained in:
parent
7900f264ba
commit
ef8bf10555
1 changed files with 0 additions and 49 deletions
|
|
@ -1,49 +0,0 @@
|
||||||
// tests/e2e/helpers.js
|
|
||||||
// Shared utilities for Porchlight e2e tests.
|
|
||||||
|
|
||||||
const { chromium } = require('playwright');
|
|
||||||
|
|
||||||
const TARGET_URL = process.env.TARGET_URL || 'http://localhost:8099';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simple test runner with pass/fail counting.
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* const { run } = require('./helpers');
|
|
||||||
* run(async (page, assert) => {
|
|
||||||
* await page.goto(TARGET_URL + '/login');
|
|
||||||
* assert(true, 'page loaded');
|
|
||||||
* });
|
|
||||||
*/
|
|
||||||
async function run(testFn) {
|
|
||||||
let passed = 0;
|
|
||||||
let failed = 0;
|
|
||||||
|
|
||||||
function assert(condition, description) {
|
|
||||||
if (condition) {
|
|
||||||
console.log(` PASS: ${description}`);
|
|
||||||
passed++;
|
|
||||||
} else {
|
|
||||||
console.log(` FAIL: ${description}`);
|
|
||||||
failed++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const headless = process.env.E2E_HEADLESS !== '0';
|
|
||||||
const browser = await chromium.launch({ headless });
|
|
||||||
const page = await browser.newPage();
|
|
||||||
|
|
||||||
try {
|
|
||||||
await testFn(page, assert);
|
|
||||||
} finally {
|
|
||||||
await browser.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`\n========================================`);
|
|
||||||
console.log(`Results: ${passed} passed, ${failed} failed`);
|
|
||||||
console.log(`========================================\n`);
|
|
||||||
|
|
||||||
process.exit(failed > 0 ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = { TARGET_URL, run };
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue