headless-browser: Create the expectation directory if it doesn't exist

This is convenient when adding tests to a new folder.
This commit is contained in:
Timothy Flynn 2024-11-15 11:08:09 -05:00 committed by Andreas Kling
parent 6affbf78c2
commit 077ae6efa1
Notes: github-actions[bot] 2024-11-17 22:22:58 +00:00

View file

@ -143,6 +143,8 @@ void run_dump_test(HeadlessWebView& view, Test& test, URL::URL const& url, int t
} }
if (Application::the().rebaseline) { if (Application::the().rebaseline) {
TRY(Core::Directory::create(LexicalPath { test.expectation_path }.parent().string(), Core::Directory::CreateDirectories::Yes));
auto expectation_file = TRY(open_expectation_file(Core::File::OpenMode::Write)); auto expectation_file = TRY(open_expectation_file(Core::File::OpenMode::Write));
TRY(expectation_file->write_until_depleted(test.text)); TRY(expectation_file->write_until_depleted(test.text));