Files
ladybird/Tests/LibWeb/test-web/TestWeb.h
Andreas Kling b5e01df79d test-web: Add results directory and live terminal display
- Add --results-dir CLI flag to specify output directory
- Default to {tempdir}/test-web-results if not specified
- Capture stdout/stderr from all helper processes (WebContent,
  RequestServer, ImageDecoder) to prevent output spam
- Save captured output to per-test files in results directory
- Save test diffs (expected vs actual) to results directory
- Generate HTML index of failed tests with links to diffs
- Display live-updating concurrent test status with progress bar
- Defer warning messages until after test run completes
2026-01-13 21:05:58 +01:00

79 lines
1.5 KiB
C++

/*
* Copyright (c) 2024-2025, Tim Flynn <trflynn89@ladybird.org>
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "Fuzzy.h"
#include <AK/ByteString.h>
#include <AK/RefPtr.h>
#include <AK/String.h>
#include <AK/Time.h>
#include <AK/Vector.h>
#include <LibCore/Forward.h>
#include <LibCore/Promise.h>
#include <LibGfx/Forward.h>
namespace TestWeb {
enum class TestMode {
Layout,
Text,
Ref,
Crash,
};
enum class TestResult {
Pass,
Fail,
Skipped,
Timeout,
Crashed,
};
enum class RefTestExpectationType {
Match,
Mismatch,
};
struct Test {
TestMode mode;
ByteString input_path {};
ByteString expectation_path {};
ByteString relative_path {};
UnixDateTime start_time {};
UnixDateTime end_time {};
size_t index { 0 };
String text {};
bool did_finish_test { false };
bool did_finish_loading { false };
Optional<RefTestExpectationType> ref_test_expectation_type {};
Vector<FuzzyMatch> fuzzy_matches {};
RefPtr<Gfx::Bitmap const> actual_screenshot {};
RefPtr<Gfx::Bitmap const> expectation_screenshot {};
RefPtr<Core::Timer> timeout_timer {};
};
struct TestCompletion {
Test& test;
TestResult result;
};
using TestPromise = Core::Promise<TestCompletion>;
// Deferred warning system - buffers warnings during live display mode
void add_deferred_warning(ByteString message);
void print_deferred_warnings();
}