/**
 * Test Infrastructure Library
 *
 * Single import point for all test utilities:
 *
 * const { setupTest, teardownTest, TestResults, log } = require('./test_lib');
 *
 * Example usage:
 *
 *   const { setupTest, teardownTest, TestResults, log } = require('./test_lib');
 *
 *   async function runTests() {
 *       const ctx = await setupTest({ authenticate: true });
 *       const results = new TestResults('My Test Suite');
 *
 *       try {
 *           log.section('Form Tests');
 *
 *           await results.run('Forms', 'Query input exists', async () => {
 *               await ctx.page.goto(`${ctx.config.baseUrl}/`);
 *               const input = await ctx.page.$('#query');
 *               if (!input) throw new Error('Query input not found');
 *           }, { page: ctx.page });
 *
 *       } finally {
 *           results.print();
 *           results.save();
 *           await teardownTest(ctx);
 *           process.exit(results.exitCode());
 *       }
 *   }
 *
 *   runTests();
 */

const {
    config,
    viewports,
    setupTest,
    teardownTest,
    screenshot,
    delay,
    withTimeout,
    navigateTo,
    waitFor,
    waitForVisible,
    clickAndWaitForNavigation,
    getInputValue,
    clearAndType,
    findActionButton,
    log,
} = require('./test_utils');

const { TestResults, escapeXml } = require('./test_results');

module.exports = {
    // Configuration
    config,
    viewports,

    // Setup/Teardown
    setupTest,
    teardownTest,

    // Utilities
    screenshot,
    delay,
    withTimeout,
    navigateTo,
    waitFor,
    waitForVisible,
    clickAndWaitForNavigation,
    getInputValue,
    clearAndType,
    findActionButton,

    // Logging
    log,

    // Results
    TestResults,
    escapeXml,
};
