From 5630a0d6b44c3599f8a70b07dc294080dcb50ae1 Mon Sep 17 00:00:00 2001 From: stelar7 Date: Tue, 29 Oct 2024 14:19:14 +0100 Subject: [PATCH] Meta: Add a script to import WPT tests --- Meta/import-wpt-test.py | 142 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100755 Meta/import-wpt-test.py diff --git a/Meta/import-wpt-test.py b/Meta/import-wpt-test.py new file mode 100755 index 00000000000..4cbe0a2cc44 --- /dev/null +++ b/Meta/import-wpt-test.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python3 + +import os +import sys +from pathlib import Path +from bs4 import BeautifulSoup +from urllib.request import urlopen +from collections import namedtuple + +wpt_base_url = 'https://wpt.live/' +wpt_import_path = 'Tests/LibWeb/Text/input/wpt-import' +wpt_expected_path = 'Tests/LibWeb/Text/expected/wpt-import' +PathMapping = namedtuple('PathMapping', ['source', 'destination']) + + +def get_script_sources(page_source): + # Find all the