forked from oraoto/pib
-
-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathBrowserTest.mjs
89 lines (80 loc) · 3.76 KB
/
BrowserTest.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { BotTest } from 'cv3-test/BotTest.mjs';
import { compareSnapshot } from 'cv3-test/Snapshot.mjs';
export class BrowserTest extends BotTest
{
startDocument = 'http://localhost:9000/php-wasm/embedded-php.html?no-service-worker';
parallel = false;
width = 1024;
height = 768;
async testHelloWorld()
{
await new Promise(a => setTimeout(a, 1000));
await this.pobot.goto('http://localhost:9000/php-wasm/embedded-php.html?demo=hello-world.php')
await new Promise(a => setTimeout(a, 5000));
const phpOutput = await this.pobot.inject(() => document.querySelectorAll('iframe')[1].getAttribute('srcdoc'));
this.assert(compareSnapshot(phpOutput), 'Snapshot does not match!');
await new Promise(a => setTimeout(a, 100));
}
async testSqlite()
{
await new Promise(a => setTimeout(a, 1000));
await this.pobot.goto('http://localhost:9000/php-wasm/embedded-php.html?demo=sqlite.php')
await new Promise(a => setTimeout(a, 5000));
const phpOutput = await this.pobot.inject(() => document.querySelectorAll('iframe')[1].getAttribute('srcdoc'));
this.assert(compareSnapshot(phpOutput), 'Snapshot does not match!');
await new Promise(a => setTimeout(a, 100));
}
async testPostgres()
{
await new Promise(a => setTimeout(a, 1000));
await this.pobot.goto('http://localhost:9000/php-wasm/embedded-php.html?demo=postgres.php')
await new Promise(a => setTimeout(a, 5000));
const phpOutput = await this.pobot.inject(() => document.querySelectorAll('iframe')[1].getAttribute('srcdoc'));
this.assert(compareSnapshot(phpOutput), 'Snapshot does not match!');
await new Promise(a => setTimeout(a, 100));
}
async testSqlitePdo()
{
await new Promise(a => setTimeout(a, 1000));
await this.pobot.goto('http://localhost:9000/php-wasm/embedded-php.html?demo=sqlite-pdo.php')
await new Promise(a => setTimeout(a, 5000));
const phpOutput = await this.pobot.inject(() => document.querySelectorAll('iframe')[1].getAttribute('srcdoc'));
this.assert(compareSnapshot(phpOutput), 'Snapshot does not match!');
await new Promise(a => setTimeout(a, 100));
}
async testFiles()
{
await new Promise(a => setTimeout(a, 1000));
await this.pobot.goto('http://localhost:9000/php-wasm/embedded-php.html?demo=files.php')
await new Promise(a => setTimeout(a, 10000));
const phpOutput = await this.pobot.inject(() => document.querySelectorAll('iframe')[1].getAttribute('srcdoc'));
this.assert(compareSnapshot(phpOutput), 'Snapshot does not match!');
await new Promise(a => setTimeout(a, 100));
}
async testGoto()
{
await new Promise(a => setTimeout(a, 1000));
await this.pobot.goto('http://localhost:9000/php-wasm/embedded-php.html?demo=goto.php')
await new Promise(a => setTimeout(a, 5000));
const phpOutput = await this.pobot.inject(() => document.querySelectorAll('iframe')[1].getAttribute('srcdoc'));
this.assert(compareSnapshot(phpOutput), 'Snapshot does not match!');
await new Promise(a => setTimeout(a, 100));
}
async testDynamicExtensions()
{
await new Promise(a => setTimeout(a, 1000));
await this.pobot.goto('http://localhost:9000/php-wasm/embedded-php.html?demo=dynamic-extension.php')
await new Promise(a => setTimeout(a, 10000));
const phpOutput = await this.pobot.inject(() => document.querySelectorAll('iframe')[1].getAttribute('srcdoc'));
this.assert(compareSnapshot(phpOutput), 'Snapshot does not match!');
await new Promise(a => setTimeout(a, 100));
}
// async testFetch()
// {
// await this.pobot.goto('http://localhost:9000/php-wasm/embedded-php.html?demo=fetch.php')
// await new Promise(a => setTimeout(a, 5000));
// const phpOutput = await this.pobot.inject(() => document.querySelectorAll('iframe')[1].getAttribute('srcdoc'));
// this.assert(compareSnapshot(phpOutput), 'Snapshot does not match!');
// await new Promise(a => setTimeout(a, 100));
// }
}