test: add integration tests

This commit is contained in:
Julien Neuhart
2025-03-21 11:18:20 +01:00
parent 820b914291
commit 0febb60a3f
139 changed files with 7561 additions and 16381 deletions

View File

@@ -0,0 +1,64 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- net::ERR_CONNECTION_REFUSED -->
<link
rel="stylesheet"
type="text/css"
href="http://localhost:100/style.css"
/>
<title>Feature Rich HTML</title>
<style>
@media print {
#screen {
display: none;
}
}
@media screen {
#print {
display: none;
}
}
</style>
</head>
<body>
<p id="wait" style="display: none">
Wait delay > 2 seconds or expression window globalVar === 'ready' returns
true.
</p>
<p id="print">Emulated media type is 'print'.</p>
<p id="screen">Emulated media type is 'screen'.</p>
<p id="javascript" style="display: none">JavaScript is enabled.</p>
<iframe src="file:///etc/passwd"></iframe>
<script type="application/javascript">
var globalVar = "notReady";
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
delay(2000).then(() => {
document.getElementById("wait").style.display = "contents";
window.globalVar = "ready";
});
</script>
<script type="application/javascript">
document.getElementById("javascript").style.display = "contents";
</script>
<script type="application/javascript">
console.log("a simple message");
console.debug("a debug message");
console.warn("a warning message");
console.error("an error message");
</script>
<script type="application/javascript">
throw new Error("Exception 1");
</script>
<script type="application/javascript">
throw new Error("Exception 2");
</script>
</body>
</html>

View File

@@ -0,0 +1,69 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- net::ERR_FILE_NOT_FOUND -->
<link rel="stylesheet" type="text/css" href="doesnotexist.css" />
<!-- net::ERR_CONNECTION_REFUSED -->
<link
rel="stylesheet"
type="text/css"
href="http://localhost:100/style.css"
/>
<!-- 400 Bad Request -->
<link rel="stylesheet" type="text/css" href="https://httpstat.us/400" />
<title>Feature Rich HTML</title>
<style>
@media print {
#screen {
display: none;
}
}
@media screen {
#print {
display: none;
}
}
</style>
</head>
<body>
<p id="wait" style="display: none">
Wait delay > 2 seconds or expression window globalVar === 'ready' returns
true.
</p>
<p id="print">Emulated media type is 'print'.</p>
<p id="screen">Emulated media type is 'screen'.</p>
<p id="javascript" style="display: none">JavaScript is enabled.</p>
<iframe src="/etc/passwd"></iframe>
<iframe src="\\localhost/etc/passwd"></iframe>
<script type="application/javascript">
var globalVar = "notReady";
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
delay(2000).then(() => {
document.getElementById("wait").style.display = "contents";
window.globalVar = "ready";
});
</script>
<script type="application/javascript">
document.getElementById("javascript").style.display = "contents";
</script>
<script type="application/javascript">
console.log("a simple message");
console.debug("a debug message");
console.warn("a warning message");
console.error("an error message");
</script>
<script type="application/javascript">
throw new Error("Exception 1");
</script>
<script type="application/javascript">
throw new Error("Exception 2");
</script>
</body>
</html>

View File

@@ -0,0 +1,70 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- net::ERR_FILE_NOT_FOUND -->
<link rel="stylesheet" type="text/css" href="doesnotexist.css" />
<!-- net::ERR_CONNECTION_REFUSED -->
<link
rel="stylesheet"
type="text/css"
href="http://localhost:100/style.css"
/>
<!-- 400 Bad Request -->
<link rel="stylesheet" type="text/css" href="https://httpstat.us/400" />
<title>Feature Rich HTML</title>
<style>
@media print {
#screen {
display: none;
}
}
@media screen {
#print {
display: none;
}
}
</style>
</head>
<body>
{{ toHTML "table.md" }}
<p id="wait" style="display: none">
Wait delay > 2 seconds or expression window globalVar === 'ready' returns
true.
</p>
<p id="print">Emulated media type is 'print'.</p>
<p id="screen">Emulated media type is 'screen'.</p>
<p id="javascript" style="display: none">JavaScript is enabled.</p>
<iframe src="/etc/passwd"></iframe>
<iframe src="\\localhost/etc/passwd"></iframe>
<script type="application/javascript">
var globalVar = "notReady";
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
delay(2000).then(() => {
document.getElementById("wait").style.display = "contents";
window.globalVar = "ready";
});
</script>
<script type="application/javascript">
document.getElementById("javascript").style.display = "contents";
</script>
<script type="application/javascript">
console.log("a simple message");
console.debug("a debug message");
console.warn("a warning message");
console.error("an error message");
</script>
<script type="application/javascript">
throw new Error("Exception 1");
</script>
<script type="application/javascript">
throw new Error("Exception 2");
</script>
</body>
</html>

View File

@@ -0,0 +1,7 @@
## This paragraph displays a table from a markdown file
| Tables | Are | Cool |
| -------- | :-----------: | ----: |
| col 1 is | left-aligned | $1600 |
| col 2 is | centered | $12 |
| col 3 is | right-aligned | $1 |

View File

@@ -0,0 +1,13 @@
<html>
<head>
<style>
body {
font-size: 12px;
margin: auto 20px;
}
</style>
</head>
<body>
<p><span class="pageNumber"></span> of <span class="totalPages"></span></p>
</body>
</html>

View File

@@ -0,0 +1,13 @@
<html>
<head>
<style>
body {
font-size: 12px;
margin: auto 20px;
}
</style>
</head>
<body>
<span class="title"></span>
</body>
</html>

View File

@@ -0,0 +1,9 @@
<!doctype html>
<html lang="en">
<head>
<title>Page 1</title>
</head>
<body>
<h1>Page 1</h1>
</body>
</html>

View File

@@ -0,0 +1,9 @@
<!doctype html>
<html lang="en">
<head>
<title>Page 1</title>
</head>
<body>
{{ toHTML "page_1.md" }}
</body>
</html>

View File

@@ -0,0 +1 @@
# Page 1

BIN
test/integration/testdata/page_1.docx vendored Normal file

Binary file not shown.

BIN
test/integration/testdata/page_1.pdf vendored Normal file

Binary file not shown.

BIN
test/integration/testdata/page_2.docx vendored Normal file

Binary file not shown.

BIN
test/integration/testdata/page_2.pdf vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,25 @@
<!doctype html>
<html lang="en">
<head>
<title>Pages 12</title>
<style>
.page-break-after {
page-break-after: always;
}
</style>
</head>
<body>
<h1 class="page-break-after">Page 1</h1>
<h1 class="page-break-after">Page 2</h1>
<h1 class="page-break-after">Page 3</h1>
<h1 class="page-break-after">Page 4</h1>
<h1 class="page-break-after">Page 5</h1>
<h1 class="page-break-after">Page 6</h1>
<h1 class="page-break-after">Page 7</h1>
<h1 class="page-break-after">Page 8</h1>
<h1 class="page-break-after">Page 9</h1>
<h1 class="page-break-after">Page 10</h1>
<h1 class="page-break-after">Page 11</h1>
<h1 class="page-break-after">Page 12</h1>
</body>
</html>

View File

@@ -0,0 +1,25 @@
<!doctype html>
<html lang="en">
<head>
<title>Pages 12</title>
<style>
.page-break-after {
page-break-after: always;
}
</style>
</head>
<body>
<div class="page-break-after">{{ toHTML "page_1.md" }}</div>
<div class="page-break-after">{{ toHTML "page_2.md" }}</div>
<div class="page-break-after">{{ toHTML "page_3.md" }}</div>
<div class="page-break-after">{{ toHTML "page_4.md" }}</div>
<div class="page-break-after">{{ toHTML "page_5.md" }}</div>
<div class="page-break-after">{{ toHTML "page_6.md" }}</div>
<div class="page-break-after">{{ toHTML "page_7.md" }}</div>
<div class="page-break-after">{{ toHTML "page_8.md" }}</div>
<div class="page-break-after">{{ toHTML "page_9.md" }}</div>
<div class="page-break-after">{{ toHTML "page_10.md" }}</div>
<div class="page-break-after">{{ toHTML "page_11.md" }}</div>
<div class="page-break-after">{{ toHTML "page_12.md" }}</div>
</body>
</html>

View File

@@ -0,0 +1 @@
# Page 1

View File

@@ -0,0 +1 @@
# Page 10

View File

@@ -0,0 +1 @@
# Page 11

View File

@@ -0,0 +1 @@
# Page 12

View File

@@ -0,0 +1 @@
# Page 2

View File

@@ -0,0 +1 @@
# Page 3

View File

@@ -0,0 +1 @@
# Page 4

View File

@@ -0,0 +1 @@
# Page 5

View File

@@ -0,0 +1 @@
# Page 6

View File

@@ -0,0 +1 @@
# Page 7

View File

@@ -0,0 +1 @@
# Page 8

View File

@@ -0,0 +1 @@
# Page 9

View File

@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<title>Pages 3</title>
<style>
.page-break-after {
page-break-after: always;
}
</style>
</head>
<body>
<h1 class="page-break-after">Page 1</h1>
<h1 class="page-break-after">Page 2</h1>
<h1 class="page-break-after">Page 3</h1>
</body>
</html>

View File

@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<title>Pages 3</title>
<style>
.page-break-after {
page-break-after: always;
}
</style>
</head>
<body>
<div class="page-break-after">{{ toHTML "page_1.md" }}</div>
<div class="page-break-after">{{ toHTML "page_2.md" }}</div>
<div class="page-break-after">{{ toHTML "page_3.md" }}</div>
</body>
</html>

View File

@@ -0,0 +1 @@
# Page 1

View File

@@ -0,0 +1 @@
# Page 2

View File

@@ -0,0 +1 @@
# Page 3

BIN
test/integration/testdata/pages_12.docx vendored Normal file

Binary file not shown.

BIN
test/integration/testdata/pages_12.pdf vendored Normal file

Binary file not shown.

BIN
test/integration/testdata/pages_3.docx vendored Normal file

Binary file not shown.

BIN
test/integration/testdata/pages_3.pdf vendored Normal file

Binary file not shown.

14
test/integration/testdata/pem/README.md vendored Normal file
View File

@@ -0,0 +1,14 @@
To generate a valid certificate and private key use the following command:
```bash
# In OpenSSL ≥ 1.1.1
openssl req -x509 -newkey rsa:4096 -sha256 -days 9999 -nodes \
-keyout key.pem -out cert.pem -subj "/CN=localhost" \
-addext "subjectAltName=DNS:localhost,IP:127.0.0.1,IP:::1"
```
To check a certificate use the following command:
```bash
openssl x509 -in cert.pem -text
```

30
test/integration/testdata/pem/cert.pem vendored Normal file
View File

@@ -0,0 +1,30 @@
-----BEGIN CERTIFICATE-----
MIIFOjCCAyKgAwIBAgIUZaht2QoZwWDK8wEuwm+wmip9sqwwDQYJKoZIhvcNAQEL
BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MCAXDTI0MDUyNjA1MDExNFoYDzIwNTEx
MDExMDUwMTE0WjAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQCm3TNckD55ae6pxXS03iV2P3X/edZT4vRa8D15elsi
CSRf6mdU2TVAQyg22GEcMXgsbba7sotJVg7559LkWAgb3Dj9rbPputdS29ebncat
x1nzo1QHMCS/v7nWoPe9fQVlDEf3ebM198f+5vhccSYFxFa+YvsUmSw9yMF8z1nA
6POZTpm6ErByAY9EGvC8EcNOQd9xLOfBZc0e+mY/rMRxmL+0N+sSRE/ACU+2zxHN
KcCiFX5WQdLDYW1ZjX5xA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ZKuiBBg5/hUvyb
Qsswtmi/YV5e6AnXEuvylwE3wYzlqDzxwlZM08bWFyZYnSf38d3hAjVwUHAugiaX
4sgE6GPAiONW5FkTZ4Z2oXYiN213QDIIcQeFAl04qSEFkGBV8x2hM0uXgFH1S++j
JePdKBbV/CjxegyyYsmnln+eO1kC8pCalB6k6pEtYMqNYOnmimC8UKrJATrH9EVq
eAehGBiIe514Oz06Ws2Vm4PTiY2x0KVbqphwkuz85ohSF9UXOHUcMryusr1zlg==
-----END CERTIFICATE-----

52
test/integration/testdata/pem/key.pem vendored Normal file
View File

@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQQIBADANBgkqhkiG9w0BAQEFAASCCSswggknAgEAAoICAQCm3TNckD55ae6p
xXS03iV2P3X/edZT4vRa8D15elsiCSRf6mdU2TVAQyg22GEcMXgsbba7sotJVg75
59LkWAgb3Dj9rbPputdS29ebncatx1nzo1QHMCS/v7nWoPe9fQVlDEf3ebM198f+
5vhccSYFxFa+YvsUmSw9yMF8z1nA6POZTpm6ErByAY9EGvC8EcNOQd9xLOfBZc0e
+mY/rMRxmL+0N+sSRE/ACU+2zxHNKcCiFX5WQdLDYW1ZjX5xAVatCPNlxSQpj97/
ktGsnqwGnJWSTeMUOPv7L0LrQasfk1VXBvfTW2/ZqhI9WA8qfdC5XOuzVwfU14gv
+6vv9AGZnUFmOjeo9XG4xWBxlIKjAQAzeNwAGFltPkp5a3yPczxMjKY4xLsMGcDf
paNtv1B24+7fV77Nyty/gLLT9pUaFtXLuRfIPSaUK3kFhAuYzGUL/sO9O9jJkNlx
xygxQ+VyIgmdw0zWrUi3q+LfmdyaFFjHdM7LnLrLCjSv3dEoMINngR3+IejsY+98
Ehd25O3oW+ZnGIQX0VwykV8sOQWqrpnnZ+2iHMtF6Vsj40z/Y9y7yVE18AIJFC+Y
r/dD/nQyg6SE70wdNcOx0Ay1xHbPWuV3fqKOfhONR7NEBSO2UbHi6GZAiYMMwwul
+4yKAQ4+lHOE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