Compare commits
137 Commits
wave-205-a
...
wave-219-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28678e4b47 | ||
|
|
d6e82b4b86 | ||
|
|
99b9df00c0 | ||
|
|
b1d25f329d | ||
|
|
f33599517d | ||
|
|
927e3aaaa0 | ||
|
|
b1997fedd7 | ||
|
|
3e2ae4708e | ||
|
|
065a4f33b6 | ||
|
|
1d540d16be | ||
|
|
87a1c0f0bd | ||
|
|
149a5f4ce8 | ||
|
|
5d83d1643a | ||
|
|
150d0d4dc8 | ||
|
|
d402da46f0 | ||
|
|
5d4265f307 | ||
|
|
f1d91b48ff | ||
|
|
6f995f624d | ||
|
|
bd1e9568d5 | ||
|
|
8c9e214153 | ||
|
|
d5dce6ea86 | ||
|
|
e6bc3c0523 | ||
|
|
4197c5dbaf | ||
|
|
cf95bf9fae | ||
|
|
a1b0b3e36e | ||
|
|
1c1c3fe604 | ||
|
|
fda0d21ca5 | ||
|
|
ddbfde476b | ||
|
|
c2437eecfd | ||
|
|
1dbaa747e1 | ||
|
|
d0938f8944 | ||
|
|
3924d91b2b | ||
|
|
ead2dcfc4a | ||
|
|
8f8aee325a | ||
|
|
f709a64db8 | ||
|
|
601617d446 | ||
|
|
abe624d03e | ||
|
|
953bb4414f | ||
|
|
c7bd363ad7 | ||
|
|
ef96d08f0e | ||
|
|
cbd6b4a03a | ||
|
|
b7d40c7503 | ||
|
|
4199cd3ff0 | ||
|
|
b6dcdc7770 | ||
|
|
7807e3feb6 | ||
|
|
34902f4714 | ||
|
|
aaca72d969 | ||
|
|
541420e1fe | ||
|
|
eca9d344f9 | ||
|
|
ad828e1e53 | ||
|
|
d6f6b89e72 | ||
|
|
f1921776ff | ||
|
|
bc20d19b4a | ||
|
|
ef1412d144 | ||
|
|
3e35ae52c0 | ||
|
|
b23c7f2fa8 | ||
|
|
fb43bef9cc | ||
|
|
1bd5572777 | ||
|
|
b9f9afcbd6 | ||
|
|
98b153deae | ||
|
|
8805740235 | ||
|
|
44e9c6aef2 | ||
|
|
9534414da4 | ||
|
|
a44eaa78ca | ||
|
|
46305ae822 | ||
|
|
b477374a61 | ||
|
|
cd6a22911a | ||
|
|
ecf3c428be | ||
|
|
31b38ccaaa | ||
|
|
c75e9d76b4 | ||
|
|
08d170b2de | ||
|
|
147f5341e9 | ||
|
|
372ca9d069 | ||
|
|
8b8c227a78 | ||
|
|
0d91482bfd | ||
|
|
9664c70408 | ||
|
|
184aab3b80 | ||
|
|
87e388d78d | ||
|
|
9f469187a0 | ||
|
|
9e1293c3c9 | ||
|
|
82b2eabf5f | ||
|
|
ec0351df90 | ||
|
|
77773bb0d9 | ||
|
|
99d2dccbba | ||
|
|
05d106a478 | ||
|
|
30b53a14b9 | ||
|
|
bc73c1d984 | ||
|
|
4e971701fa | ||
|
|
0644fbd692 | ||
|
|
5de7c1a0c8 | ||
|
|
bf5f7d1b0d | ||
|
|
18e0a3a563 | ||
|
|
b1a2a6490d | ||
|
|
0925c771a0 | ||
|
|
d46f607976 | ||
|
|
82e6c9258a | ||
|
|
69dcf0a399 | ||
|
|
16422d64d7 | ||
|
|
1ffcb080ec | ||
|
|
648dc20cda | ||
|
|
fda1766fbf | ||
|
|
9efc943107 | ||
|
|
05f3b70e00 | ||
|
|
34c58540ee | ||
|
|
5002d40e71 | ||
|
|
f773bf8116 | ||
|
|
b3889d7f28 | ||
|
|
a7df5c635d | ||
|
|
81a027dd87 | ||
|
|
967a0ccea9 | ||
|
|
12acb77dc4 | ||
|
|
2c6887fbac | ||
|
|
10fcacfae9 | ||
|
|
f0093d794c | ||
|
|
7d7c76f4e3 | ||
|
|
0340b97465 | ||
|
|
284dcaaf12 | ||
|
|
48d793ea5f | ||
|
|
3f8cdb2ef7 | ||
|
|
5060064915 | ||
|
|
fea12bfe2d | ||
|
|
a3812924ac | ||
|
|
511b5dcb6f | ||
|
|
a0bc39a72a | ||
|
|
e9e7432e0f | ||
|
|
ac3e7ea87a | ||
|
|
b321756af5 | ||
|
|
dc3941434d | ||
|
|
f20173cdb9 | ||
|
|
61d9db4939 | ||
|
|
c964348b63 | ||
|
|
2a09be9693 | ||
|
|
d220b73d79 | ||
|
|
27cbf333a0 | ||
|
|
1db9357827 | ||
|
|
9b19a9c38e | ||
|
|
f3fd9ba47c |
@@ -56,6 +56,7 @@ h3{font-size:14px;font-weight:700;margin-bottom:16px}
|
||||
@media(max-width:900px){.g6,.g5{grid-template-columns:repeat(3,minmax(0,1fr))}.g4{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/css/weval-premium.css">
|
||||
<script src="/js/wevia-a11y-auto.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- BETON-DOCTRINE-101 dual-dummy block (pages pub) -->
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
.logo{font-size:1.15rem;font-weight:900;letter-spacing:1px}.logo b{color:#53d8fb}.logo i{color:#e94560;font-style:normal}
|
||||
.hr{display:flex;gap:18px;font-size:.72rem;color:#4a5878}.hr b{color:#53d8fb}
|
||||
</style>
|
||||
<script src="/js/wevia-a11y-auto.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- BETON-DOCTRINE-101 dual-dummy block (pages pub) -->
|
||||
|
||||
@@ -22,6 +22,7 @@ h1 span{background:linear-gradient(135deg,#06b6d4,#a855f7);-webkit-background-cl
|
||||
.leg i{width:10px;height:10px;border-radius:50%;display:inline-block}
|
||||
#info{position:fixed;bottom:12px;left:50%;transform:translateX(-50%);font-size:.72rem;color:#4a5570;text-align:center;z-index:10}
|
||||
</style>
|
||||
<script src="/js/wevia-a11y-auto.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- BETON-DOCTRINE-101 dual-dummy block (pages pub) -->
|
||||
|
||||
@@ -170,6 +170,7 @@ canvas{z-index:0!important}
|
||||
<style id="d93c">.p-av{width:52px!important;height:52px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;font-size:28px!important;line-height:1!important;border-radius:50%!important;background:rgba(255,255,255,.06)!important;border:2.5px solid rgba(34,211,238,.55)!important;flex-shrink:0!important;overflow:hidden!important;box-shadow:0 2px 6px rgba(0,0,0,.25)!important}.p-av[data-persona="tool"]{border-color:rgba(139,92,246,.55)!important;background:rgba(139,92,246,.12)!important}.p-av[data-persona="master"]{border-color:rgba(255,215,0,.65)!important;background:rgba(255,215,0,.1)!important;width:64px!important;height:64px!important;font-size:34px!important}.p-av[data-persona="human"]{border-color:rgba(74,222,128,.45)!important;background:rgba(74,222,128,.08)!important}</style>
|
||||
<!-- V109 Plausible Analytics -->
|
||||
<script defer data-domain="weval-consulting.com" src="https://analytics.weval-consulting.com/js/script.js"></script>
|
||||
<script src="/js/wevia-a11y-auto.js" defer></script>
|
||||
</head><body>
|
||||
<!-- BETON-DOCTRINE-101 dual-dummy block (pages pub) -->
|
||||
<div id="weval-global-logout" style="display:none!important;visibility:hidden!important" aria-hidden="true" data-beton-101="dummy-to-block-auto-injection"></div>
|
||||
|
||||
@@ -132,6 +132,7 @@ footer a { color:var(--cyan); text-decoration:none; }
|
||||
.loading { text-align:center; padding:80px; color:var(--dim); font-size:1.2rem; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="/css/weval-premium.css">
|
||||
<script src="/js/wevia-a11y-auto.js" defer></script>
|
||||
</head><!--archi-->
|
||||
<body style="padding-top:60px">
|
||||
<!-- BETON-DOCTRINE-101 dual-dummy block (pages pub) -->
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
<style>@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;800;900&display=swap');*{margin:0;padding:0;box-sizing:border-box}body{background:#e4ecf6;background-image:radial-gradient(#c8d8e8 1px,transparent 1px);background-size:20px 20px;overflow-y:auto;font-family:'Nunito'}canvas{display:block}
|
||||
#T{position:fixed;pointer-events:none;display:none;z-index:99;background:#fff;border:3px solid;border-radius:12px;padding:10px 14px;color:#2a2a4a;box-shadow:0 4px 16px #0002;max-width:210px;font-size:.78rem}#T b{display:block;font-size:.9rem}#T i{font-style:normal;font-size:.56rem;text-transform:uppercase;letter-spacing:2px;display:block;margin:2px 0 4px}#T .p{color:#e94560;font-weight:700;font-size:.68rem;margin-top:3px}#T .s{font-size:.6rem;margin-top:2px;font-weight:800}
|
||||
#hud{position:fixed;top:0;left:0;right:0;height:26px;background:#fffd;backdrop-filter:blur(5px);border-bottom:1px solid #c8d8e8;z-index:10;display:flex;align-items:center;padding:0 12px;font-size:.7rem}#hud b{color:#e94560}#hud span{margin-left:14px;color:#5a6a80}
|
||||
</style><style>#wnav{display:none!important}</style></head><body>
|
||||
</style><style>#wnav{display:none!important}</style> <script src="/js/wevia-a11y-auto.js" defer></script>
|
||||
</head><body>
|
||||
<!-- BETON-DOCTRINE-101 dual-dummy block (pages pub) -->
|
||||
<div id="weval-global-logout" style="display:none!important;visibility:hidden!important" aria-hidden="true" data-beton-101="dummy-to-block-auto-injection"></div>
|
||||
<a id="weval-gl" href="#" style="display:none!important;visibility:hidden!important" aria-hidden="true" data-beton-101="dummy-to-block-auto-injection" tabindex="-1"></a>
|
||||
|
||||
@@ -31,6 +31,7 @@ canvas{display:block}
|
||||
.zb{font-family:'Rajdhani',sans-serif;font-size:.68rem;padding:4px 12px;border-radius:4px;color:#5a6a88;border:1px solid #111828;cursor:pointer;pointer-events:auto;transition:.2s;letter-spacing:1px}
|
||||
.zb:hover,.zb.lit{color:#06b6d4;border-color:#06b6d4;background:rgba(6,182,212,.06);text-shadow:0 0 8px rgba(6,182,212,.3)}
|
||||
</style>
|
||||
<script src="/js/wevia-a11y-auto.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- BETON-DOCTRINE-101 dual-dummy block (pages pub) -->
|
||||
|
||||
@@ -20,6 +20,7 @@ canvas{display:block}
|
||||
.hr{display:flex;gap:16px;font-size:.75rem;color:#6a7a9a;font-weight:700}
|
||||
.hr b{padding:2px 8px;border-radius:8px}
|
||||
</style>
|
||||
<script src="/js/wevia-a11y-auto.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- BETON-DOCTRINE-101 dual-dummy block (pages pub) -->
|
||||
|
||||
@@ -23,7 +23,8 @@ td{padding:10px 8px;border-bottom:1px solid #1e293b;color:#cbd5e1}
|
||||
.status-live{color:#10b981;font-weight:600}
|
||||
.status-partial{color:#f59e0b;font-weight:600}
|
||||
.note{background:#1e293b;padding:14px;border-radius:8px;margin-top:24px;font-size:12px;color:#94a3b8;border-left:3px solid #c96442}
|
||||
</style></head><body>
|
||||
</style> <script src="/js/wevia-a11y-auto.js" defer></script>
|
||||
</head><body>
|
||||
<!-- CANONICAL BANNER doctrine 103 -->
|
||||
<div id="canonical-banner-v103" style="position:fixed;top:0;left:0;right:0;z-index:99990;background:linear-gradient(90deg,#1e293b,#0f172a);border-bottom:1px solid rgba(99,102,241,0.3);padding:8px 16px;display:flex;align-items:center;justify-content:space-between;font-family:Inter,system-ui,sans-serif;font-size:12px;backdrop-filter:blur(8px)">
|
||||
<span style="color:#94a3b8">Variante agents-* <span id="canonical-this-page" style="color:#64748b">(cette page)</span></span>
|
||||
|
||||
@@ -130,6 +130,7 @@ h1 span{background:linear-gradient(135deg,var(--cyan),var(--purple));-webkit-bac
|
||||
.chain{padding:16px 12px;}
|
||||
}
|
||||
</style>
|
||||
<script src="/js/wevia-a11y-auto.js" defer></script>
|
||||
</head>
|
||||
<body style="padding-top:60px">
|
||||
<!-- BETON-DOCTRINE-101 dual-dummy block (pages pub) -->
|
||||
|
||||
@@ -59,6 +59,7 @@ a{color:var(--cy);text-decoration:none}
|
||||
@media(max-width:768px){.stats{grid-template-columns:repeat(2,1fr)}.lb-bar-w{flex:0 0 80px}.lb-desc{display:none}}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/css/weval-premium.css">
|
||||
<script src="/js/wevia-a11y-auto.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- BETON-DOCTRINE-101 dual-dummy block (pages pub) -->
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"agent": "V41_Disk_Monitor",
|
||||
"ts": "2026-04-21T15:00:02+02:00",
|
||||
"ts": "2026-04-21T22:30:01+02:00",
|
||||
"disk_pct": 82,
|
||||
"disk_free_gb": 27,
|
||||
"growth_per_day_gb": 1.5,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"agent": "V41_Risk_Escalation",
|
||||
"ts": "2026-04-21T15:00:03+02:00",
|
||||
"ts": "2026-04-21T22:45:03+02:00",
|
||||
"dg_alerts_active": 7,
|
||||
"wevia_life_stats_preview": "{
|
||||
"ok": true,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"routes": 445,
|
||||
"routes": 446,
|
||||
"skills": 835,
|
||||
"wiki": 1928,
|
||||
"pages": 293,
|
||||
"apis": 250,
|
||||
"wiki": 2046,
|
||||
"pages": 317,
|
||||
"apis": 251,
|
||||
"docker": 19,
|
||||
"proposals": [
|
||||
{
|
||||
@@ -27,5 +27,5 @@
|
||||
"effort": "S"
|
||||
}
|
||||
],
|
||||
"timestamp": "2026-04-21 10:00"
|
||||
"timestamp": "2026-04-21 16:00"
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"agent": "V41_Feature_Adoption_Tracker",
|
||||
"ts": "2026-04-21T15:00:02+02:00",
|
||||
"ts": "2026-04-21T22:00:02+02:00",
|
||||
"features_tracked": 15,
|
||||
"features_used_24h": 12,
|
||||
"adoption_pct": 80,
|
||||
"chat_queries_last_1k_log": 2,
|
||||
"wtp_views_last_1k_log": 27,
|
||||
"dg_views_last_1k_log": 2,
|
||||
"features_used_24h": 9,
|
||||
"adoption_pct": 60,
|
||||
"chat_queries_last_1k_log": 0,
|
||||
"wtp_views_last_1k_log": 0,
|
||||
"dg_views_last_1k_log": 0,
|
||||
"skill_runs_last_1k_log": 0,
|
||||
"recommendation": "UX onboarding tour for unused features",
|
||||
"cron_schedule": "hourly",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"agent": "V45_Leads_Sync",
|
||||
"ts": "2026-04-21T15:00:03+02:00",
|
||||
"ts": "2026-04-21T22:40:02+02:00",
|
||||
"paperclip_total": 48,
|
||||
"active_customer": 4,
|
||||
"warm_prospect": 5,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"agent": "V41_MQL_Scoring",
|
||||
"ts": "2026-04-21T15:00:03+02:00",
|
||||
"ts": "2026-04-21T22:00:03+02:00",
|
||||
"leads_total": 48,
|
||||
"mql_current": 16,
|
||||
"sql_current": 6,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"agent": "V60_Nudge_Owner_Actions",
|
||||
"ts": "2026-04-21T08:00:01+02:00",
|
||||
"ts": "2026-04-21T16:00:01+02:00",
|
||||
"cron": "every_8_hours",
|
||||
"actions_pending_owner": {
|
||||
"emails_drafts_V45_to_send": {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"agent": "V54_Risk_Monitor_Live",
|
||||
"ts": "2026-04-21T15:00:03+02:00",
|
||||
"ts": "2026-04-21T22:30:02+02:00",
|
||||
"critical_risks": {
|
||||
"RW01_pipeline_vide": {
|
||||
"pipeline_keur": 0,
|
||||
"mql_auto": 20,
|
||||
"residual_risk_pct": 80,
|
||||
"mql_auto": 17,
|
||||
"residual_risk_pct": 83,
|
||||
"trend": "mitigation_V42_V45_active"
|
||||
},
|
||||
"RW02_dependance_ethica": {
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
"RW12_burnout": {
|
||||
"agents_cron_active": 15,
|
||||
"load_5min": "3.88",
|
||||
"load_5min": "3.98",
|
||||
"automation_coverage_pct": 70,
|
||||
"residual_risk_pct": 60,
|
||||
"trend": "V52_goldratt_options_active"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"timestamp": "2026-04-21 14:00",
|
||||
"timestamp": "2026-04-21 22:00",
|
||||
"sections": {
|
||||
"servers": {
|
||||
"S204": {
|
||||
"docker": 19,
|
||||
"disk": "82%",
|
||||
"ram": "12Gi/30Gi",
|
||||
"load": "0.99",
|
||||
"uptime": "up 1 week, 2 hours, 8 minutes"
|
||||
"load": "9.85",
|
||||
"uptime": "up 1 week, 10 hours, 8 minutes"
|
||||
}
|
||||
},
|
||||
"docker": {
|
||||
@@ -25,17 +25,17 @@
|
||||
},
|
||||
{
|
||||
"name": "plausible-plausible-1",
|
||||
"status": "Up 3 days",
|
||||
"status": "Up 4 days",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
"name": "plausible-plausible-db-1",
|
||||
"status": "Up 3 days",
|
||||
"status": "Up 4 days",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
"name": "plausible-plausible-events-db-1",
|
||||
"status": "Up 3 days",
|
||||
"status": "Up 4 days",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
@@ -70,48 +70,48 @@
|
||||
},
|
||||
{
|
||||
"name": "redis-weval",
|
||||
"status": "Up 6 days",
|
||||
"status": "Up 7 days",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
"name": "gitea",
|
||||
"status": "Up 6 days",
|
||||
"status": "Up 7 days",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
"name": "node-exporter",
|
||||
"status": "Up 6 days",
|
||||
"status": "Up 7 days",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
"name": "prometheus",
|
||||
"status": "Up 6 days",
|
||||
"status": "Up 7 days",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
"name": "searxng",
|
||||
"status": "Up 6 days",
|
||||
"status": "Up 7 days",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
"name": "uptime-kuma",
|
||||
"status": "Up 36 hours (healthy)",
|
||||
"status": "Up 44 hours (healthy)",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
"name": "vaultwarden",
|
||||
"status": "Up 6 days (healthy)",
|
||||
"status": "Up 7 days (healthy)",
|
||||
"ports": ""
|
||||
},
|
||||
{
|
||||
"name": "qdrant",
|
||||
"status": "Up 6 days",
|
||||
"status": "Up 7 days",
|
||||
"ports": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"apis": {
|
||||
"count": 271,
|
||||
"count": 272,
|
||||
"files": [
|
||||
"wevia-stream-sovereign.php",
|
||||
"wevia-pending-loader.php",
|
||||
@@ -277,6 +277,7 @@
|
||||
"wevia-post-exec.php",
|
||||
"wevia-apple-intents.php",
|
||||
"wevia-v73-intents-include.php",
|
||||
"wevia-sanitizer-guard.php",
|
||||
"wevia-v81-ai-audit-100.php",
|
||||
"wevia-patch-file.php",
|
||||
"wevia-dashboard.php",
|
||||
@@ -387,7 +388,7 @@
|
||||
]
|
||||
},
|
||||
"routes": {
|
||||
"lines": 3652,
|
||||
"lines": 3681,
|
||||
"count": 446
|
||||
},
|
||||
"skills": {
|
||||
@@ -479,7 +480,7 @@
|
||||
]
|
||||
},
|
||||
"pages": {
|
||||
"count": 314
|
||||
"count": 317
|
||||
},
|
||||
"opt_tools": {
|
||||
"count": 91
|
||||
@@ -488,7 +489,7 @@
|
||||
"pairs": 5751
|
||||
},
|
||||
"wiki": {
|
||||
"entries": 1988
|
||||
"entries": 2066
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"generated_at": "2026-04-21T12:00:02.392163",
|
||||
"generated_at": "2026-04-21T18:00:03.108093",
|
||||
"agent_version": "V69_enhanced",
|
||||
"pages_scanned": 9,
|
||||
"fixed_elements_checked": 19,
|
||||
@@ -9,7 +9,7 @@
|
||||
"issues": [
|
||||
{
|
||||
"page": "weval-technology-platform.html",
|
||||
"element": "opus-droid-link",
|
||||
"element": "opus-orphans-count-text",
|
||||
"type": "inline",
|
||||
"corner": "bottom-right",
|
||||
"z": 9997,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"timestamp": "2026-04-21T10:00:05+00:00",
|
||||
"compute_ms": 2668,
|
||||
"timestamp": "2026-04-21T16:00:05+00:00",
|
||||
"compute_ms": 2343,
|
||||
"metrics": {
|
||||
"agents": 0,
|
||||
"agents_hierarchy": 0,
|
||||
@@ -12,19 +12,19 @@
|
||||
"nonreg_rate": 100,
|
||||
"oss_tools": 765,
|
||||
"oss_skills": 734,
|
||||
"oss_tests": 762,
|
||||
"oss_tests": 765,
|
||||
"docker": 19,
|
||||
"ollama_models": 7,
|
||||
"git_repos": 38,
|
||||
"providers": [
|
||||
{
|
||||
"name": "Cerebras",
|
||||
"latency_ms": 485,
|
||||
"latency_ms": 609,
|
||||
"status": "up"
|
||||
},
|
||||
{
|
||||
"name": "Groq",
|
||||
"latency_ms": 1007,
|
||||
"latency_ms": 499,
|
||||
"status": "up"
|
||||
}
|
||||
]
|
||||
|
||||
14
api/ambre-adg-diag.php
Normal file
14
api/ambre-adg-diag.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$f = "/var/www/html/api/ambre-early-doc-gen.php";
|
||||
$out = ["size"=>@filesize($f)];
|
||||
$lint = @shell_exec("php8.4 -l $f 2>&1");
|
||||
$out["lint"] = trim($lint);
|
||||
// Try to eval the file with mock $_mam set
|
||||
$_mam = "Genere un PDF sur: test";
|
||||
ob_start();
|
||||
$rr = @include $f;
|
||||
$out["include_ok"] = $rr !== false;
|
||||
$out["stray_output"] = ob_get_clean();
|
||||
// If exited, ob would have file_gen response. Otherwise, fall through
|
||||
echo json_encode($out);
|
||||
88
api/ambre-doc-gen.php
Normal file
88
api/ambre-doc-gen.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* ambre-doc-gen.php · AMBRE · real file generation via pandoc
|
||||
* Usage: POST {type: pdf|docx|pptx|html, title: "...", content: "markdown..."}
|
||||
* Output: {ok:true, url:"/generated/xxx.ext", size:B, type:..., ts:...}
|
||||
* Doctrine: zero fake (réelle génération), zero écrasement (unique timestamp per file)
|
||||
*/
|
||||
header("Content-Type: application/json");
|
||||
|
||||
// === Input parsing ===
|
||||
$raw = file_get_contents("php://input");
|
||||
$in = json_decode($raw, true);
|
||||
if (!$in && !empty($_POST)) $in = $_POST;
|
||||
|
||||
$type = strtolower(trim($in["type"] ?? "pdf"));
|
||||
$title = trim($in["title"] ?? "Document WEVIA");
|
||||
$content = $in["content"] ?? "";
|
||||
|
||||
if (!$content) {
|
||||
http_response_code(400);
|
||||
echo json_encode(["ok"=>false, "error"=>"content required"]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// === Type validation ===
|
||||
$allowed = ["pdf","docx","pptx","html","odt","epub"];
|
||||
if (!in_array($type, $allowed)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(["ok"=>false, "error"=>"invalid type", "allowed"=>$allowed]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// === Prepare output dir ===
|
||||
$outdir = "/var/www/html/generated";
|
||||
if (!is_dir($outdir)) @mkdir($outdir, 0755, true);
|
||||
|
||||
$ts = date("Ymd-His");
|
||||
$rand = substr(md5(random_bytes(8)), 0, 6);
|
||||
$safe_title = preg_replace("/[^a-zA-Z0-9\-_]/", "-", substr($title, 0, 40));
|
||||
$basename = "wevia-{$safe_title}-{$ts}-{$rand}";
|
||||
$md_path = "$outdir/$basename.md";
|
||||
$out_path = "$outdir/$basename.$type";
|
||||
|
||||
// === Write markdown input ===
|
||||
$md_content = "# $title\n\n" . $content;
|
||||
file_put_contents($md_path, $md_content);
|
||||
|
||||
// === Generate via pandoc ===
|
||||
$start = microtime(true);
|
||||
if ($type === "pdf") {
|
||||
// Use wkhtmltopdf via pandoc for better rendering
|
||||
$cmd = "pandoc " . escapeshellarg($md_path) . " --pdf-engine=wkhtmltopdf -o " . escapeshellarg($out_path) . " 2>&1";
|
||||
} else if ($type === "pptx" || $type === "docx" || $type === "odt" || $type === "html" || $type === "epub") {
|
||||
$cmd = "pandoc " . escapeshellarg($md_path) . " -o " . escapeshellarg($out_path) . " 2>&1";
|
||||
}
|
||||
$cmd_output = @shell_exec("timeout 30 $cmd");
|
||||
$elapsed = round((microtime(true) - $start) * 1000);
|
||||
|
||||
// === Check result ===
|
||||
if (!file_exists($out_path) || filesize($out_path) === 0) {
|
||||
@unlink($md_path);
|
||||
echo json_encode([
|
||||
"ok" => false,
|
||||
"error" => "pandoc failed",
|
||||
"pandoc_output" => $cmd_output,
|
||||
"cmd" => $cmd,
|
||||
"elapsed_ms" => $elapsed,
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$size = filesize($out_path);
|
||||
$url = "/generated/$basename.$type";
|
||||
|
||||
// Keep md source for provenance
|
||||
echo json_encode([
|
||||
"ok" => true,
|
||||
"url" => $url,
|
||||
"full_url" => "https://weval-consulting.com$url",
|
||||
"size" => $size,
|
||||
"size_human" => $size > 1024 ? round($size/1024, 1) . "KB" : "$size B",
|
||||
"type" => $type,
|
||||
"title" => $title,
|
||||
"elapsed_ms" => $elapsed,
|
||||
"md_source" => "/generated/$basename.md",
|
||||
"ts" => date("c"),
|
||||
"engine" => $type === "pdf" ? "pandoc+wkhtmltopdf" : "pandoc",
|
||||
], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
202
api/ambre-early-doc-gen.php
Normal file
202
api/ambre-early-doc-gen.php
Normal file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* ambre-early-doc-gen.php · v4 · 5 capabilities réelles
|
||||
* 1. File gen pdf/docx/pptx via pandoc
|
||||
* 2. xlsx via PhpSpreadsheet (si dispo, sinon fallback docx)
|
||||
* 3. Mermaid validated
|
||||
* 4. Image SVG via LLM structured prompt
|
||||
* 5. Code with file URL (py/js/html/php depending on topic)
|
||||
*/
|
||||
|
||||
static $__ad_already = false;
|
||||
if ($__ad_already) return;
|
||||
$__ad_already = true;
|
||||
|
||||
$__ad_raw = @file_get_contents("php://input");
|
||||
if (!$__ad_raw) return;
|
||||
$__ad_body = @json_decode($__ad_raw, true);
|
||||
$__ad_msg = trim($__ad_body["message"] ?? "");
|
||||
if (!$__ad_msg) return;
|
||||
|
||||
// ========== HANDLER 1: xlsx réel via PhpSpreadsheet ==========
|
||||
if (preg_match("/g[eéèê]n[eéèê]re?\s+(?:un|une)?\s*(?:tableau\s+)?excel|xlsx/iu", $__ad_msg) &&
|
||||
preg_match("/(?::|pour|sur)\s*(.+)$/iu", $__ad_msg, $__xm)) {
|
||||
$__xlsx_topic = trim($__xm[1]);
|
||||
// try PhpSpreadsheet
|
||||
$__xl_url = "http://127.0.0.1/api/ambre-xlsx-gen.php?topic=" . urlencode($__xlsx_topic);
|
||||
$__xl_out = @file_get_contents($__xl_url, false, stream_context_create(["http"=>["timeout"=>60,"header"=>"Host: weval-consulting.com\r\n"]]));
|
||||
$__xl_d = @json_decode($__xl_out, true);
|
||||
if ($__xl_d && !empty($__xl_d["ok"]) && !empty($__xl_d["url"])) {
|
||||
header("Content-Type: application/json; charset=utf-8");
|
||||
echo json_encode([
|
||||
"response"=>"📊 **" . $__xlsx_topic . "** (Excel)\n\n🔗 Télécharger: " . $__xl_d["full_url"] . "\n📦 Taille: " . $__xl_d["size_human"] . " · ⚙️ " . $__xl_d["elapsed_ms"] . "ms · engine: PhpSpreadsheet\n\n" . ($__xl_d["preview"] ?? ""),
|
||||
"executed"=>true,"provider"=>"ambre-doc-gen-v5","intent"=>"xlsx_real","topic"=>$__xlsx_topic,
|
||||
], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
// fallback to docx handler below
|
||||
}
|
||||
|
||||
// ========== HANDLER 2: File generation PDF/DOCX/PPTX ==========
|
||||
if (preg_match("/g[eéèê]n[eéèê]re?\s+(?:un|une|des|le|la)?\s*(pdf|pptx?|powerpoint|docx?|word|excel|xlsx?|pr[eéèê]sentation|presentation|document|tableau)[^:]*(?::|sur|pour)\s*(.+)$/iu", $__ad_msg, $__ad_m)) {
|
||||
$__raw_type = mb_strtolower($__ad_m[1]);
|
||||
$__topic = trim($__ad_m[2]);
|
||||
$__type_map = [
|
||||
"pdf"=>"pdf","pptx"=>"pptx","ppt"=>"pptx","powerpoint"=>"pptx",
|
||||
"presentation"=>"pptx","présentation"=>"pptx",
|
||||
"docx"=>"docx","doc"=>"docx","word"=>"docx","document"=>"docx",
|
||||
"xlsx"=>"xlsx","excel"=>"xlsx","tableau"=>"xlsx",
|
||||
];
|
||||
$__type = $__type_map[$__raw_type] ?? "pdf";
|
||||
$__pandoc_type = ($__type === "xlsx") ? "docx" : $__type;
|
||||
|
||||
$__url = "http://127.0.0.1/api/ambre-gen-pipeline.php?type=" . urlencode($__pandoc_type) . "&topic=" . urlencode($__topic);
|
||||
$__out = @file_get_contents($__url, false, stream_context_create(["http"=>["timeout"=>75,"method"=>"GET","header"=>"Host: weval-consulting.com\r\n"]]));
|
||||
|
||||
if ($__out && strlen($__out) > 50) {
|
||||
header("Content-Type: application/json; charset=utf-8");
|
||||
echo json_encode([
|
||||
"response"=>$__out,"executed"=>true,"provider"=>"ambre-doc-gen-v5",
|
||||
"intent"=>"file_generation_real","type"=>$__type,"topic"=>$__topic,
|
||||
], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// ========== HANDLER 3: Mermaid validated ==========
|
||||
if (preg_match("/g[eéèê]n[eéèê]re?.*(sch[eéèê]ma|mermaid|diagramme|flowchart).*(?::|pour|sur)\s*(.+)$/iu", $__ad_msg, $__mm)) {
|
||||
$__topic = trim($__mm[2]);
|
||||
$__sys = "Tu es generateur de diagrammes Mermaid. Reponds UNIQUEMENT avec code mermaid valide, pas de markdown, pas de backticks. Commence par \"flowchart TD\" ou \"graph TD\". Syntaxe: A[Label] --> B[Label]. MAX 12 nodes.";
|
||||
$__user = "Genere un flowchart mermaid VALIDE pour: $__topic";
|
||||
$__llm = @file_get_contents("http://127.0.0.1:4000/v1/chat/completions", false, stream_context_create([
|
||||
"http"=>["method"=>"POST","header"=>"Content-Type: application/json\r\n",
|
||||
"content"=>json_encode(["model"=>"fast","messages"=>[
|
||||
["role"=>"system","content"=>$__sys],["role"=>"user","content"=>$__user]
|
||||
],"max_tokens"=>400,"temperature"=>0.1]),"timeout"=>20]
|
||||
]));
|
||||
$__mmd = @json_decode($__llm,true)["choices"][0]["message"]["content"] ?? "";
|
||||
$__mmd = trim(preg_replace("/```(?:mermaid)?\n?|```/","",$__mmd));
|
||||
if (!preg_match("/^(flowchart|graph|sequenceDiagram|classDiagram)/i", $__mmd)) $__mmd = "flowchart TD\n$__mmd";
|
||||
|
||||
header("Content-Type: application/json; charset=utf-8");
|
||||
echo json_encode([
|
||||
"response"=>"🧩 Schema Mermaid: $__topic\n\n".chr(96).chr(96).chr(96)."mermaid\n$__mmd\n".chr(96).chr(96).chr(96),
|
||||
"executed"=>true,"provider"=>"ambre-doc-gen-v5","intent"=>"mermaid_valid","topic"=>$__topic,
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
|
||||
// ========== HANDLER 4: Image SVG via LLM ==========
|
||||
if (preg_match("/g[eéèê]n[eéèê]re?\s+(?:une|un)?\s*image\s*(?:\b(?:decrivant|repr[eéèê]sentant|pour|sur|de)\b\s*)?:?\s*(.+)$/iu", $__ad_msg, $__im)) {
|
||||
$__topic = trim($__im[1]);
|
||||
$__sys = "Tu es un generateur d\"images SVG. Reponds UNIQUEMENT avec du code SVG valide 400x300, pas de markdown, pas de backticks. Formes geometriques + couleurs. Commence par <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 400 300\">.";
|
||||
$__user = "SVG representant: $__topic";
|
||||
$__llm = @file_get_contents("http://127.0.0.1:4000/v1/chat/completions", false, stream_context_create([
|
||||
"http"=>["method"=>"POST","header"=>"Content-Type: application/json\r\n",
|
||||
"content"=>json_encode(["model"=>"fast","messages"=>[
|
||||
["role"=>"system","content"=>$__sys],["role"=>"user","content"=>$__user]
|
||||
],"max_tokens"=>700,"temperature"=>0.4]),"timeout"=>25]
|
||||
]));
|
||||
$__svg = @json_decode($__llm,true)["choices"][0]["message"]["content"] ?? "";
|
||||
$__svg = trim(preg_replace("/```(?:svg|xml)?\n?|```/","",$__svg));
|
||||
|
||||
if (strpos($__svg, "<svg") !== false) {
|
||||
// Save to /generated/
|
||||
$__ts = date("Ymd-His");
|
||||
$__rand = substr(md5(random_bytes(4)),0,6);
|
||||
$__safe = preg_replace("/[^a-zA-Z0-9\-_]/","-",substr($__topic,0,40));
|
||||
$__fname = "wevia-img-$__safe-$__ts-$__rand.svg";
|
||||
@file_put_contents("/var/www/html/generated/$__fname", $__svg);
|
||||
$__size = strlen($__svg);
|
||||
|
||||
header("Content-Type: application/json; charset=utf-8");
|
||||
echo json_encode([
|
||||
"response"=>"🎨 **$__topic** (image SVG)\n\n🔗 Telecharger: https://weval-consulting.com/generated/$__fname\n📦 Taille: " . round($__size/1024,1) . "KB · engine: LLM+SVG\n\n" . chr(96) . chr(96) . chr(96) . "html\n$__svg\n" . chr(96) . chr(96) . chr(96),
|
||||
"executed"=>true,"provider"=>"ambre-doc-gen-v5","intent"=>"image_svg_real",
|
||||
"topic"=>$__topic, "url"=>"https://weval-consulting.com/generated/$__fname",
|
||||
], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// ========== HANDLER 5: Code generation with file ==========
|
||||
if (preg_match("/(?:ecris?|[eéèê]cri(?:re)?|g[eéèê]n[eéèê]re?)\s+(?:le|du|un)?\s*code(?:\s+(?:pour|en|python|javascript|php|html|js|ts|react|jsx))?\s*(?::|pour)?\s*(.+)$/iu", $__ad_msg, $__cm)) {
|
||||
$__topic = trim($__cm[1]);
|
||||
// Detect language from topic
|
||||
$__lang = "python"; $__ext = "py";
|
||||
$__lc = mb_strtolower($__topic);
|
||||
if (preg_match("/\b(react|jsx|tsx|nextjs|next\.js)\b/i", $__lc)) { $__lang="jsx"; $__ext="jsx"; }
|
||||
elseif (preg_match("/\b(javascript|js|node|vanilla)\b/i", $__lc)) { $__lang="javascript"; $__ext="js"; }
|
||||
elseif (preg_match("/\b(typescript|ts)\b/i", $__lc)) { $__lang="typescript"; $__ext="ts"; }
|
||||
elseif (preg_match("/\b(php)\b/i", $__lc)) { $__lang="php"; $__ext="php"; }
|
||||
elseif (preg_match("/\b(html|page web|site web)\b/i", $__lc)) { $__lang="html"; $__ext="html"; }
|
||||
elseif (preg_match("/\b(bash|shell|sh)\b/i", $__lc)) { $__lang="bash"; $__ext="sh"; }
|
||||
elseif (preg_match("/\b(sql|postgres|mysql)\b/i", $__lc)) { $__lang="sql"; $__ext="sql"; }
|
||||
|
||||
$__sys = "Tu es un generateur de code $__lang. Reponds UNIQUEMENT avec du code $__lang complet et fonctionnel. Pas de preambule, pas de markdown, pas de backticks, pas de commentaire meta. Juste le code pret a executer.";
|
||||
$__user = "Ecris le code $__lang pour: $__topic";
|
||||
|
||||
$__llm = @file_get_contents("http://127.0.0.1:4000/v1/chat/completions", false, stream_context_create([
|
||||
"http"=>["method"=>"POST","header"=>"Content-Type: application/json\r\n",
|
||||
"content"=>json_encode(["model"=>"fast","messages"=>[
|
||||
["role"=>"system","content"=>$__sys],["role"=>"user","content"=>$__user]
|
||||
],"max_tokens"=>2000,"temperature"=>0.3]),"timeout"=>45]
|
||||
]));
|
||||
$__code = @json_decode($__llm,true)["choices"][0]["message"]["content"] ?? "";
|
||||
$__code = trim(preg_replace("/```(?:" . $__lang . "|python|javascript|jsx|ts|php|html|bash|sql)?\n?|```/","", $__code));
|
||||
|
||||
if ($__code && strlen($__code) > 20) {
|
||||
$__ts = date("Ymd-His");
|
||||
$__rand = substr(md5(random_bytes(4)),0,6);
|
||||
$__safe = preg_replace("/[^a-zA-Z0-9\-_]/","-",substr($__topic,0,40));
|
||||
$__fname = "wevia-code-$__safe-$__ts-$__rand.$__ext";
|
||||
@file_put_contents("/var/www/html/generated/$__fname", $__code);
|
||||
|
||||
header("Content-Type: application/json; charset=utf-8");
|
||||
$__tb = chr(96).chr(96).chr(96);
|
||||
echo json_encode([
|
||||
"response"=>"💻 **$__topic** (code $__lang)\n\n🔗 Telecharger: https://weval-consulting.com/generated/$__fname\n📦 " . strlen($__code) . " chars · " . count(explode("\n",$__code)) . " lignes · lang: $__lang\n\n{$__tb}$__lang\n$__code\n{$__tb}",
|
||||
"executed"=>true,"provider"=>"ambre-doc-gen-v5","intent"=>"code_real",
|
||||
"topic"=>$__topic,"lang"=>$__lang,"url"=>"https://weval-consulting.com/generated/$__fname",
|
||||
], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ========== HANDLER 6: Translation via LLM direct ==========
|
||||
if (preg_match("/(?:traduis?|traduire?|translate)\\s+(?:ce\\s+texte|le\\s+texte)?\\s*(?:en)?\\s*:?\\s*(anglais|francais|espagnol|allemand|italien|portugais|arabe|chinois|japonais|english|spanish|french|german|italian|portuguese|arabic|chinese|japanese)\\s*:?\\s*(.+)$/iu", $__ad_msg, $__tr)) {
|
||||
$__tgt = mb_strtolower($__tr[1]);
|
||||
$__txt = trim($__tr[2]);
|
||||
$__lang_map = [
|
||||
"anglais"=>"English","english"=>"English",
|
||||
"francais"=>"French","french"=>"French",
|
||||
"espagnol"=>"Spanish","spanish"=>"Spanish",
|
||||
"allemand"=>"German","german"=>"German",
|
||||
"italien"=>"Italian","italian"=>"Italian",
|
||||
"portugais"=>"Portuguese","portuguese"=>"Portuguese",
|
||||
"arabe"=>"Arabic","arabic"=>"Arabic",
|
||||
"chinois"=>"Chinese","chinese"=>"Chinese",
|
||||
"japonais"=>"Japanese","japanese"=>"Japanese",
|
||||
];
|
||||
$__target = $__lang_map[$__tgt] ?? "English";
|
||||
$__sys = "You are a professional translator. Translate the text to $__target. Output ONLY the translation, no preamble, no explanation.";
|
||||
$__llm = @file_get_contents("http://127.0.0.1:4000/v1/chat/completions", false, stream_context_create([
|
||||
"http"=>["method"=>"POST","header"=>"Content-Type: application/json\r\n",
|
||||
"content"=>json_encode(["model"=>"fast","messages"=>[
|
||||
["role"=>"system","content"=>$__sys],["role"=>"user","content"=>$__txt]
|
||||
],"max_tokens"=>1500,"temperature"=>0.2]),"timeout"=>20]
|
||||
]));
|
||||
$__trans = @json_decode($__llm,true)["choices"][0]["message"]["content"] ?? "";
|
||||
if ($__trans) {
|
||||
header("Content-Type: application/json; charset=utf-8");
|
||||
echo json_encode([
|
||||
"response"=>"🌐 Traduction vers $__target\n\n**Original:**\n$__txt\n\n**$__target:**\n" . trim($__trans),
|
||||
"executed"=>true,"provider"=>"ambre-doc-gen-v5","intent"=>"translate_real",
|
||||
"target"=>$__target,
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// fall through to main flow
|
||||
80
api/ambre-gen-pipeline.php
Normal file
80
api/ambre-gen-pipeline.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* ambre-gen-pipeline.php · AMBRE · pipeline complet chat → LLM markdown → pandoc file
|
||||
* Usage: GET ?type=pdf|docx|pptx&topic=... (from chat intent cmd)
|
||||
* Output: text response with file URL embedded
|
||||
*/
|
||||
header("Content-Type: text/plain; charset=utf-8");
|
||||
|
||||
$type = strtolower(trim($_GET["type"] ?? "pdf"));
|
||||
$topic = trim($_GET["topic"] ?? "");
|
||||
|
||||
if (!$topic) { echo "❌ topic required"; exit; }
|
||||
$allowed = ["pdf","docx","pptx","html","epub"];
|
||||
if (!in_array($type, $allowed)) { echo "❌ type invalide, allowed: " . implode("|", $allowed); exit; }
|
||||
|
||||
// === 1. Call LLM to generate clean markdown ===
|
||||
$sys_prompt = "Tu es un generateur de contenu professionnel. Réponds UNIQUEMENT en markdown pur, pas de preambule, pas de meta-commentaire. Pour les PPTX, utilise # pour chaque slide title. Français par défaut.";
|
||||
|
||||
$user_prompt = match($type) {
|
||||
"pdf" => "Génère un document PDF professionnel, structuré, complet (2-3 pages) sur: $topic. Titres, sections, bullets.",
|
||||
"docx" => "Génère un document Word professionnel, structuré sur: $topic. Titres, sections, tableaux si pertinent.",
|
||||
"pptx" => "Génère une présentation de 5-7 slides sur: $topic. Chaque slide commence par # (titre slide). Bullets concises.",
|
||||
"html" => "Génère un document HTML propre sur: $topic.",
|
||||
default => "Génère un document sur: $topic.",
|
||||
};
|
||||
|
||||
$llm_raw = @file_get_contents("http://127.0.0.1:4000/v1/chat/completions", false, stream_context_create([
|
||||
"http" => [
|
||||
"method" => "POST",
|
||||
"header" => "Content-Type: application/json\r\n",
|
||||
"content" => json_encode([
|
||||
"model" => "fast",
|
||||
"messages" => [
|
||||
["role"=>"system", "content"=>$sys_prompt],
|
||||
["role"=>"user", "content"=>$user_prompt],
|
||||
],
|
||||
"max_tokens" => 2500,
|
||||
"temperature" => 0.5,
|
||||
"stream" => false,
|
||||
]),
|
||||
"timeout" => 30,
|
||||
],
|
||||
]));
|
||||
|
||||
$llm_d = @json_decode($llm_raw, true);
|
||||
$md_content = $llm_d["choices"][0]["message"]["content"] ?? "";
|
||||
|
||||
if (!$md_content) { echo "❌ LLM failed to generate content"; exit; }
|
||||
|
||||
// === 2. Call ambre-doc-gen to create the file ===
|
||||
$title = substr($topic, 0, 60);
|
||||
$gen_ctx = stream_context_create([
|
||||
"http" => [
|
||||
"method" => "POST",
|
||||
"header" => "Content-Type: application/json\r\n",
|
||||
"content" => json_encode([
|
||||
"type" => $type,
|
||||
"title" => $title,
|
||||
"content" => $md_content,
|
||||
]),
|
||||
"timeout" => 45,
|
||||
],
|
||||
]);
|
||||
$gen_raw = @file_get_contents("http://127.0.0.1/api/ambre-doc-gen.php", false, $gen_ctx);
|
||||
$gen_d = @json_decode($gen_raw, true);
|
||||
|
||||
if (!$gen_d || empty($gen_d["ok"])) {
|
||||
echo "❌ Generation failed: " . ($gen_d["error"] ?? "unknown") . "\n";
|
||||
echo "MD content was: " . substr($md_content, 0, 200);
|
||||
exit;
|
||||
}
|
||||
|
||||
// === 3. Output rich response ===
|
||||
$icon = match($type) { "pdf"=>"📄", "docx"=>"📝", "pptx"=>"🎯", "html"=>"🌐", default=>"📎" };
|
||||
echo "$icon **$title** généré\n\n";
|
||||
echo "🔗 Télécharger: " . $gen_d["full_url"] . "\n";
|
||||
echo "📦 Taille: " . $gen_d["size_human"] . " · ⚙️ " . $gen_d["elapsed_ms"] . "ms · engine: " . $gen_d["engine"] . "\n\n";
|
||||
echo "---\n\nAperçu contenu:\n\n";
|
||||
echo substr($md_content, 0, 800);
|
||||
if (strlen($md_content) > 800) echo "\n\n... [document complet dans le fichier]";
|
||||
11
api/ambre-gold-check.php
Normal file
11
api/ambre-gold-check.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
// Find GOLD backups of wevia.html today
|
||||
$cmd = "ls -lt /opt/wevads/vault/wevia.html.GOLD-20260421-* 2>/dev/null | head -10";
|
||||
$out = @shell_exec($cmd);
|
||||
echo json_encode([
|
||||
"backups" => array_filter(array_map("trim", explode("\n", $out ?: ""))),
|
||||
"live_size" => filesize("/var/www/html/wevia.html"),
|
||||
"live_mtime" => gmdate("c", filemtime("/var/www/html/wevia.html")),
|
||||
"live_md5" => md5_file("/var/www/html/wevia.html"),
|
||||
], JSON_PRETTY_PRINT);
|
||||
45
api/ambre-libs-check.php
Normal file
45
api/ambre-libs-check.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* ambre-libs-check.php · REAL shell check des libs disponibles pour file generation
|
||||
*/
|
||||
header("Content-Type: application/json");
|
||||
$out = ["ok"=>true, "ts"=>date("c"), "s204"=>[]];
|
||||
|
||||
// Shell binary checks
|
||||
foreach (["pandoc","wkhtmltopdf","libreoffice","soffice","unoconv","markdown","gs"] as $cmd) {
|
||||
$p = @trim(shell_exec("which $cmd 2>/dev/null"));
|
||||
$out["s204"]["bin_$cmd"] = $p ?: "NOT FOUND";
|
||||
}
|
||||
|
||||
// Composer autoload paths (commonly in /var/www/html/vendor or /opt/wevia-brain/vendor)
|
||||
foreach (["/var/www/html/vendor/autoload.php","/opt/wevia-brain/vendor/autoload.php","/var/www/weval/vendor/autoload.php","/opt/weval-l99/vendor/autoload.php"] as $autoload) {
|
||||
if (file_exists($autoload)) {
|
||||
$out["s204"]["composer_$autoload"] = "EXISTS";
|
||||
}
|
||||
}
|
||||
|
||||
// Scan vendor folder for specific packages
|
||||
foreach (["/var/www/html/vendor","/opt/wevia-brain/vendor","/var/www/weval/vendor"] as $vendor_dir) {
|
||||
if (is_dir($vendor_dir)) {
|
||||
foreach (["dompdf","phpoffice","mpdf","tcpdf","phpspreadsheet","phppresentation","phpword"] as $pkg) {
|
||||
$found = @shell_exec("find $vendor_dir -maxdepth 3 -type d -iname "*$pkg*" 2>/dev/null | head -3");
|
||||
if (trim($found)) $out["s204"]["pkg_$pkg"] = trim($found);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PHP extensions
|
||||
$ext_list = get_loaded_extensions();
|
||||
foreach (["gd","imagick","zip","mbstring","xml","curl","openssl"] as $ext) {
|
||||
$out["s204"]["ext_$ext"] = in_array($ext, $ext_list) ? "YES" : "NO";
|
||||
}
|
||||
|
||||
// Check /var/www/html/generated directory
|
||||
$out["s204"]["generated_dir"] = is_dir("/var/www/html/generated") ? "EXISTS" : "MISSING";
|
||||
if (is_dir("/var/www/html/generated")) {
|
||||
$files = glob("/var/www/html/generated/*");
|
||||
$out["s204"]["generated_count"] = count($files);
|
||||
$out["s204"]["generated_sample"] = array_slice(array_map("basename", $files), 0, 5);
|
||||
}
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT);
|
||||
33
api/ambre-list-stubs.php
Normal file
33
api/ambre-list-stubs.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* ambre-list-stubs.php · listing wired-pending stubs related to capabilities
|
||||
*/
|
||||
header("Content-Type: application/json");
|
||||
$dir = "/var/www/html/api/wired-pending";
|
||||
$files = glob("$dir/intent-opus4-*.php") ?: [];
|
||||
$kw = $_GET["kw"] ?? "";
|
||||
$out = ["count"=>count($files), "matches"=>[]];
|
||||
foreach ($files as $f) {
|
||||
$name = basename($f, ".php");
|
||||
$short = str_replace("intent-opus4-", "", $name);
|
||||
if ($kw && stripos($short, $kw) === false) continue;
|
||||
// Read metadata if array stub
|
||||
ob_start();
|
||||
$info = @include $f;
|
||||
@ob_end_clean();
|
||||
$meta = [
|
||||
"name" => $short,
|
||||
"size" => filesize($f),
|
||||
"mtime" => gmdate("c", filemtime($f)),
|
||||
];
|
||||
if (is_array($info)) {
|
||||
$meta["triggers"] = $info["triggers"] ?? [];
|
||||
$meta["status"] = $info["status"] ?? "?";
|
||||
$meta["cmd"] = $info["cmd"] ?? "?";
|
||||
} else {
|
||||
$meta["type"] = "direct-exec";
|
||||
}
|
||||
$out["matches"][] = $meta;
|
||||
}
|
||||
$out["matches_count"] = count($out["matches"]);
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
30
api/ambre-logo-finder.php
Normal file
30
api/ambre-logo-finder.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$out = [];
|
||||
$targets = [
|
||||
"/var/www/html/solution",
|
||||
"/var/www/html/solutions",
|
||||
"/var/www/html/assets",
|
||||
"/var/www/html/wevia-ia",
|
||||
"/var/www/html/img",
|
||||
"/var/www/html/images",
|
||||
"/var/www/html/static",
|
||||
"/var/www/html",
|
||||
];
|
||||
foreach ($targets as $t) {
|
||||
if (!is_dir($t)) { $out[$t] = "MISSING"; continue; }
|
||||
$logos = @glob("$t/*logo*wevia*") ?: [];
|
||||
$logos = array_merge($logos, @glob("$t/*wevia*logo*") ?: []);
|
||||
$logos = array_merge($logos, @glob("$t/logo-wevia*") ?: []);
|
||||
$logos = array_merge($logos, @glob("$t/wevia-logo*") ?: []);
|
||||
// Also direct files
|
||||
foreach (["logo.svg","logo.png","wevia.svg","wevia.png","logo-wevia.svg","logo-wevia.png"] as $name) {
|
||||
if (file_exists("$t/$name")) $logos[] = "$t/$name";
|
||||
}
|
||||
if ($logos) $out[$t] = array_map(function($p){return ["path"=>$p,"size"=>@filesize($p)];}, array_unique($logos));
|
||||
}
|
||||
// Also check /solution* root-level
|
||||
$root = @shell_exec("ls -d /solution* /var/www/html/solution* 2>/dev/null");
|
||||
if ($root) $out["solution_roots"] = trim($root);
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
73
api/ambre-pw-debug.php
Normal file
73
api/ambre-pw-debug.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$base = "/var/www/html/api/ambre-pw-tests";
|
||||
$spec = <<<'JS'
|
||||
const { test, expect } = require("@playwright/test");
|
||||
|
||||
test("debug router click flow", async ({ page }) => {
|
||||
test.setTimeout(120000);
|
||||
|
||||
// Capture console logs
|
||||
const logs = [];
|
||||
page.on("console", msg => {
|
||||
logs.push(`[${msg.type()}] ${msg.text().substring(0, 300)}`);
|
||||
});
|
||||
|
||||
// Inject diagnostic script
|
||||
await page.addInitScript(() => {
|
||||
window.__ambre_fetch_calls = [];
|
||||
const origFetch = window.fetch;
|
||||
window.fetch = function(...args) {
|
||||
window.__ambre_fetch_calls.push({url: args[0], body: args[1] && args[1].body ? args[1].body.toString().substring(0, 200) : null});
|
||||
return origFetch.apply(this, args);
|
||||
};
|
||||
});
|
||||
|
||||
await page.goto("/wevia.html");
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForTimeout(1500);
|
||||
|
||||
// Send PDF
|
||||
const input = page.locator("#msgInput");
|
||||
await input.fill("Genere un PDF sur: test debug");
|
||||
await input.press("Enter");
|
||||
await page.waitForTimeout(8000);
|
||||
|
||||
// Dump state
|
||||
const state = await page.evaluate(() => ({
|
||||
busy: typeof busy !== "undefined" ? busy : "undefined",
|
||||
pendingFile: typeof pendingFile !== "undefined" ? pendingFile : "undefined",
|
||||
fetch_calls: window.__ambre_fetch_calls || [],
|
||||
msg_input_disabled: document.getElementById("msgInput").disabled,
|
||||
msg_input_value: document.getElementById("msgInput").value,
|
||||
assistant_count: document.querySelectorAll(".msg.assistant").length,
|
||||
user_count: document.querySelectorAll(".msg.user").length,
|
||||
has_router: !!window._ambre_gen_pat,
|
||||
}));
|
||||
|
||||
console.log("=== STATE AFTER PDF SEND ===");
|
||||
console.log(JSON.stringify(state, null, 2));
|
||||
|
||||
// Now try 2nd message
|
||||
await input.fill("Genere un document Word sur: test2");
|
||||
await input.press("Enter");
|
||||
await page.waitForTimeout(8000);
|
||||
|
||||
const state2 = await page.evaluate(() => ({
|
||||
busy: typeof busy !== "undefined" ? busy : "undefined",
|
||||
fetch_calls_count: (window.__ambre_fetch_calls || []).length,
|
||||
last_fetch: (window.__ambre_fetch_calls || []).slice(-3),
|
||||
assistant_count: document.querySelectorAll(".msg.assistant").length,
|
||||
user_count: document.querySelectorAll(".msg.user").length,
|
||||
}));
|
||||
console.log("=== STATE AFTER WORD SEND ===");
|
||||
console.log(JSON.stringify(state2, null, 2));
|
||||
|
||||
// Write logs to file
|
||||
require("fs").writeFileSync("output/debug-console.log", logs.join("\n"));
|
||||
});
|
||||
JS;
|
||||
file_put_contents("$base/tests/debug-flow.spec.js", $spec);
|
||||
// Remove v5 to not rerun
|
||||
@unlink("$base/tests/chat-capabilities-v5.spec.js");
|
||||
echo json_encode(["ok"=>true, "size"=>filesize("$base/tests/debug-flow.spec.js")]);
|
||||
33
api/ambre-pw-deep.php
Normal file
33
api/ambre-pw-deep.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$out = [];
|
||||
|
||||
// Read playwright-check.sh
|
||||
$f = "/var/www/html/api/v76-scripts/playwright-check.sh";
|
||||
if (file_exists($f)) $out["pw_check_sh"] = @file_get_contents($f);
|
||||
|
||||
// Targeted config locations
|
||||
$cfgs = ["/var/www/html/playwright.config.js", "/var/www/html/playwright.config.ts",
|
||||
"/var/www/html/api/playwright.config.js", "/opt/weval-l99/playwright.config.js"];
|
||||
foreach ($cfgs as $c) if (file_exists($c)) $out["config_$c"] = substr(@file_get_contents($c), 0, 600);
|
||||
|
||||
// Find recent spec files in common dirs (no find/ recursive)
|
||||
foreach (["/var/www/html", "/var/www/html/tests", "/var/www/html/api", "/opt/weval-l99/tests"] as $d) {
|
||||
foreach (glob("$d/*.spec.{js,ts}", GLOB_BRACE) as $s) $out["specs"][] = $s;
|
||||
foreach (glob("$d/tests/*.spec.{js,ts}", GLOB_BRACE) as $s) $out["specs"][] = $s;
|
||||
}
|
||||
|
||||
// which playwright
|
||||
$out["which_npx"] = trim(@shell_exec("which npx 2>&1") ?: "");
|
||||
$out["which_playwright"] = trim(@shell_exec("which playwright 2>&1") ?: "");
|
||||
|
||||
// Look for package.json with playwright
|
||||
foreach (["/var/www/html/package.json", "/var/www/html/api/package.json", "/opt/weval-l99/package.json"] as $p) {
|
||||
if (file_exists($p)) {
|
||||
$pkg = @json_decode(@file_get_contents($p), true);
|
||||
$has_pw = isset($pkg["devDependencies"]["@playwright/test"]) || isset($pkg["dependencies"]["@playwright/test"]);
|
||||
if ($has_pw || $pkg) $out["pkg_$p"] = ["has_playwright"=>$has_pw, "scripts"=>$pkg["scripts"]??[]];
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
34
api/ambre-pw-files.php
Normal file
34
api/ambre-pw-files.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$base = "/var/www/html/api/ambre-pw-tests/output";
|
||||
$out = ["v2_screenshots"=>[], "v2_videos"=>[], "v1_videos"=>[]];
|
||||
|
||||
foreach (glob("$base/v2-*.png") as $p) {
|
||||
$out["v2_screenshots"][] = [
|
||||
"name" => basename($p),
|
||||
"size_kb" => round(filesize($p)/1024, 1),
|
||||
"url" => "https://weval-consulting.com/api/ambre-pw-tests/output/" . basename($p),
|
||||
];
|
||||
}
|
||||
|
||||
// V2 webm in new subdir
|
||||
foreach (glob("$base/chat-capabilities-v2-*/*.webm") as $w) {
|
||||
$rel = str_replace($base . "/", "", $w);
|
||||
$out["v2_videos"][] = [
|
||||
"name" => basename($w),
|
||||
"size_kb" => round(filesize($w)/1024, 1),
|
||||
"url" => "https://weval-consulting.com/api/ambre-pw-tests/output/" . $rel,
|
||||
];
|
||||
}
|
||||
|
||||
// V1 webm
|
||||
foreach (glob("$base/chat-capabilities-WEVIA-*/*.webm") as $w) {
|
||||
$rel = str_replace($base . "/", "", $w);
|
||||
$out["v1_videos"][] = [
|
||||
"name" => basename($w),
|
||||
"size_kb" => round(filesize($w)/1024, 1),
|
||||
"url" => "https://weval-consulting.com/api/ambre-pw-tests/output/" . $rel,
|
||||
];
|
||||
}
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
12
api/ambre-pw-install.php
Normal file
12
api/ambre-pw-install.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
$base = "/var/www/html/api/ambre-pw-tests";
|
||||
// Try npm install
|
||||
echo "=== npm install @playwright/test ===\n";
|
||||
$out = @shell_exec("cd $base && timeout 120 npm install --no-audit --no-fund @playwright/test 2>&1 | tail -40");
|
||||
echo $out ?? "(no output)";
|
||||
echo "\n\n=== node_modules check ===\n";
|
||||
echo @shell_exec("ls -la $base/node_modules/.bin/ 2>&1 | head -20");
|
||||
echo "\n\n=== try run after install ===\n";
|
||||
$run = @shell_exec("cd $base && timeout 3 ./node_modules/.bin/playwright --version 2>&1");
|
||||
echo $run ?? "(no output)";
|
||||
10
api/ambre-pw-kill.php
Normal file
10
api/ambre-pw-kill.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
// Kill running playwright processes
|
||||
$killed = @shell_exec("pkill -f playwright 2>&1");
|
||||
sleep(1);
|
||||
$still = @shell_exec("ps aux | grep playwright | grep -v grep | wc -l");
|
||||
echo json_encode([
|
||||
"killed_output" => trim($killed ?: ""),
|
||||
"processes_remaining" => trim($still ?: ""),
|
||||
], JSON_PRETTY_PRINT);
|
||||
11
api/ambre-pw-killall.php
Normal file
11
api/ambre-pw-killall.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$out = [];
|
||||
// Try multiple kill methods
|
||||
$out["pkill_user"] = trim(@shell_exec("pkill -9 -u www-data -f playwright 2>&1") ?: "(empty)");
|
||||
$out["pkill_f_all"] = trim(@shell_exec("pkill -9 -f chat-capabilities 2>&1") ?: "(empty)");
|
||||
$out["pkill_node"] = trim(@shell_exec("pkill -9 -f "node.*playwright" 2>&1") ?: "(empty)");
|
||||
sleep(2);
|
||||
$out["remaining"] = trim(@shell_exec("ps -ef | grep -E "playwright|chromium.*headless" | grep -v grep | wc -l") ?: "0");
|
||||
$out["procs_snapshot"] = trim(@shell_exec("ps -ef | grep playwright | grep -v grep | awk "{print \$2, \$10, \$11}" | head -10") ?: "");
|
||||
echo json_encode($out, JSON_PRETTY_PRINT);
|
||||
13
api/ambre-pw-listnow.php
Normal file
13
api/ambre-pw-listnow.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$base = "/var/www/html/api/ambre-pw-tests/output";
|
||||
$out = ["pngs"=>[], "videos"=>[]];
|
||||
foreach (glob("$base/v*.png") as $p) {
|
||||
$out["pngs"][] = ["name"=>basename($p), "kb"=>round(filesize($p)/1024,1), "mtime"=>gmdate("H:i:s", filemtime($p))];
|
||||
}
|
||||
usort($out["pngs"], function($a,$b){return strcmp($a["name"], $b["name"]);});
|
||||
|
||||
foreach (glob("$base/chat-capabilities-v*/*.webm") as $w) {
|
||||
$out["videos"][] = ["name"=>basename(dirname($w)), "mb"=>round(filesize($w)/1048576,2), "mtime"=>gmdate("H:i:s", filemtime($w))];
|
||||
}
|
||||
echo json_encode($out, JSON_PRETTY_PRINT);
|
||||
8
api/ambre-pw-log.php
Normal file
8
api/ambre-pw-log.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
$logs = glob("/tmp/ambre-pw-*.log");
|
||||
foreach ($logs as $l) {
|
||||
echo "=== " . basename($l) . " (size=" . filesize($l) . "B) ===\n";
|
||||
echo @file_get_contents($l, false, null, 0, 3000);
|
||||
echo "\n\n";
|
||||
}
|
||||
10
api/ambre-pw-procs.php
Normal file
10
api/ambre-pw-procs.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$procs = @shell_exec("pgrep -af playwright 2>&1 | head -5");
|
||||
$logs = glob("/tmp/ambre-pw-run-*.log");
|
||||
usort($logs, function($a,$b){return filemtime($b)-filemtime($a);});
|
||||
echo json_encode([
|
||||
"procs" => trim($procs ?: ""),
|
||||
"latest_log" => $logs ? basename($logs[0]) : "",
|
||||
"latest_size" => $logs ? filesize($logs[0]) : 0,
|
||||
], JSON_PRETTY_PRINT);
|
||||
15
api/ambre-pw-readlog.php
Normal file
15
api/ambre-pw-readlog.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
// Find latest pw run log
|
||||
$logs = glob("/tmp/ambre-pw-run-*.log");
|
||||
usort($logs, function($a,$b){return filemtime($b)-filemtime($a);});
|
||||
if (empty($logs)) { echo "NO LOG FILES\n"; exit; }
|
||||
$latest = $logs[0];
|
||||
echo "=== $latest ===\n";
|
||||
echo "Size: " . filesize($latest) . "B\n\n";
|
||||
echo @file_get_contents($latest);
|
||||
echo "\n\n=== Test dir listing ===\n";
|
||||
$base = "/var/www/html/api/ambre-pw-tests";
|
||||
echo @shell_exec("ls -la $base/ 2>&1");
|
||||
echo "\n=== Output dir ===\n";
|
||||
echo @shell_exec("ls -la $base/output/ 2>&1");
|
||||
24
api/ambre-pw-run.php
Normal file
24
api/ambre-pw-run.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$base = "/var/www/html/api/ambre-pw-tests";
|
||||
$ts = date("Ymd-His");
|
||||
$log = "/tmp/ambre-pw-run-$ts.log";
|
||||
|
||||
// Use LOCAL playwright
|
||||
$cmd = "cd $base && ./node_modules/.bin/playwright test --config=playwright.config.js 2>&1";
|
||||
|
||||
// Background launch
|
||||
$full_cmd = "nohup bash -c '$cmd > $log 2>&1' > /dev/null 2>&1 & echo \$!";
|
||||
$pid = trim(@shell_exec($full_cmd) ?? "");
|
||||
|
||||
sleep(2);
|
||||
// Check alive
|
||||
$alive = trim(@shell_exec("ps -p $pid -o pid= 2>/dev/null") ?? "");
|
||||
|
||||
echo json_encode([
|
||||
"ok" => true,
|
||||
"pid" => $pid,
|
||||
"alive" => !empty($alive),
|
||||
"log" => $log,
|
||||
"cmd" => $cmd,
|
||||
], JSON_PRETTY_PRINT);
|
||||
24
api/ambre-pw-search.php
Normal file
24
api/ambre-pw-search.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$out = [];
|
||||
|
||||
// Latest webm videos - use recursive glob pattern with mtime
|
||||
$dirs = glob("/var/www/html/api/playwright-results/*", GLOB_ONLYDIR);
|
||||
$webms = [];
|
||||
foreach (array_slice($dirs, -20) as $subdir) {
|
||||
foreach (glob("$subdir/*.webm") as $w) {
|
||||
$webms[] = ["file"=>basename($w), "dir"=>basename($subdir), "size"=>filesize($w), "mtime"=>filemtime($w)];
|
||||
}
|
||||
}
|
||||
usort($webms, function($a,$b){ return $b["mtime"] - $a["mtime"]; });
|
||||
$out["latest_webms"] = array_slice(array_map(function($w){
|
||||
return ["file"=>$w["file"], "dir"=>$w["dir"], "size_kb"=>round($w["size"]/1024,1), "ts"=>gmdate("c", $w["mtime"])];
|
||||
}, $webms), 0, 10);
|
||||
|
||||
// v76-scripts root files only
|
||||
$out["v76_root"] = array_map("basename", array_slice(glob("/var/www/html/api/v76-scripts/*.*"), 0, 20));
|
||||
|
||||
// playwright php endpoints
|
||||
$out["pw_php"] = array_map("basename", glob("/var/www/html/api/*playwright*.php"));
|
||||
|
||||
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
116
api/ambre-pw-setup.php
Normal file
116
api/ambre-pw-setup.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$base = "/var/www/html/api/ambre-pw-tests";
|
||||
@mkdir("$base", 0755, true);
|
||||
@mkdir("$base/tests", 0755, true);
|
||||
@mkdir("$base/output", 0755, true);
|
||||
|
||||
// === playwright.config.js ===
|
||||
$config = '// @ts-check
|
||||
const { defineConfig, devices } = require("@playwright/test");
|
||||
module.exports = defineConfig({
|
||||
testDir: "./tests",
|
||||
timeout: 120000,
|
||||
retries: 0,
|
||||
workers: 1,
|
||||
use: {
|
||||
baseURL: "https://weval-consulting.com",
|
||||
trace: "off",
|
||||
screenshot: "on",
|
||||
video: "on",
|
||||
viewport: { width: 1280, height: 720 },
|
||||
ignoreHTTPSErrors: true,
|
||||
},
|
||||
outputDir: "./output",
|
||||
reporter: [["list"], ["json", { outputFile: "./output/results.json" }]],
|
||||
projects: [
|
||||
{ name: "chromium", use: { ...devices["Desktop Chrome"] } },
|
||||
],
|
||||
});';
|
||||
file_put_contents("$base/playwright.config.js", $config);
|
||||
|
||||
// === package.json ===
|
||||
$pkg = json_encode([
|
||||
"name" => "ambre-chat-tests",
|
||||
"version" => "1.0.0",
|
||||
"scripts" => ["test" => "playwright test"],
|
||||
"devDependencies" => ["@playwright/test" => "^1.58.0"],
|
||||
], JSON_PRETTY_PRINT);
|
||||
file_put_contents("$base/package.json", $pkg);
|
||||
|
||||
// === chat-capabilities.spec.js ===
|
||||
$spec = <<<'JS'
|
||||
const { test, expect } = require("@playwright/test");
|
||||
|
||||
const CAPABILITIES = [
|
||||
{ name: "PDF", msg: "Genere un PDF sur: WEVIA demo" },
|
||||
{ name: "Word", msg: "Genere un document Word sur: strategie" },
|
||||
{ name: "PPT", msg: "Genere une presentation sur: pitch" },
|
||||
{ name: "Mermaid", msg: "Genere un schema mermaid pour: flow" },
|
||||
{ name: "Image", msg: "Genere une image: logo" },
|
||||
{ name: "Code", msg: "Ecris le code python pour: fibonacci" },
|
||||
{ name: "Traduire", msg: "Traduis en anglais: bonjour" },
|
||||
{ name: "Ping", msg: "ping" },
|
||||
];
|
||||
|
||||
test.describe("WEVIA Chat Capabilities Test", () => {
|
||||
test("8 capabilities end-to-end with video", async ({ page }) => {
|
||||
test.setTimeout(300000);
|
||||
|
||||
console.log("🎬 Ouverture wevia.html");
|
||||
await page.goto("/wevia.html");
|
||||
await page.waitForLoadState("networkidle");
|
||||
await page.waitForTimeout(1500);
|
||||
|
||||
// Screenshot initial state
|
||||
await page.screenshot({ path: "output/00-initial.png", fullPage: false });
|
||||
console.log("📸 Screenshot initial OK");
|
||||
|
||||
const input = page.locator("#msgInput");
|
||||
const sendBtn = page.locator("#sendBtn, button[onclick*=send], button.send-btn").first();
|
||||
|
||||
for (let i = 0; i < CAPABILITIES.length; i++) {
|
||||
const cap = CAPABILITIES[i];
|
||||
const num = String(i + 1).padStart(2, "0");
|
||||
console.log(`\n🔷 [${i + 1}/8] ${cap.name}: ${cap.msg}`);
|
||||
|
||||
// Clear and type
|
||||
await input.click();
|
||||
await input.fill(cap.msg);
|
||||
await page.waitForTimeout(400);
|
||||
|
||||
// Send (Enter key is fallback)
|
||||
await input.press("Enter");
|
||||
console.log(` Message envoyé`);
|
||||
|
||||
// Wait for response (thinking bubble disappears + message rendered)
|
||||
try {
|
||||
await page.waitForSelector(".msg.assistant:last-of-type .bubble", { timeout: 60000, state: "visible" });
|
||||
} catch (e) {
|
||||
console.log(` ⚠️ Pas de réponse détectée rapidement`);
|
||||
}
|
||||
await page.waitForTimeout(2500);
|
||||
|
||||
// Screenshot de la réponse
|
||||
await page.screenshot({ path: `output/${num}-${cap.name}.png` });
|
||||
console.log(` 📸 Screenshot ${num}-${cap.name}.png capturé`);
|
||||
}
|
||||
|
||||
// Final screenshot
|
||||
await page.waitForTimeout(1500);
|
||||
await page.screenshot({ path: "output/99-final.png", fullPage: true });
|
||||
console.log("\n✅ Test terminé - 8 capabilities enregistrées avec vidéo");
|
||||
});
|
||||
});
|
||||
JS;
|
||||
file_put_contents("$base/tests/chat-capabilities.spec.js", $spec);
|
||||
|
||||
echo json_encode([
|
||||
"ok" => true,
|
||||
"files" => [
|
||||
"config" => filesize("$base/playwright.config.js"),
|
||||
"spec" => filesize("$base/tests/chat-capabilities.spec.js"),
|
||||
"package" => filesize("$base/package.json"),
|
||||
],
|
||||
"base" => $base,
|
||||
], JSON_PRETTY_PRINT);
|
||||
19
api/ambre-pw-status.php
Normal file
19
api/ambre-pw-status.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
$procs = @shell_exec("ps auxf 2>/dev/null | grep -E "playwright|chromium" | grep -v grep | head -5");
|
||||
$logs = glob("/tmp/ambre-pw-*.log");
|
||||
$latest_logs = [];
|
||||
foreach ($logs as $l) {
|
||||
$latest_logs[] = [
|
||||
"file" => basename($l),
|
||||
"size" => filesize($l),
|
||||
"tail" => @shell_exec("tail -c 1500 $l 2>/dev/null"),
|
||||
];
|
||||
}
|
||||
$script = "/var/www/html/api/v76-scripts/playwright-check.sh";
|
||||
$first = file_exists($script) ? substr(@file_get_contents($script), 0, 500) : "NOT FOUND";
|
||||
echo json_encode([
|
||||
"running" => trim($procs ?? "none"),
|
||||
"logs" => $latest_logs,
|
||||
"script_preview" => $first,
|
||||
], JSON_PRETTY_PRINT);
|
||||
1
api/ambre-pw-tests/node_modules/.bin/playwright
generated
vendored
Symbolic link
1
api/ambre-pw-tests/node_modules/.bin/playwright
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../@playwright/test/cli.js
|
||||
1
api/ambre-pw-tests/node_modules/.bin/playwright-core
generated
vendored
Symbolic link
1
api/ambre-pw-tests/node_modules/.bin/playwright-core
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../playwright-core/cli.js
|
||||
56
api/ambre-pw-tests/node_modules/.package-lock.json
generated
vendored
Normal file
56
api/ambre-pw-tests/node_modules/.package-lock.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "ambre-chat-tests",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@playwright/test": {
|
||||
"version": "1.59.1",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.59.1.tgz",
|
||||
"integrity": "sha512-PG6q63nQg5c9rIi4/Z5lR5IVF7yU5MqmKaPOe0HSc0O2cX1fPi96sUQu5j7eo4gKCkB2AnNGoWt7y4/Xx3Kcqg==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"playwright": "1.59.1"
|
||||
},
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/playwright": {
|
||||
"version": "1.59.1",
|
||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.59.1.tgz",
|
||||
"integrity": "sha512-C8oWjPR3F81yljW9o5OxcWzfh6avkVwDD2VYdwIGqTkl+OGFISgypqzfu7dOe4QNLL2aqcWBmI3PMtLIK233lw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"playwright-core": "1.59.1"
|
||||
},
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/playwright-core": {
|
||||
"version": "1.59.1",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.59.1.tgz",
|
||||
"integrity": "sha512-HBV/RJg81z5BiiZ9yPzIiClYV/QMsDCKUyogwH9p3MCP6IYjUFu/MActgYAvK0oWyV9NlwM3GLBjADyWgydVyg==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"playwright-core": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
202
api/ambre-pw-tests/node_modules/@playwright/test/LICENSE
generated
vendored
Normal file
202
api/ambre-pw-tests/node_modules/@playwright/test/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Portions Copyright (c) Microsoft Corporation.
|
||||
Portions Copyright 2017 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
5
api/ambre-pw-tests/node_modules/@playwright/test/NOTICE
generated
vendored
Normal file
5
api/ambre-pw-tests/node_modules/@playwright/test/NOTICE
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
Playwright
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
This software contains code derived from the Puppeteer project (https://github.com/puppeteer/puppeteer),
|
||||
available under the Apache 2.0 license (https://github.com/puppeteer/puppeteer/blob/master/LICENSE).
|
||||
170
api/ambre-pw-tests/node_modules/@playwright/test/README.md
generated
vendored
Normal file
170
api/ambre-pw-tests/node_modules/@playwright/test/README.md
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
# 🎭 Playwright
|
||||
|
||||
[](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[](https://webkit.org/)<!-- GEN:stop --> [](https://aka.ms/playwright/discord)
|
||||
|
||||
## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright)
|
||||
|
||||
Playwright is a framework for Web Testing and Automation. It allows testing [Chromium](https://www.chromium.org/Home)<sup>1</sup>, [Firefox](https://www.mozilla.org/en-US/firefox/new/) and [WebKit](https://webkit.org/) with a single API. Playwright is built to enable cross-browser web automation that is **ever-green**, **capable**, **reliable**, and **fast**.
|
||||
|
||||
| | Linux | macOS | Windows |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Chromium<sup>1</sup> <!-- GEN:chromium-version -->147.0.7727.15<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| WebKit <!-- GEN:webkit-version -->26.4<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->148.0.2<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
|
||||
Headless execution is supported for all browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/intro#system-requirements) for details.
|
||||
|
||||
Looking for Playwright for [Python](https://playwright.dev/python/docs/intro), [.NET](https://playwright.dev/dotnet/docs/intro), or [Java](https://playwright.dev/java/docs/intro)?
|
||||
|
||||
<sup>1</sup> Playwright uses [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing) by default.
|
||||
|
||||
## Installation
|
||||
|
||||
Playwright has its own test runner for end-to-end tests, we call it Playwright Test.
|
||||
|
||||
### Using init command
|
||||
|
||||
The easiest way to get started with Playwright Test is to run the init command.
|
||||
|
||||
```Shell
|
||||
# Run from your project's root directory
|
||||
npm init playwright@latest
|
||||
# Or create a new project
|
||||
npm init playwright@latest new-project
|
||||
```
|
||||
|
||||
This will create a configuration file, optionally add examples, a GitHub Action workflow and a first test example.spec.ts. You can now jump directly to writing assertions section.
|
||||
|
||||
### Manually
|
||||
|
||||
Add dependency and install browsers.
|
||||
|
||||
```Shell
|
||||
npm i -D @playwright/test
|
||||
# install supported browsers
|
||||
npx playwright install
|
||||
```
|
||||
|
||||
You can optionally install only selected browsers, see [install browsers](https://playwright.dev/docs/cli#install-browsers) for more details. Or you can install no browsers at all and use existing [browser channels](https://playwright.dev/docs/browsers).
|
||||
|
||||
* [Getting started](https://playwright.dev/docs/intro)
|
||||
* [API reference](https://playwright.dev/docs/api/class-playwright)
|
||||
|
||||
## Capabilities
|
||||
|
||||
### Resilient • No flaky tests
|
||||
|
||||
**Auto-wait**. Playwright waits for elements to be actionable prior to performing actions. It also has a rich set of introspection events. The combination of the two eliminates the need for artificial timeouts - a primary cause of flaky tests.
|
||||
|
||||
**Web-first assertions**. Playwright assertions are created specifically for the dynamic web. Checks are automatically retried until the necessary conditions are met.
|
||||
|
||||
**Tracing**. Configure test retry strategy, capture execution trace, videos and screenshots to eliminate flakes.
|
||||
|
||||
### No trade-offs • No limits
|
||||
|
||||
Browsers run web content belonging to different origins in different processes. Playwright is aligned with the architecture of the modern browsers and runs tests out-of-process. This makes Playwright free of the typical in-process test runner limitations.
|
||||
|
||||
**Multiple everything**. Test scenarios that span multiple tabs, multiple origins and multiple users. Create scenarios with different contexts for different users and run them against your server, all in one test.
|
||||
|
||||
**Trusted events**. Hover elements, interact with dynamic controls and produce trusted events. Playwright uses real browser input pipeline indistinguishable from the real user.
|
||||
|
||||
Test frames, pierce Shadow DOM. Playwright selectors pierce shadow DOM and allow entering frames seamlessly.
|
||||
|
||||
### Full isolation • Fast execution
|
||||
|
||||
**Browser contexts**. Playwright creates a browser context for each test. Browser context is equivalent to a brand new browser profile. This delivers full test isolation with zero overhead. Creating a new browser context only takes a handful of milliseconds.
|
||||
|
||||
**Log in once**. Save the authentication state of the context and reuse it in all the tests. This bypasses repetitive log-in operations in each test, yet delivers full isolation of independent tests.
|
||||
|
||||
### Powerful Tooling
|
||||
|
||||
**[Codegen](https://playwright.dev/docs/codegen)**. Generate tests by recording your actions. Save them into any language.
|
||||
|
||||
**[Playwright inspector](https://playwright.dev/docs/inspector)**. Inspect page, generate selectors, step through the test execution, see click points and explore execution logs.
|
||||
|
||||
**[Trace Viewer](https://playwright.dev/docs/trace-viewer)**. Capture all the information to investigate the test failure. Playwright trace contains test execution screencast, live DOM snapshots, action explorer, test source and many more.
|
||||
|
||||
Looking for Playwright for [TypeScript](https://playwright.dev/docs/intro), [JavaScript](https://playwright.dev/docs/intro), [Python](https://playwright.dev/python/docs/intro), [.NET](https://playwright.dev/dotnet/docs/intro), or [Java](https://playwright.dev/java/docs/intro)?
|
||||
|
||||
## Examples
|
||||
|
||||
To learn how to run these Playwright Test examples, check out our [getting started docs](https://playwright.dev/docs/intro).
|
||||
|
||||
#### Page screenshot
|
||||
|
||||
This code snippet navigates to Playwright homepage and saves a screenshot.
|
||||
|
||||
```TypeScript
|
||||
import { test } from '@playwright/test';
|
||||
|
||||
test('Page Screenshot', async ({ page }) => {
|
||||
await page.goto('https://playwright.dev/');
|
||||
await page.screenshot({ path: `example.png` });
|
||||
});
|
||||
```
|
||||
|
||||
#### Mobile and geolocation
|
||||
|
||||
This snippet emulates Mobile Safari on a device at given geolocation, navigates to maps.google.com, performs the action and takes a screenshot.
|
||||
|
||||
```TypeScript
|
||||
import { test, devices } from '@playwright/test';
|
||||
|
||||
test.use({
|
||||
...devices['iPhone 13 Pro'],
|
||||
locale: 'en-US',
|
||||
geolocation: { longitude: 12.492507, latitude: 41.889938 },
|
||||
permissions: ['geolocation'],
|
||||
})
|
||||
|
||||
test('Mobile and geolocation', async ({ page }) => {
|
||||
await page.goto('https://maps.google.com');
|
||||
await page.getByText('Your location').click();
|
||||
await page.waitForRequest(/.*preview\/pwa/);
|
||||
await page.screenshot({ path: 'colosseum-iphone.png' });
|
||||
});
|
||||
```
|
||||
|
||||
#### Evaluate in browser context
|
||||
|
||||
This code snippet navigates to example.com, and executes a script in the page context.
|
||||
|
||||
```TypeScript
|
||||
import { test } from '@playwright/test';
|
||||
|
||||
test('Evaluate in browser context', async ({ page }) => {
|
||||
await page.goto('https://www.example.com/');
|
||||
const dimensions = await page.evaluate(() => {
|
||||
return {
|
||||
width: document.documentElement.clientWidth,
|
||||
height: document.documentElement.clientHeight,
|
||||
deviceScaleFactor: window.devicePixelRatio
|
||||
}
|
||||
});
|
||||
console.log(dimensions);
|
||||
});
|
||||
```
|
||||
|
||||
#### Intercept network requests
|
||||
|
||||
This code snippet sets up request routing for a page to log all network requests.
|
||||
|
||||
```TypeScript
|
||||
import { test } from '@playwright/test';
|
||||
|
||||
test('Intercept network requests', async ({ page }) => {
|
||||
// Log and continue all network requests
|
||||
await page.route('**', route => {
|
||||
console.log(route.request().url());
|
||||
route.continue();
|
||||
});
|
||||
await page.goto('http://todomvc.com');
|
||||
});
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
* [Documentation](https://playwright.dev)
|
||||
* [API reference](https://playwright.dev/docs/api/class-playwright/)
|
||||
* [Contribution guide](CONTRIBUTING.md)
|
||||
* [Changelog](https://github.com/microsoft/playwright/releases)
|
||||
19
api/ambre-pw-tests/node_modules/@playwright/test/cli.js
generated
vendored
Executable file
19
api/ambre-pw-tests/node_modules/@playwright/test/cli.js
generated
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const { program } = require('playwright/lib/program');
|
||||
program.parse(process.argv);
|
||||
18
api/ambre-pw-tests/node_modules/@playwright/test/index.d.ts
generated
vendored
Normal file
18
api/ambre-pw-tests/node_modules/@playwright/test/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from 'playwright/test';
|
||||
export { default } from 'playwright/test';
|
||||
17
api/ambre-pw-tests/node_modules/@playwright/test/index.js
generated
vendored
Normal file
17
api/ambre-pw-tests/node_modules/@playwright/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
module.exports = require('playwright/test');
|
||||
18
api/ambre-pw-tests/node_modules/@playwright/test/index.mjs
generated
vendored
Normal file
18
api/ambre-pw-tests/node_modules/@playwright/test/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from 'playwright/test';
|
||||
export { default } from 'playwright/test';
|
||||
35
api/ambre-pw-tests/node_modules/@playwright/test/package.json
generated
vendored
Normal file
35
api/ambre-pw-tests/node_modules/@playwright/test/package.json
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "@playwright/test",
|
||||
"version": "1.59.1",
|
||||
"description": "A high-level API to automate web browsers",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/microsoft/playwright.git"
|
||||
},
|
||||
"homepage": "https://playwright.dev",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./index.mjs",
|
||||
"require": "./index.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./cli": "./cli.js",
|
||||
"./package.json": "./package.json",
|
||||
"./reporter": "./reporter.js"
|
||||
},
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"playwright": "1.59.1"
|
||||
}
|
||||
}
|
||||
17
api/ambre-pw-tests/node_modules/@playwright/test/reporter.d.ts
generated
vendored
Normal file
17
api/ambre-pw-tests/node_modules/@playwright/test/reporter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from 'playwright/types/testReporter';
|
||||
17
api/ambre-pw-tests/node_modules/@playwright/test/reporter.js
generated
vendored
Normal file
17
api/ambre-pw-tests/node_modules/@playwright/test/reporter.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// We only export types in reporter.d.ts.
|
||||
17
api/ambre-pw-tests/node_modules/@playwright/test/reporter.mjs
generated
vendored
Normal file
17
api/ambre-pw-tests/node_modules/@playwright/test/reporter.mjs
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// We only export types in reporter.d.ts.
|
||||
202
api/ambre-pw-tests/node_modules/playwright-core/LICENSE
generated
vendored
Normal file
202
api/ambre-pw-tests/node_modules/playwright-core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Portions Copyright (c) Microsoft Corporation.
|
||||
Portions Copyright 2017 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
5
api/ambre-pw-tests/node_modules/playwright-core/NOTICE
generated
vendored
Normal file
5
api/ambre-pw-tests/node_modules/playwright-core/NOTICE
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
Playwright
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
This software contains code derived from the Puppeteer project (https://github.com/puppeteer/puppeteer),
|
||||
available under the Apache 2.0 license (https://github.com/puppeteer/puppeteer/blob/master/LICENSE).
|
||||
3
api/ambre-pw-tests/node_modules/playwright-core/README.md
generated
vendored
Normal file
3
api/ambre-pw-tests/node_modules/playwright-core/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# playwright-core
|
||||
|
||||
This package contains the no-browser flavor of [Playwright](http://github.com/microsoft/playwright).
|
||||
3552
api/ambre-pw-tests/node_modules/playwright-core/ThirdPartyNotices.txt
generated
vendored
Normal file
3552
api/ambre-pw-tests/node_modules/playwright-core/ThirdPartyNotices.txt
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5
api/ambre-pw-tests/node_modules/playwright-core/bin/install_media_pack.ps1
generated
vendored
Normal file
5
api/ambre-pw-tests/node_modules/playwright-core/bin/install_media_pack.ps1
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
$osInfo = Get-WmiObject -Class Win32_OperatingSystem
|
||||
# check if running on Windows Server
|
||||
if ($osInfo.ProductType -eq 3) {
|
||||
Install-WindowsFeature Server-Media-Foundation
|
||||
}
|
||||
33
api/ambre-pw-tests/node_modules/playwright-core/bin/install_webkit_wsl.ps1
generated
vendored
Normal file
33
api/ambre-pw-tests/node_modules/playwright-core/bin/install_webkit_wsl.ps1
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# This script sets up a WSL distribution that will be used to run WebKit.
|
||||
|
||||
$Distribution = "playwright"
|
||||
$Username = "pwuser"
|
||||
|
||||
$distributions = (wsl --list --quiet) -split "\r?\n"
|
||||
if ($distributions -contains $Distribution) {
|
||||
Write-Host "WSL distribution '$Distribution' already exists. Skipping installation."
|
||||
} else {
|
||||
Write-Host "Installing new WSL distribution '$Distribution'..."
|
||||
$VhdSize = "10GB"
|
||||
wsl --install -d Ubuntu-24.04 --name $Distribution --no-launch --vhd-size $VhdSize
|
||||
wsl -d $Distribution -u root adduser --gecos GECOS --disabled-password $Username
|
||||
}
|
||||
|
||||
$pwshDirname = (Resolve-Path -Path $PSScriptRoot).Path;
|
||||
$playwrightCoreRoot = Resolve-Path (Join-Path $pwshDirname "..")
|
||||
|
||||
$initScript = @"
|
||||
if [ ! -f "/home/$Username/node/bin/node" ]; then
|
||||
mkdir -p /home/$Username/node
|
||||
curl -fsSL https://nodejs.org/dist/v22.17.0/node-v22.17.0-linux-x64.tar.xz -o /home/$Username/node/node-v22.17.0-linux-x64.tar.xz
|
||||
tar -xJf /home/$Username/node/node-v22.17.0-linux-x64.tar.xz -C /home/$Username/node --strip-components=1
|
||||
sudo -u $Username echo 'export PATH=/home/$Username/node/bin:\`$PATH' >> /home/$Username/.profile
|
||||
fi
|
||||
/home/$Username/node/bin/node cli.js install-deps webkit
|
||||
sudo -u $Username PLAYWRIGHT_SKIP_BROWSER_GC=1 /home/$Username/node/bin/node cli.js install webkit
|
||||
"@ -replace "\r\n", "`n"
|
||||
|
||||
wsl -d $Distribution --cd $playwrightCoreRoot -u root -- bash -c "$initScript"
|
||||
Write-Host "Done!"
|
||||
42
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh
generated
vendored
Executable file
42
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh
generated
vendored
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [[ $(arch) == "aarch64" ]]; then
|
||||
echo "ERROR: not supported on Linux Arm64"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then
|
||||
if [[ ! -f "/etc/os-release" ]]; then
|
||||
echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ID=$(bash -c 'source /etc/os-release && echo $ID')
|
||||
if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then
|
||||
echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 1. make sure to remove old beta if any.
|
||||
if dpkg --get-selections | grep -q "^google-chrome-beta[[:space:]]*install$" >/dev/null; then
|
||||
apt-get remove -y google-chrome-beta
|
||||
fi
|
||||
|
||||
# 2. Update apt lists (needed to install curl and chrome dependencies)
|
||||
apt-get update
|
||||
|
||||
# 3. Install curl to download chrome
|
||||
if ! command -v curl >/dev/null; then
|
||||
apt-get install -y curl
|
||||
fi
|
||||
|
||||
# 4. download chrome beta from dl.google.com and install it.
|
||||
cd /tmp
|
||||
curl -O https://dl.google.com/linux/direct/google-chrome-beta_current_amd64.deb
|
||||
apt-get install -y ./google-chrome-beta_current_amd64.deb
|
||||
rm -rf ./google-chrome-beta_current_amd64.deb
|
||||
cd -
|
||||
google-chrome-beta --version
|
||||
13
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh
generated
vendored
Executable file
13
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh
generated
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
rm -rf "/Applications/Google Chrome Beta.app"
|
||||
cd /tmp
|
||||
curl --retry 3 -o ./googlechromebeta.dmg https://dl.google.com/chrome/mac/universal/beta/googlechromebeta.dmg
|
||||
hdiutil attach -nobrowse -quiet -noautofsck -noautoopen -mountpoint /Volumes/googlechromebeta.dmg ./googlechromebeta.dmg
|
||||
cp -pR "/Volumes/googlechromebeta.dmg/Google Chrome Beta.app" /Applications
|
||||
hdiutil detach /Volumes/googlechromebeta.dmg
|
||||
rm -rf /tmp/googlechromebeta.dmg
|
||||
|
||||
/Applications/Google\ Chrome\ Beta.app/Contents/MacOS/Google\ Chrome\ Beta --version
|
||||
24
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1
generated
vendored
Normal file
24
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$url = 'https://dl.google.com/tag/s/dl/chrome/install/beta/googlechromebetastandaloneenterprise64.msi'
|
||||
|
||||
Write-Host "Downloading Google Chrome Beta"
|
||||
$wc = New-Object net.webclient
|
||||
$msiInstaller = "$env:temp\google-chrome-beta.msi"
|
||||
$wc.Downloadfile($url, $msiInstaller)
|
||||
|
||||
Write-Host "Installing Google Chrome Beta"
|
||||
$arguments = "/i `"$msiInstaller`" /quiet"
|
||||
Start-Process msiexec.exe -ArgumentList $arguments -Wait
|
||||
Remove-Item $msiInstaller
|
||||
|
||||
$suffix = "\\Google\\Chrome Beta\\Application\\chrome.exe"
|
||||
if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
|
||||
(Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo
|
||||
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
|
||||
(Get-Item "${env:ProgramFiles}$suffix").VersionInfo
|
||||
} else {
|
||||
Write-Host "ERROR: Failed to install Google Chrome Beta."
|
||||
Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help."
|
||||
exit 1
|
||||
}
|
||||
42
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh
generated
vendored
Executable file
42
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh
generated
vendored
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [[ $(arch) == "aarch64" ]]; then
|
||||
echo "ERROR: not supported on Linux Arm64"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then
|
||||
if [[ ! -f "/etc/os-release" ]]; then
|
||||
echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ID=$(bash -c 'source /etc/os-release && echo $ID')
|
||||
if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then
|
||||
echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 1. make sure to remove old stable if any.
|
||||
if dpkg --get-selections | grep -q "^google-chrome[[:space:]]*install$" >/dev/null; then
|
||||
apt-get remove -y google-chrome
|
||||
fi
|
||||
|
||||
# 2. Update apt lists (needed to install curl and chrome dependencies)
|
||||
apt-get update
|
||||
|
||||
# 3. Install curl to download chrome
|
||||
if ! command -v curl >/dev/null; then
|
||||
apt-get install -y curl
|
||||
fi
|
||||
|
||||
# 4. download chrome stable from dl.google.com and install it.
|
||||
cd /tmp
|
||||
curl -O https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||
apt-get install -y ./google-chrome-stable_current_amd64.deb
|
||||
rm -rf ./google-chrome-stable_current_amd64.deb
|
||||
cd -
|
||||
google-chrome --version
|
||||
12
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh
generated
vendored
Executable file
12
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh
generated
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
rm -rf "/Applications/Google Chrome.app"
|
||||
cd /tmp
|
||||
curl --retry 3 -o ./googlechrome.dmg https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg
|
||||
hdiutil attach -nobrowse -quiet -noautofsck -noautoopen -mountpoint /Volumes/googlechrome.dmg ./googlechrome.dmg
|
||||
cp -pR "/Volumes/googlechrome.dmg/Google Chrome.app" /Applications
|
||||
hdiutil detach /Volumes/googlechrome.dmg
|
||||
rm -rf /tmp/googlechrome.dmg
|
||||
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version
|
||||
24
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1
generated
vendored
Normal file
24
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$url = 'https://dl.google.com/tag/s/dl/chrome/install/googlechromestandaloneenterprise64.msi'
|
||||
|
||||
$wc = New-Object net.webclient
|
||||
$msiInstaller = "$env:temp\google-chrome.msi"
|
||||
Write-Host "Downloading Google Chrome"
|
||||
$wc.Downloadfile($url, $msiInstaller)
|
||||
|
||||
Write-Host "Installing Google Chrome"
|
||||
$arguments = "/i `"$msiInstaller`" /quiet"
|
||||
Start-Process msiexec.exe -ArgumentList $arguments -Wait
|
||||
Remove-Item $msiInstaller
|
||||
|
||||
|
||||
$suffix = "\\Google\\Chrome\\Application\\chrome.exe"
|
||||
if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
|
||||
(Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo
|
||||
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
|
||||
(Get-Item "${env:ProgramFiles}$suffix").VersionInfo
|
||||
} else {
|
||||
Write-Host "ERROR: Failed to install Google Chrome."
|
||||
Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help."
|
||||
exit 1
|
||||
}
|
||||
48
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh
generated
vendored
Executable file
48
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh
generated
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [[ $(arch) == "aarch64" ]]; then
|
||||
echo "ERROR: not supported on Linux Arm64"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then
|
||||
if [[ ! -f "/etc/os-release" ]]; then
|
||||
echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ID=$(bash -c 'source /etc/os-release && echo $ID')
|
||||
if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then
|
||||
echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 1. make sure to remove old beta if any.
|
||||
if dpkg --get-selections | grep -q "^microsoft-edge-beta[[:space:]]*install$" >/dev/null; then
|
||||
apt-get remove -y microsoft-edge-beta
|
||||
fi
|
||||
|
||||
# 2. Install curl to download Microsoft gpg key
|
||||
if ! command -v curl >/dev/null; then
|
||||
apt-get update
|
||||
apt-get install -y curl
|
||||
fi
|
||||
|
||||
# GnuPG is not preinstalled in slim images
|
||||
if ! command -v gpg >/dev/null; then
|
||||
apt-get update
|
||||
apt-get install -y gpg
|
||||
fi
|
||||
|
||||
# 3. Add the GPG key, the apt repo, update the apt cache, and install the package
|
||||
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/microsoft.gpg
|
||||
install -o root -g root -m 644 /tmp/microsoft.gpg /etc/apt/trusted.gpg.d/
|
||||
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
|
||||
rm /tmp/microsoft.gpg
|
||||
apt-get update && apt-get install -y microsoft-edge-beta
|
||||
|
||||
microsoft-edge-beta --version
|
||||
11
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh
generated
vendored
Executable file
11
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh
generated
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
cd /tmp
|
||||
curl --retry 3 -o ./msedge_beta.pkg "$1"
|
||||
# Note: there's no way to uninstall previously installed MSEdge.
|
||||
# However, running PKG again seems to update installation.
|
||||
sudo installer -pkg /tmp/msedge_beta.pkg -target /
|
||||
rm -rf /tmp/msedge_beta.pkg
|
||||
/Applications/Microsoft\ Edge\ Beta.app/Contents/MacOS/Microsoft\ Edge\ Beta --version
|
||||
23
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1
generated
vendored
Normal file
23
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$url = $args[0]
|
||||
|
||||
Write-Host "Downloading Microsoft Edge Beta"
|
||||
$wc = New-Object net.webclient
|
||||
$msiInstaller = "$env:temp\microsoft-edge-beta.msi"
|
||||
$wc.Downloadfile($url, $msiInstaller)
|
||||
|
||||
Write-Host "Installing Microsoft Edge Beta"
|
||||
$arguments = "/i `"$msiInstaller`" /quiet"
|
||||
Start-Process msiexec.exe -ArgumentList $arguments -Wait
|
||||
Remove-Item $msiInstaller
|
||||
|
||||
$suffix = "\\Microsoft\\Edge Beta\\Application\\msedge.exe"
|
||||
if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
|
||||
(Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo
|
||||
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
|
||||
(Get-Item "${env:ProgramFiles}$suffix").VersionInfo
|
||||
} else {
|
||||
Write-Host "ERROR: Failed to install Microsoft Edge Beta."
|
||||
Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help."
|
||||
exit 1
|
||||
}
|
||||
48
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh
generated
vendored
Executable file
48
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh
generated
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [[ $(arch) == "aarch64" ]]; then
|
||||
echo "ERROR: not supported on Linux Arm64"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then
|
||||
if [[ ! -f "/etc/os-release" ]]; then
|
||||
echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ID=$(bash -c 'source /etc/os-release && echo $ID')
|
||||
if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then
|
||||
echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 1. make sure to remove old dev if any.
|
||||
if dpkg --get-selections | grep -q "^microsoft-edge-dev[[:space:]]*install$" >/dev/null; then
|
||||
apt-get remove -y microsoft-edge-dev
|
||||
fi
|
||||
|
||||
# 2. Install curl to download Microsoft gpg key
|
||||
if ! command -v curl >/dev/null; then
|
||||
apt-get update
|
||||
apt-get install -y curl
|
||||
fi
|
||||
|
||||
# GnuPG is not preinstalled in slim images
|
||||
if ! command -v gpg >/dev/null; then
|
||||
apt-get update
|
||||
apt-get install -y gpg
|
||||
fi
|
||||
|
||||
# 3. Add the GPG key, the apt repo, update the apt cache, and install the package
|
||||
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/microsoft.gpg
|
||||
install -o root -g root -m 644 /tmp/microsoft.gpg /etc/apt/trusted.gpg.d/
|
||||
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
|
||||
rm /tmp/microsoft.gpg
|
||||
apt-get update && apt-get install -y microsoft-edge-dev
|
||||
|
||||
microsoft-edge-dev --version
|
||||
11
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh
generated
vendored
Executable file
11
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh
generated
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
cd /tmp
|
||||
curl --retry 3 -o ./msedge_dev.pkg "$1"
|
||||
# Note: there's no way to uninstall previously installed MSEdge.
|
||||
# However, running PKG again seems to update installation.
|
||||
sudo installer -pkg /tmp/msedge_dev.pkg -target /
|
||||
rm -rf /tmp/msedge_dev.pkg
|
||||
/Applications/Microsoft\ Edge\ Dev.app/Contents/MacOS/Microsoft\ Edge\ Dev --version
|
||||
23
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1
generated
vendored
Normal file
23
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$url = $args[0]
|
||||
|
||||
Write-Host "Downloading Microsoft Edge Dev"
|
||||
$wc = New-Object net.webclient
|
||||
$msiInstaller = "$env:temp\microsoft-edge-dev.msi"
|
||||
$wc.Downloadfile($url, $msiInstaller)
|
||||
|
||||
Write-Host "Installing Microsoft Edge Dev"
|
||||
$arguments = "/i `"$msiInstaller`" /quiet"
|
||||
Start-Process msiexec.exe -ArgumentList $arguments -Wait
|
||||
Remove-Item $msiInstaller
|
||||
|
||||
$suffix = "\\Microsoft\\Edge Dev\\Application\\msedge.exe"
|
||||
if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
|
||||
(Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo
|
||||
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
|
||||
(Get-Item "${env:ProgramFiles}$suffix").VersionInfo
|
||||
} else {
|
||||
Write-Host "ERROR: Failed to install Microsoft Edge Dev."
|
||||
Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help."
|
||||
exit 1
|
||||
}
|
||||
48
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh
generated
vendored
Executable file
48
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh
generated
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if [[ $(arch) == "aarch64" ]]; then
|
||||
echo "ERROR: not supported on Linux Arm64"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then
|
||||
if [[ ! -f "/etc/os-release" ]]; then
|
||||
echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ID=$(bash -c 'source /etc/os-release && echo $ID')
|
||||
if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then
|
||||
echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 1. make sure to remove old stable if any.
|
||||
if dpkg --get-selections | grep -q "^microsoft-edge-stable[[:space:]]*install$" >/dev/null; then
|
||||
apt-get remove -y microsoft-edge-stable
|
||||
fi
|
||||
|
||||
# 2. Install curl to download Microsoft gpg key
|
||||
if ! command -v curl >/dev/null; then
|
||||
apt-get update
|
||||
apt-get install -y curl
|
||||
fi
|
||||
|
||||
# GnuPG is not preinstalled in slim images
|
||||
if ! command -v gpg >/dev/null; then
|
||||
apt-get update
|
||||
apt-get install -y gpg
|
||||
fi
|
||||
|
||||
# 3. Add the GPG key, the apt repo, update the apt cache, and install the package
|
||||
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/microsoft.gpg
|
||||
install -o root -g root -m 644 /tmp/microsoft.gpg /etc/apt/trusted.gpg.d/
|
||||
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-stable.list'
|
||||
rm /tmp/microsoft.gpg
|
||||
apt-get update && apt-get install -y microsoft-edge-stable
|
||||
|
||||
microsoft-edge-stable --version
|
||||
11
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh
generated
vendored
Executable file
11
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh
generated
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
cd /tmp
|
||||
curl --retry 3 -o ./msedge_stable.pkg "$1"
|
||||
# Note: there's no way to uninstall previously installed MSEdge.
|
||||
# However, running PKG again seems to update installation.
|
||||
sudo installer -pkg /tmp/msedge_stable.pkg -target /
|
||||
rm -rf /tmp/msedge_stable.pkg
|
||||
/Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge --version
|
||||
24
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1
generated
vendored
Normal file
24
api/ambre-pw-tests/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$url = $args[0]
|
||||
|
||||
Write-Host "Downloading Microsoft Edge"
|
||||
$wc = New-Object net.webclient
|
||||
$msiInstaller = "$env:temp\microsoft-edge-stable.msi"
|
||||
$wc.Downloadfile($url, $msiInstaller)
|
||||
|
||||
Write-Host "Installing Microsoft Edge"
|
||||
$arguments = "/i `"$msiInstaller`" /quiet"
|
||||
Start-Process msiexec.exe -ArgumentList $arguments -Wait
|
||||
Remove-Item $msiInstaller
|
||||
|
||||
$suffix = "\\Microsoft\\Edge\\Application\\msedge.exe"
|
||||
if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
|
||||
(Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo
|
||||
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
|
||||
(Get-Item "${env:ProgramFiles}$suffix").VersionInfo
|
||||
} else {
|
||||
Write-Host "ERROR: Failed to install Microsoft Edge."
|
||||
Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help."
|
||||
exit 1
|
||||
}
|
||||
81
api/ambre-pw-tests/node_modules/playwright-core/browsers.json
generated
vendored
Normal file
81
api/ambre-pw-tests/node_modules/playwright-core/browsers.json
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"comment": "Do not edit this file, use utils/roll_browser.js",
|
||||
"browsers": [
|
||||
{
|
||||
"name": "chromium",
|
||||
"revision": "1217",
|
||||
"installByDefault": true,
|
||||
"browserVersion": "147.0.7727.15",
|
||||
"title": "Chrome for Testing"
|
||||
},
|
||||
{
|
||||
"name": "chromium-headless-shell",
|
||||
"revision": "1217",
|
||||
"installByDefault": true,
|
||||
"browserVersion": "147.0.7727.15",
|
||||
"title": "Chrome Headless Shell"
|
||||
},
|
||||
{
|
||||
"name": "chromium-tip-of-tree",
|
||||
"revision": "1417",
|
||||
"installByDefault": false,
|
||||
"browserVersion": "148.0.7755.0",
|
||||
"title": "Chrome Canary for Testing"
|
||||
},
|
||||
{
|
||||
"name": "chromium-tip-of-tree-headless-shell",
|
||||
"revision": "1417",
|
||||
"installByDefault": false,
|
||||
"browserVersion": "148.0.7755.0",
|
||||
"title": "Chrome Canary Headless Shell"
|
||||
},
|
||||
{
|
||||
"name": "firefox",
|
||||
"revision": "1511",
|
||||
"installByDefault": true,
|
||||
"browserVersion": "148.0.2",
|
||||
"title": "Firefox"
|
||||
},
|
||||
{
|
||||
"name": "firefox-beta",
|
||||
"revision": "1505",
|
||||
"installByDefault": false,
|
||||
"browserVersion": "148.0b9",
|
||||
"title": "Firefox Beta"
|
||||
},
|
||||
{
|
||||
"name": "webkit",
|
||||
"revision": "2272",
|
||||
"installByDefault": true,
|
||||
"revisionOverrides": {
|
||||
"mac14": "2251",
|
||||
"mac14-arm64": "2251",
|
||||
"debian11-x64": "2105",
|
||||
"debian11-arm64": "2105",
|
||||
"ubuntu20.04-x64": "2092",
|
||||
"ubuntu20.04-arm64": "2092"
|
||||
},
|
||||
"browserVersion": "26.4",
|
||||
"title": "WebKit"
|
||||
},
|
||||
{
|
||||
"name": "ffmpeg",
|
||||
"revision": "1011",
|
||||
"installByDefault": true,
|
||||
"revisionOverrides": {
|
||||
"mac12": "1010",
|
||||
"mac12-arm64": "1010"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "winldd",
|
||||
"revision": "1007",
|
||||
"installByDefault": false
|
||||
},
|
||||
{
|
||||
"name": "android",
|
||||
"revision": "1001",
|
||||
"installByDefault": false
|
||||
}
|
||||
]
|
||||
}
|
||||
18
api/ambre-pw-tests/node_modules/playwright-core/cli.js
generated
vendored
Executable file
18
api/ambre-pw-tests/node_modules/playwright-core/cli.js
generated
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
const { program } = require('./lib/cli/programWithTestStub');
|
||||
program.parse(process.argv);
|
||||
17
api/ambre-pw-tests/node_modules/playwright-core/index.d.ts
generated
vendored
Normal file
17
api/ambre-pw-tests/node_modules/playwright-core/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './types/types';
|
||||
32
api/ambre-pw-tests/node_modules/playwright-core/index.js
generated
vendored
Normal file
32
api/ambre-pw-tests/node_modules/playwright-core/index.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
const minimumMajorNodeVersion = 18;
|
||||
const currentNodeVersion = process.versions.node;
|
||||
const semver = currentNodeVersion.split('.');
|
||||
const [major] = [+semver[0]];
|
||||
|
||||
if (major < minimumMajorNodeVersion) {
|
||||
console.error(
|
||||
'You are running Node.js ' +
|
||||
currentNodeVersion +
|
||||
'.\n' +
|
||||
`Playwright requires Node.js ${minimumMajorNodeVersion} or higher. \n` +
|
||||
'Please update your version of Node.js.'
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
module.exports = require('./lib/inprocess');
|
||||
28
api/ambre-pw-tests/node_modules/playwright-core/index.mjs
generated
vendored
Normal file
28
api/ambre-pw-tests/node_modules/playwright-core/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import playwright from './index.js';
|
||||
|
||||
export const chromium = playwright.chromium;
|
||||
export const firefox = playwright.firefox;
|
||||
export const webkit = playwright.webkit;
|
||||
export const selectors = playwright.selectors;
|
||||
export const devices = playwright.devices;
|
||||
export const errors = playwright.errors;
|
||||
export const request = playwright.request;
|
||||
export const _electron = playwright._electron;
|
||||
export const _android = playwright._android;
|
||||
export default playwright;
|
||||
65
api/ambre-pw-tests/node_modules/playwright-core/lib/androidServerImpl.js
generated
vendored
Normal file
65
api/ambre-pw-tests/node_modules/playwright-core/lib/androidServerImpl.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var androidServerImpl_exports = {};
|
||||
__export(androidServerImpl_exports, {
|
||||
AndroidServerLauncherImpl: () => AndroidServerLauncherImpl
|
||||
});
|
||||
module.exports = __toCommonJS(androidServerImpl_exports);
|
||||
var import_playwrightServer = require("./remote/playwrightServer");
|
||||
var import_playwright = require("./server/playwright");
|
||||
var import_crypto = require("./server/utils/crypto");
|
||||
var import_utilsBundle = require("./utilsBundle");
|
||||
var import_progress = require("./server/progress");
|
||||
class AndroidServerLauncherImpl {
|
||||
async launchServer(options = {}) {
|
||||
const playwright = (0, import_playwright.createPlaywright)({ sdkLanguage: "javascript", isServer: true });
|
||||
const controller = new import_progress.ProgressController();
|
||||
let devices = await controller.run((progress) => playwright.android.devices(progress, {
|
||||
host: options.adbHost,
|
||||
port: options.adbPort,
|
||||
omitDriverInstall: options.omitDriverInstall
|
||||
}));
|
||||
if (devices.length === 0)
|
||||
throw new Error("No devices found");
|
||||
if (options.deviceSerialNumber) {
|
||||
devices = devices.filter((d) => d.serial === options.deviceSerialNumber);
|
||||
if (devices.length === 0)
|
||||
throw new Error(`No device with serial number '${options.deviceSerialNumber}' was found`);
|
||||
}
|
||||
if (devices.length > 1)
|
||||
throw new Error(`More than one device found. Please specify deviceSerialNumber`);
|
||||
const device = devices[0];
|
||||
const path = options.wsPath ? options.wsPath.startsWith("/") ? options.wsPath : `/${options.wsPath}` : `/${(0, import_crypto.createGuid)()}`;
|
||||
const server = new import_playwrightServer.PlaywrightServer({ mode: "launchServer", path, maxConnections: 1, preLaunchedAndroidDevice: device });
|
||||
const wsEndpoint = await server.listen(options.port, options.host);
|
||||
const browserServer = new import_utilsBundle.ws.EventEmitter();
|
||||
browserServer.wsEndpoint = () => wsEndpoint;
|
||||
browserServer.close = () => device.close();
|
||||
browserServer.kill = () => device.close();
|
||||
device.on("close", () => {
|
||||
server.close();
|
||||
browserServer.emit("close");
|
||||
});
|
||||
return browserServer;
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
AndroidServerLauncherImpl
|
||||
});
|
||||
77
api/ambre-pw-tests/node_modules/playwright-core/lib/bootstrap.js
generated
vendored
Normal file
77
api/ambre-pw-tests/node_modules/playwright-core/lib/bootstrap.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
if (process.env.PW_INSTRUMENT_MODULES) {
|
||||
const Module = require("module");
|
||||
const originalLoad = Module._load;
|
||||
const root = { name: "<root>", selfMs: 0, totalMs: 0, childrenMs: 0, children: [] };
|
||||
let current = root;
|
||||
const stack = [];
|
||||
Module._load = function(request, _parent, _isMain) {
|
||||
const node = { name: request, selfMs: 0, totalMs: 0, childrenMs: 0, children: [] };
|
||||
current.children.push(node);
|
||||
stack.push(current);
|
||||
current = node;
|
||||
const start = performance.now();
|
||||
let result;
|
||||
try {
|
||||
result = originalLoad.apply(this, arguments);
|
||||
} catch (e) {
|
||||
current = stack.pop();
|
||||
current.children.pop();
|
||||
throw e;
|
||||
}
|
||||
const duration = performance.now() - start;
|
||||
node.totalMs = duration;
|
||||
node.selfMs = Math.max(0, duration - node.childrenMs);
|
||||
current = stack.pop();
|
||||
current.childrenMs += duration;
|
||||
return result;
|
||||
};
|
||||
process.on("exit", () => {
|
||||
function printTree(node, prefix, isLast, lines2, depth) {
|
||||
if (node.totalMs < 1 && depth > 0)
|
||||
return;
|
||||
const connector = depth === 0 ? "" : isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
||||
const time = `${node.totalMs.toFixed(1).padStart(8)}ms`;
|
||||
const self = node.children.length ? ` (self: ${node.selfMs.toFixed(1)}ms)` : "";
|
||||
lines2.push(`${time} ${prefix}${connector}${node.name}${self}`);
|
||||
const childPrefix = prefix + (depth === 0 ? "" : isLast ? " " : "\u2502 ");
|
||||
const sorted2 = node.children.slice().sort((a, b) => b.totalMs - a.totalMs);
|
||||
for (let i = 0; i < sorted2.length; i++)
|
||||
printTree(sorted2[i], childPrefix, i === sorted2.length - 1, lines2, depth + 1);
|
||||
}
|
||||
let totalModules = 0;
|
||||
function count(n) {
|
||||
totalModules++;
|
||||
n.children.forEach(count);
|
||||
}
|
||||
root.children.forEach(count);
|
||||
const lines = [];
|
||||
const sorted = root.children.slice().sort((a, b) => b.totalMs - a.totalMs);
|
||||
for (let i = 0; i < sorted.length; i++)
|
||||
printTree(sorted[i], "", i === sorted.length - 1, lines, 0);
|
||||
const totalMs = root.children.reduce((s, c) => s + c.totalMs, 0);
|
||||
process.stderr.write(`
|
||||
--- Module load tree: ${totalModules} modules, ${totalMs.toFixed(0)}ms total ---
|
||||
` + lines.join("\n") + "\n");
|
||||
const flat = /* @__PURE__ */ new Map();
|
||||
function gather(n) {
|
||||
const existing = flat.get(n.name);
|
||||
if (existing) {
|
||||
existing.selfMs += n.selfMs;
|
||||
existing.totalMs += n.totalMs;
|
||||
existing.count++;
|
||||
} else {
|
||||
flat.set(n.name, { selfMs: n.selfMs, totalMs: n.totalMs, count: 1 });
|
||||
}
|
||||
n.children.forEach(gather);
|
||||
}
|
||||
root.children.forEach(gather);
|
||||
const top50 = [...flat.entries()].sort((a, b) => b[1].selfMs - a[1].selfMs).slice(0, 50);
|
||||
const flatLines = top50.map(
|
||||
([mod, { selfMs, totalMs: totalMs2, count: count2 }]) => `${selfMs.toFixed(1).padStart(8)}ms self ${totalMs2.toFixed(1).padStart(8)}ms total (x${String(count2).padStart(3)}) ${mod}`
|
||||
);
|
||||
process.stderr.write(`
|
||||
--- Top 50 modules by self time ---
|
||||
` + flatLines.join("\n") + "\n");
|
||||
});
|
||||
}
|
||||
120
api/ambre-pw-tests/node_modules/playwright-core/lib/browserServerImpl.js
generated
vendored
Normal file
120
api/ambre-pw-tests/node_modules/playwright-core/lib/browserServerImpl.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var browserServerImpl_exports = {};
|
||||
__export(browserServerImpl_exports, {
|
||||
BrowserServerLauncherImpl: () => BrowserServerLauncherImpl
|
||||
});
|
||||
module.exports = __toCommonJS(browserServerImpl_exports);
|
||||
var import_playwrightServer = require("./remote/playwrightServer");
|
||||
var import_helper = require("./server/helper");
|
||||
var import_playwright = require("./server/playwright");
|
||||
var import_crypto = require("./server/utils/crypto");
|
||||
var import_debug = require("./server/utils/debug");
|
||||
var import_stackTrace = require("./utils/isomorphic/stackTrace");
|
||||
var import_time = require("./utils/isomorphic/time");
|
||||
var import_utilsBundle = require("./utilsBundle");
|
||||
var validatorPrimitives = __toESM(require("./protocol/validatorPrimitives"));
|
||||
var import_progress = require("./server/progress");
|
||||
class BrowserServerLauncherImpl {
|
||||
constructor(browserName) {
|
||||
this._browserName = browserName;
|
||||
}
|
||||
async launchServer(options = {}) {
|
||||
const playwright = (0, import_playwright.createPlaywright)({ sdkLanguage: "javascript", isServer: true });
|
||||
const metadata = { id: "", startTime: 0, endTime: 0, type: "Internal", method: "", params: {}, log: [], internal: true };
|
||||
const validatorContext = {
|
||||
tChannelImpl: (names, arg, path2) => {
|
||||
throw new validatorPrimitives.ValidationError(`${path2}: channels are not expected in launchServer`);
|
||||
},
|
||||
binary: "buffer",
|
||||
isUnderTest: import_debug.isUnderTest
|
||||
};
|
||||
let launchOptions = {
|
||||
...options,
|
||||
ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : void 0,
|
||||
ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs),
|
||||
env: options.env ? envObjectToArray(options.env) : void 0,
|
||||
timeout: options.timeout ?? import_time.DEFAULT_PLAYWRIGHT_LAUNCH_TIMEOUT
|
||||
};
|
||||
let browser;
|
||||
try {
|
||||
const controller = new import_progress.ProgressController(metadata);
|
||||
browser = await controller.run(async (progress) => {
|
||||
if (options._userDataDir !== void 0) {
|
||||
const validator = validatorPrimitives.scheme["BrowserTypeLaunchPersistentContextParams"];
|
||||
launchOptions = validator({ ...launchOptions, userDataDir: options._userDataDir }, "", validatorContext);
|
||||
const context = await playwright[this._browserName].launchPersistentContext(progress, options._userDataDir, launchOptions);
|
||||
return context._browser;
|
||||
} else {
|
||||
const validator = validatorPrimitives.scheme["BrowserTypeLaunchParams"];
|
||||
launchOptions = validator(launchOptions, "", validatorContext);
|
||||
return await playwright[this._browserName].launch(progress, launchOptions, toProtocolLogger(options.logger));
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
const log = import_helper.helper.formatBrowserLogs(metadata.log);
|
||||
(0, import_stackTrace.rewriteErrorMessage)(e, `${e.message} Failed to launch browser.${log}`);
|
||||
throw e;
|
||||
}
|
||||
const path = options.wsPath ? options.wsPath.startsWith("/") ? options.wsPath : `/${options.wsPath}` : `/${(0, import_crypto.createGuid)()}`;
|
||||
const server = new import_playwrightServer.PlaywrightServer({ mode: options._sharedBrowser ? "launchServerShared" : "launchServer", path, maxConnections: Infinity, preLaunchedBrowser: browser });
|
||||
const wsEndpoint = await server.listen(options.port, options.host);
|
||||
const browserServer = new import_utilsBundle.ws.EventEmitter();
|
||||
browserServer.process = () => browser.options.browserProcess.process;
|
||||
browserServer.wsEndpoint = () => wsEndpoint;
|
||||
browserServer.close = () => browser.options.browserProcess.close();
|
||||
browserServer[Symbol.asyncDispose] = browserServer.close;
|
||||
browserServer.kill = () => browser.options.browserProcess.kill();
|
||||
browserServer._disconnectForTest = () => server.close();
|
||||
browserServer._userDataDirForTest = browser._userDataDirForTest;
|
||||
browser.options.browserProcess.onclose = (exitCode, signal) => {
|
||||
server.close();
|
||||
browserServer.emit("close", exitCode, signal);
|
||||
};
|
||||
return browserServer;
|
||||
}
|
||||
}
|
||||
function toProtocolLogger(logger) {
|
||||
return logger ? (direction, message) => {
|
||||
if (logger.isEnabled("protocol", "verbose"))
|
||||
logger.log("protocol", "verbose", (direction === "send" ? "SEND \u25BA " : "\u25C0 RECV ") + JSON.stringify(message), [], {});
|
||||
} : void 0;
|
||||
}
|
||||
function envObjectToArray(env) {
|
||||
const result = [];
|
||||
for (const name in env) {
|
||||
if (!Object.is(env[name], void 0))
|
||||
result.push({ name, value: String(env[name]) });
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
BrowserServerLauncherImpl
|
||||
});
|
||||
308
api/ambre-pw-tests/node_modules/playwright-core/lib/cli/browserActions.js
generated
vendored
Normal file
308
api/ambre-pw-tests/node_modules/playwright-core/lib/cli/browserActions.js
generated
vendored
Normal file
@@ -0,0 +1,308 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var browserActions_exports = {};
|
||||
__export(browserActions_exports, {
|
||||
codegen: () => codegen,
|
||||
open: () => open,
|
||||
pdf: () => pdf,
|
||||
screenshot: () => screenshot
|
||||
});
|
||||
module.exports = __toCommonJS(browserActions_exports);
|
||||
var import_fs = __toESM(require("fs"));
|
||||
var import_os = __toESM(require("os"));
|
||||
var import_path = __toESM(require("path"));
|
||||
var playwright = __toESM(require("../.."));
|
||||
var import_utils = require("../utils");
|
||||
var import_utilsBundle = require("../utilsBundle");
|
||||
async function launchContext(options, extraOptions) {
|
||||
validateOptions(options);
|
||||
const browserType = lookupBrowserType(options);
|
||||
const launchOptions = extraOptions;
|
||||
if (options.channel)
|
||||
launchOptions.channel = options.channel;
|
||||
launchOptions.handleSIGINT = false;
|
||||
const contextOptions = (
|
||||
// Copy the device descriptor since we have to compare and modify the options.
|
||||
options.device ? { ...playwright.devices[options.device] } : {}
|
||||
);
|
||||
if (!extraOptions.headless)
|
||||
contextOptions.deviceScaleFactor = import_os.default.platform() === "darwin" ? 2 : 1;
|
||||
if (browserType.name() === "webkit" && process.platform === "linux") {
|
||||
delete contextOptions.hasTouch;
|
||||
delete contextOptions.isMobile;
|
||||
}
|
||||
if (contextOptions.isMobile && browserType.name() === "firefox")
|
||||
contextOptions.isMobile = void 0;
|
||||
if (options.blockServiceWorkers)
|
||||
contextOptions.serviceWorkers = "block";
|
||||
if (options.proxyServer) {
|
||||
launchOptions.proxy = {
|
||||
server: options.proxyServer
|
||||
};
|
||||
if (options.proxyBypass)
|
||||
launchOptions.proxy.bypass = options.proxyBypass;
|
||||
}
|
||||
if (options.viewportSize) {
|
||||
try {
|
||||
const [width, height] = options.viewportSize.split(",").map((n) => +n);
|
||||
if (isNaN(width) || isNaN(height))
|
||||
throw new Error("bad values");
|
||||
contextOptions.viewport = { width, height };
|
||||
} catch (e) {
|
||||
throw new Error('Invalid viewport size format: use "width,height", for example --viewport-size="800,600"');
|
||||
}
|
||||
}
|
||||
if (options.geolocation) {
|
||||
try {
|
||||
const [latitude, longitude] = options.geolocation.split(",").map((n) => parseFloat(n.trim()));
|
||||
contextOptions.geolocation = {
|
||||
latitude,
|
||||
longitude
|
||||
};
|
||||
} catch (e) {
|
||||
throw new Error('Invalid geolocation format, should be "lat,long". For example --geolocation="37.819722,-122.478611"');
|
||||
}
|
||||
contextOptions.permissions = ["geolocation"];
|
||||
}
|
||||
if (options.userAgent)
|
||||
contextOptions.userAgent = options.userAgent;
|
||||
if (options.lang)
|
||||
contextOptions.locale = options.lang;
|
||||
if (options.colorScheme)
|
||||
contextOptions.colorScheme = options.colorScheme;
|
||||
if (options.timezone)
|
||||
contextOptions.timezoneId = options.timezone;
|
||||
if (options.loadStorage)
|
||||
contextOptions.storageState = options.loadStorage;
|
||||
if (options.ignoreHttpsErrors)
|
||||
contextOptions.ignoreHTTPSErrors = true;
|
||||
if (options.saveHar) {
|
||||
contextOptions.recordHar = { path: import_path.default.resolve(process.cwd(), options.saveHar), mode: "minimal" };
|
||||
if (options.saveHarGlob)
|
||||
contextOptions.recordHar.urlFilter = options.saveHarGlob;
|
||||
contextOptions.serviceWorkers = "block";
|
||||
}
|
||||
let browser;
|
||||
let context;
|
||||
if (options.userDataDir) {
|
||||
context = await browserType.launchPersistentContext(options.userDataDir, { ...launchOptions, ...contextOptions });
|
||||
browser = context.browser();
|
||||
} else {
|
||||
browser = await browserType.launch(launchOptions);
|
||||
context = await browser.newContext(contextOptions);
|
||||
}
|
||||
let closingBrowser = false;
|
||||
async function closeBrowser() {
|
||||
if (closingBrowser)
|
||||
return;
|
||||
closingBrowser = true;
|
||||
if (options.saveStorage)
|
||||
await context.storageState({ path: options.saveStorage }).catch((e) => null);
|
||||
if (options.saveHar)
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
context.on("page", (page) => {
|
||||
page.on("dialog", () => {
|
||||
});
|
||||
page.on("close", () => {
|
||||
const hasPage = browser.contexts().some((context2) => context2.pages().length > 0);
|
||||
if (hasPage)
|
||||
return;
|
||||
closeBrowser().catch(() => {
|
||||
});
|
||||
});
|
||||
});
|
||||
process.on("SIGINT", async () => {
|
||||
await closeBrowser();
|
||||
(0, import_utils.gracefullyProcessExitDoNotHang)(130);
|
||||
});
|
||||
const timeout = options.timeout ? parseInt(options.timeout, 10) : 0;
|
||||
context.setDefaultTimeout(timeout);
|
||||
context.setDefaultNavigationTimeout(timeout);
|
||||
delete launchOptions.headless;
|
||||
delete launchOptions.executablePath;
|
||||
delete launchOptions.handleSIGINT;
|
||||
delete contextOptions.deviceScaleFactor;
|
||||
return { browser, browserName: browserType.name(), context, contextOptions, launchOptions, closeBrowser };
|
||||
}
|
||||
async function openPage(context, url) {
|
||||
let page = context.pages()[0];
|
||||
if (!page)
|
||||
page = await context.newPage();
|
||||
if (url) {
|
||||
if (import_fs.default.existsSync(url))
|
||||
url = "file://" + import_path.default.resolve(url);
|
||||
else if (!url.startsWith("http") && !url.startsWith("file://") && !url.startsWith("about:") && !url.startsWith("data:"))
|
||||
url = "http://" + url;
|
||||
await page.goto(url);
|
||||
}
|
||||
return page;
|
||||
}
|
||||
async function open(options, url) {
|
||||
const { context } = await launchContext(options, { headless: !!process.env.PWTEST_CLI_HEADLESS, executablePath: process.env.PWTEST_CLI_EXECUTABLE_PATH });
|
||||
await context._exposeConsoleApi();
|
||||
await openPage(context, url);
|
||||
}
|
||||
async function codegen(options, url) {
|
||||
const { target: language, output: outputFile, testIdAttribute: testIdAttributeName } = options;
|
||||
const tracesDir = import_path.default.join(import_os.default.tmpdir(), `playwright-recorder-trace-${Date.now()}`);
|
||||
const { context, browser, launchOptions, contextOptions, closeBrowser } = await launchContext(options, {
|
||||
headless: !!process.env.PWTEST_CLI_HEADLESS,
|
||||
executablePath: process.env.PWTEST_CLI_EXECUTABLE_PATH,
|
||||
tracesDir
|
||||
});
|
||||
const donePromise = new import_utils.ManualPromise();
|
||||
maybeSetupTestHooks(browser, closeBrowser, donePromise);
|
||||
import_utilsBundle.dotenv.config({ path: "playwright.env" });
|
||||
await context._enableRecorder({
|
||||
language,
|
||||
launchOptions,
|
||||
contextOptions,
|
||||
device: options.device,
|
||||
saveStorage: options.saveStorage,
|
||||
mode: "recording",
|
||||
testIdAttributeName,
|
||||
outputFile: outputFile ? import_path.default.resolve(outputFile) : void 0,
|
||||
handleSIGINT: false
|
||||
});
|
||||
await openPage(context, url);
|
||||
donePromise.resolve();
|
||||
}
|
||||
async function maybeSetupTestHooks(browser, closeBrowser, donePromise) {
|
||||
if (!process.env.PWTEST_CLI_IS_UNDER_TEST)
|
||||
return;
|
||||
const logs = [];
|
||||
require("playwright-core/lib/utilsBundle").debug.log = (...args) => {
|
||||
const line = require("util").format(...args) + "\n";
|
||||
logs.push(line);
|
||||
process.stderr.write(line);
|
||||
};
|
||||
browser.on("disconnected", () => {
|
||||
const hasCrashLine = logs.some((line) => line.includes("process did exit:") && !line.includes("process did exit: exitCode=0, signal=null"));
|
||||
if (hasCrashLine) {
|
||||
process.stderr.write("Detected browser crash.\n");
|
||||
(0, import_utils.gracefullyProcessExitDoNotHang)(1);
|
||||
}
|
||||
});
|
||||
const close = async () => {
|
||||
await donePromise;
|
||||
await closeBrowser();
|
||||
};
|
||||
if (process.env.PWTEST_CLI_EXIT_AFTER_TIMEOUT) {
|
||||
setTimeout(close, +process.env.PWTEST_CLI_EXIT_AFTER_TIMEOUT);
|
||||
return;
|
||||
}
|
||||
let stdin = "";
|
||||
process.stdin.on("data", (data) => {
|
||||
stdin += data.toString();
|
||||
if (stdin.startsWith("exit")) {
|
||||
process.stdin.destroy();
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
async function waitForPage(page, captureOptions) {
|
||||
if (captureOptions.waitForSelector) {
|
||||
console.log(`Waiting for selector ${captureOptions.waitForSelector}...`);
|
||||
await page.waitForSelector(captureOptions.waitForSelector);
|
||||
}
|
||||
if (captureOptions.waitForTimeout) {
|
||||
console.log(`Waiting for timeout ${captureOptions.waitForTimeout}...`);
|
||||
await page.waitForTimeout(parseInt(captureOptions.waitForTimeout, 10));
|
||||
}
|
||||
}
|
||||
async function screenshot(options, captureOptions, url, path2) {
|
||||
const { context } = await launchContext(options, { headless: true });
|
||||
console.log("Navigating to " + url);
|
||||
const page = await openPage(context, url);
|
||||
await waitForPage(page, captureOptions);
|
||||
console.log("Capturing screenshot into " + path2);
|
||||
await page.screenshot({ path: path2, fullPage: !!captureOptions.fullPage });
|
||||
await page.close();
|
||||
}
|
||||
async function pdf(options, captureOptions, url, path2) {
|
||||
if (options.browser !== "chromium")
|
||||
throw new Error("PDF creation is only working with Chromium");
|
||||
const { context } = await launchContext({ ...options, browser: "chromium" }, { headless: true });
|
||||
console.log("Navigating to " + url);
|
||||
const page = await openPage(context, url);
|
||||
await waitForPage(page, captureOptions);
|
||||
console.log("Saving as pdf into " + path2);
|
||||
await page.pdf({ path: path2, format: captureOptions.paperFormat });
|
||||
await page.close();
|
||||
}
|
||||
function lookupBrowserType(options) {
|
||||
let name = options.browser;
|
||||
if (options.device) {
|
||||
const device = playwright.devices[options.device];
|
||||
name = device.defaultBrowserType;
|
||||
}
|
||||
let browserType;
|
||||
switch (name) {
|
||||
case "chromium":
|
||||
browserType = playwright.chromium;
|
||||
break;
|
||||
case "webkit":
|
||||
browserType = playwright.webkit;
|
||||
break;
|
||||
case "firefox":
|
||||
browserType = playwright.firefox;
|
||||
break;
|
||||
case "cr":
|
||||
browserType = playwright.chromium;
|
||||
break;
|
||||
case "wk":
|
||||
browserType = playwright.webkit;
|
||||
break;
|
||||
case "ff":
|
||||
browserType = playwright.firefox;
|
||||
break;
|
||||
}
|
||||
if (browserType)
|
||||
return browserType;
|
||||
import_utilsBundle.program.help();
|
||||
}
|
||||
function validateOptions(options) {
|
||||
if (options.device && !(options.device in playwright.devices)) {
|
||||
const lines = [`Device descriptor not found: '${options.device}', available devices are:`];
|
||||
for (const name in playwright.devices)
|
||||
lines.push(` "${name}"`);
|
||||
throw new Error(lines.join("\n"));
|
||||
}
|
||||
if (options.colorScheme && !["light", "dark"].includes(options.colorScheme))
|
||||
throw new Error('Invalid color scheme, should be one of "light", "dark"');
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
codegen,
|
||||
open,
|
||||
pdf,
|
||||
screenshot
|
||||
});
|
||||
98
api/ambre-pw-tests/node_modules/playwright-core/lib/cli/driver.js
generated
vendored
Normal file
98
api/ambre-pw-tests/node_modules/playwright-core/lib/cli/driver.js
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var driver_exports = {};
|
||||
__export(driver_exports, {
|
||||
launchBrowserServer: () => launchBrowserServer,
|
||||
printApiJson: () => printApiJson,
|
||||
runDriver: () => runDriver,
|
||||
runServer: () => runServer
|
||||
});
|
||||
module.exports = __toCommonJS(driver_exports);
|
||||
var import_fs = __toESM(require("fs"));
|
||||
var playwright = __toESM(require("../.."));
|
||||
var import_pipeTransport = require("../server/utils/pipeTransport");
|
||||
var import_playwrightServer = require("../remote/playwrightServer");
|
||||
var import_server = require("../server");
|
||||
var import_processLauncher = require("../server/utils/processLauncher");
|
||||
function printApiJson() {
|
||||
console.log(JSON.stringify(require("../../api.json")));
|
||||
}
|
||||
function runDriver() {
|
||||
const dispatcherConnection = new import_server.DispatcherConnection();
|
||||
new import_server.RootDispatcher(dispatcherConnection, async (rootScope, { sdkLanguage }) => {
|
||||
const playwright2 = (0, import_server.createPlaywright)({ sdkLanguage });
|
||||
return new import_server.PlaywrightDispatcher(rootScope, playwright2);
|
||||
});
|
||||
const transport = new import_pipeTransport.PipeTransport(process.stdout, process.stdin);
|
||||
transport.onmessage = (message) => dispatcherConnection.dispatch(JSON.parse(message));
|
||||
const isJavaScriptLanguageBinding = !process.env.PW_LANG_NAME || process.env.PW_LANG_NAME === "javascript";
|
||||
const replacer = !isJavaScriptLanguageBinding && String.prototype.toWellFormed ? (key, value) => {
|
||||
if (typeof value === "string")
|
||||
return value.toWellFormed();
|
||||
return value;
|
||||
} : void 0;
|
||||
dispatcherConnection.onmessage = (message) => transport.send(JSON.stringify(message, replacer));
|
||||
transport.onclose = () => {
|
||||
dispatcherConnection.onmessage = () => {
|
||||
};
|
||||
(0, import_processLauncher.gracefullyProcessExitDoNotHang)(0);
|
||||
};
|
||||
process.on("SIGINT", () => {
|
||||
});
|
||||
}
|
||||
async function runServer(options) {
|
||||
const {
|
||||
port,
|
||||
host,
|
||||
path = "/",
|
||||
maxConnections = Infinity,
|
||||
extension,
|
||||
artifactsDir
|
||||
} = options;
|
||||
const server = new import_playwrightServer.PlaywrightServer({ mode: extension ? "extension" : "default", path, maxConnections, artifactsDir });
|
||||
const wsEndpoint = await server.listen(port, host);
|
||||
process.on("exit", () => server.close().catch(console.error));
|
||||
console.log("Listening on " + wsEndpoint);
|
||||
process.stdin.on("close", () => (0, import_processLauncher.gracefullyProcessExitDoNotHang)(0));
|
||||
}
|
||||
async function launchBrowserServer(browserName, configFile) {
|
||||
let options = {};
|
||||
if (configFile)
|
||||
options = JSON.parse(import_fs.default.readFileSync(configFile).toString());
|
||||
const browserType = playwright[browserName];
|
||||
const server = await browserType.launchServer(options);
|
||||
console.log(server.wsEndpoint());
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
launchBrowserServer,
|
||||
printApiJson,
|
||||
runDriver,
|
||||
runServer
|
||||
});
|
||||
171
api/ambre-pw-tests/node_modules/playwright-core/lib/cli/installActions.js
generated
vendored
Normal file
171
api/ambre-pw-tests/node_modules/playwright-core/lib/cli/installActions.js
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var installActions_exports = {};
|
||||
__export(installActions_exports, {
|
||||
installBrowsers: () => installBrowsers,
|
||||
installDeps: () => installDeps,
|
||||
markDockerImage: () => markDockerImage,
|
||||
registry: () => import_server.registry,
|
||||
uninstallBrowsers: () => uninstallBrowsers
|
||||
});
|
||||
module.exports = __toCommonJS(installActions_exports);
|
||||
var import_path = __toESM(require("path"));
|
||||
var import_server = require("../server");
|
||||
var import_utils = require("../utils");
|
||||
var import_utils2 = require("../utils");
|
||||
var import_ascii = require("../server/utils/ascii");
|
||||
function printInstalledBrowsers(browsers) {
|
||||
const browserPaths = /* @__PURE__ */ new Set();
|
||||
for (const browser of browsers)
|
||||
browserPaths.add(browser.browserPath);
|
||||
console.log(` Browsers:`);
|
||||
for (const browserPath of [...browserPaths].sort())
|
||||
console.log(` ${browserPath}`);
|
||||
console.log(` References:`);
|
||||
const references = /* @__PURE__ */ new Set();
|
||||
for (const browser of browsers)
|
||||
references.add(browser.referenceDir);
|
||||
for (const reference of [...references].sort())
|
||||
console.log(` ${reference}`);
|
||||
}
|
||||
function printGroupedByPlaywrightVersion(browsers) {
|
||||
const dirToVersion = /* @__PURE__ */ new Map();
|
||||
for (const browser of browsers) {
|
||||
if (dirToVersion.has(browser.referenceDir))
|
||||
continue;
|
||||
const packageJSON = require(import_path.default.join(browser.referenceDir, "package.json"));
|
||||
const version = packageJSON.version;
|
||||
dirToVersion.set(browser.referenceDir, version);
|
||||
}
|
||||
const groupedByPlaywrightMinorVersion = /* @__PURE__ */ new Map();
|
||||
for (const browser of browsers) {
|
||||
const version = dirToVersion.get(browser.referenceDir);
|
||||
let entries = groupedByPlaywrightMinorVersion.get(version);
|
||||
if (!entries) {
|
||||
entries = [];
|
||||
groupedByPlaywrightMinorVersion.set(version, entries);
|
||||
}
|
||||
entries.push(browser);
|
||||
}
|
||||
const sortedVersions = [...groupedByPlaywrightMinorVersion.keys()].sort((a, b) => {
|
||||
const aComponents = a.split(".");
|
||||
const bComponents = b.split(".");
|
||||
const aMajor = parseInt(aComponents[0], 10);
|
||||
const bMajor = parseInt(bComponents[0], 10);
|
||||
if (aMajor !== bMajor)
|
||||
return aMajor - bMajor;
|
||||
const aMinor = parseInt(aComponents[1], 10);
|
||||
const bMinor = parseInt(bComponents[1], 10);
|
||||
if (aMinor !== bMinor)
|
||||
return aMinor - bMinor;
|
||||
return aComponents.slice(2).join(".").localeCompare(bComponents.slice(2).join("."));
|
||||
});
|
||||
for (const version of sortedVersions) {
|
||||
console.log(`
|
||||
Playwright version: ${version}`);
|
||||
printInstalledBrowsers(groupedByPlaywrightMinorVersion.get(version));
|
||||
}
|
||||
}
|
||||
async function markDockerImage(dockerImageNameTemplate) {
|
||||
(0, import_utils2.assert)(dockerImageNameTemplate, "dockerImageNameTemplate is required");
|
||||
await (0, import_server.writeDockerVersion)(dockerImageNameTemplate);
|
||||
}
|
||||
async function installBrowsers(args, options) {
|
||||
if ((0, import_utils.isLikelyNpxGlobal)()) {
|
||||
console.error((0, import_ascii.wrapInASCIIBox)([
|
||||
`WARNING: It looks like you are running 'npx playwright install' without first`,
|
||||
`installing your project's dependencies.`,
|
||||
``,
|
||||
`To avoid unexpected behavior, please install your dependencies first, and`,
|
||||
`then run Playwright's install command:`,
|
||||
``,
|
||||
` npm install`,
|
||||
` npx playwright install`,
|
||||
``,
|
||||
`If your project does not yet depend on Playwright, first install the`,
|
||||
`applicable npm package (most commonly @playwright/test), and`,
|
||||
`then run Playwright's install command to download the browsers:`,
|
||||
``,
|
||||
` npm install @playwright/test`,
|
||||
` npx playwright install`,
|
||||
``
|
||||
].join("\n"), 1));
|
||||
}
|
||||
if (options.shell === false && options.onlyShell)
|
||||
throw new Error(`Only one of --no-shell and --only-shell can be specified`);
|
||||
const shell = options.shell === false ? "no" : options.onlyShell ? "only" : void 0;
|
||||
const executables = import_server.registry.resolveBrowsers(args, { shell });
|
||||
if (options.withDeps)
|
||||
await import_server.registry.installDeps(executables, !!options.dryRun);
|
||||
if (options.dryRun && options.list)
|
||||
throw new Error(`Only one of --dry-run and --list can be specified`);
|
||||
if (options.dryRun) {
|
||||
for (const executable of executables) {
|
||||
console.log(import_server.registry.calculateDownloadTitle(executable));
|
||||
console.log(` Install location: ${executable.directory ?? "<system>"}`);
|
||||
if (executable.downloadURLs?.length) {
|
||||
const [url, ...fallbacks] = executable.downloadURLs;
|
||||
console.log(` Download url: ${url}`);
|
||||
for (let i = 0; i < fallbacks.length; ++i)
|
||||
console.log(` Download fallback ${i + 1}: ${fallbacks[i]}`);
|
||||
}
|
||||
console.log(``);
|
||||
}
|
||||
} else if (options.list) {
|
||||
const browsers = await import_server.registry.listInstalledBrowsers();
|
||||
printGroupedByPlaywrightVersion(browsers);
|
||||
} else {
|
||||
await import_server.registry.install(executables, { force: options.force });
|
||||
await import_server.registry.validateHostRequirementsForExecutablesIfNeeded(executables, process.env.PW_LANG_NAME || "javascript").catch((e) => {
|
||||
e.name = "Playwright Host validation warning";
|
||||
console.error(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
async function uninstallBrowsers(options) {
|
||||
delete process.env.PLAYWRIGHT_SKIP_BROWSER_GC;
|
||||
await import_server.registry.uninstall(!!options.all).then(({ numberOfBrowsersLeft }) => {
|
||||
if (!options.all && numberOfBrowsersLeft > 0) {
|
||||
console.log("Successfully uninstalled Playwright browsers for the current Playwright installation.");
|
||||
console.log(`There are still ${numberOfBrowsersLeft} browsers left, used by other Playwright installations.
|
||||
To uninstall Playwright browsers for all installations, re-run with --all flag.`);
|
||||
}
|
||||
});
|
||||
}
|
||||
async function installDeps(args, options) {
|
||||
await import_server.registry.installDeps(import_server.registry.resolveBrowsers(args, {}), !!options.dryRun);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
installBrowsers,
|
||||
installDeps,
|
||||
markDockerImage,
|
||||
registry,
|
||||
uninstallBrowsers
|
||||
});
|
||||
225
api/ambre-pw-tests/node_modules/playwright-core/lib/cli/program.js
generated
vendored
Normal file
225
api/ambre-pw-tests/node_modules/playwright-core/lib/cli/program.js
generated
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var program_exports = {};
|
||||
__export(program_exports, {
|
||||
program: () => import_utilsBundle2.program
|
||||
});
|
||||
module.exports = __toCommonJS(program_exports);
|
||||
var import_bootstrap = require("../bootstrap");
|
||||
var import_utils = require("../utils");
|
||||
var import_traceCli = require("../tools/trace/traceCli");
|
||||
var import_utilsBundle = require("../utilsBundle");
|
||||
var import_utilsBundle2 = require("../utilsBundle");
|
||||
const packageJSON = require("../../package.json");
|
||||
import_utilsBundle.program.version("Version " + (process.env.PW_CLI_DISPLAY_VERSION || packageJSON.version)).name(buildBasePlaywrightCLICommand(process.env.PW_LANG_NAME));
|
||||
import_utilsBundle.program.command("mark-docker-image [dockerImageNameTemplate]", { hidden: true }).description("mark docker image").allowUnknownOption(true).action(async function(dockerImageNameTemplate) {
|
||||
const { markDockerImage } = require("./installActions");
|
||||
markDockerImage(dockerImageNameTemplate).catch(logErrorAndExit);
|
||||
});
|
||||
commandWithOpenOptions("open [url]", "open page in browser specified via -b, --browser", []).action(async function(url, options) {
|
||||
const { open } = require("./browserActions");
|
||||
open(options, url).catch(logErrorAndExit);
|
||||
}).addHelpText("afterAll", `
|
||||
Examples:
|
||||
|
||||
$ open
|
||||
$ open -b webkit https://example.com`);
|
||||
commandWithOpenOptions(
|
||||
"codegen [url]",
|
||||
"open page and generate code for user actions",
|
||||
[
|
||||
["-o, --output <file name>", "saves the generated script to a file"],
|
||||
["--target <language>", `language to generate, one of javascript, playwright-test, python, python-async, python-pytest, csharp, csharp-mstest, csharp-nunit, java, java-junit`, codegenId()],
|
||||
["--test-id-attribute <attributeName>", "use the specified attribute to generate data test ID selectors"]
|
||||
]
|
||||
).action(async function(url, options) {
|
||||
const { codegen } = require("./browserActions");
|
||||
await codegen(options, url);
|
||||
}).addHelpText("afterAll", `
|
||||
Examples:
|
||||
|
||||
$ codegen
|
||||
$ codegen --target=python
|
||||
$ codegen -b webkit https://example.com`);
|
||||
import_utilsBundle.program.command("install [browser...]").description("ensure browsers necessary for this version of Playwright are installed").option("--with-deps", "install system dependencies for browsers").option("--dry-run", "do not execute installation, only print information").option("--list", "prints list of browsers from all playwright installations").option("--force", "force reinstall of already installed browsers").option("--only-shell", "only install headless shell when installing chromium").option("--no-shell", "do not install chromium headless shell").action(async function(args, options) {
|
||||
try {
|
||||
const { installBrowsers } = require("./installActions");
|
||||
await installBrowsers(args, options);
|
||||
} catch (e) {
|
||||
console.log(`Failed to install browsers
|
||||
${e}`);
|
||||
(0, import_utils.gracefullyProcessExitDoNotHang)(1);
|
||||
}
|
||||
}).addHelpText("afterAll", `
|
||||
|
||||
Examples:
|
||||
- $ install
|
||||
Install default browsers.
|
||||
|
||||
- $ install chrome firefox
|
||||
Install custom browsers, supports chromium, firefox, webkit, chromium-headless-shell.`);
|
||||
import_utilsBundle.program.command("uninstall").description("Removes browsers used by this installation of Playwright from the system (chromium, firefox, webkit, ffmpeg). This does not include branded channels.").option("--all", "Removes all browsers used by any Playwright installation from the system.").action(async (options) => {
|
||||
const { uninstallBrowsers } = require("./installActions");
|
||||
uninstallBrowsers(options).catch(logErrorAndExit);
|
||||
});
|
||||
import_utilsBundle.program.command("install-deps [browser...]").description("install dependencies necessary to run browsers (will ask for sudo permissions)").option("--dry-run", "Do not execute installation commands, only print them").action(async function(args, options) {
|
||||
try {
|
||||
const { installDeps } = require("./installActions");
|
||||
await installDeps(args, options);
|
||||
} catch (e) {
|
||||
console.log(`Failed to install browser dependencies
|
||||
${e}`);
|
||||
(0, import_utils.gracefullyProcessExitDoNotHang)(1);
|
||||
}
|
||||
}).addHelpText("afterAll", `
|
||||
Examples:
|
||||
- $ install-deps
|
||||
Install dependencies for default browsers.
|
||||
|
||||
- $ install-deps chrome firefox
|
||||
Install dependencies for specific browsers, supports chromium, firefox, webkit, chromium-headless-shell.`);
|
||||
const browsers = [
|
||||
{ alias: "cr", name: "Chromium", type: "chromium" },
|
||||
{ alias: "ff", name: "Firefox", type: "firefox" },
|
||||
{ alias: "wk", name: "WebKit", type: "webkit" }
|
||||
];
|
||||
for (const { alias, name, type } of browsers) {
|
||||
commandWithOpenOptions(`${alias} [url]`, `open page in ${name}`, []).action(async function(url, options) {
|
||||
const { open } = require("./browserActions");
|
||||
open({ ...options, browser: type }, url).catch(logErrorAndExit);
|
||||
}).addHelpText("afterAll", `
|
||||
Examples:
|
||||
|
||||
$ ${alias} https://example.com`);
|
||||
}
|
||||
commandWithOpenOptions(
|
||||
"screenshot <url> <filename>",
|
||||
"capture a page screenshot",
|
||||
[
|
||||
["--wait-for-selector <selector>", "wait for selector before taking a screenshot"],
|
||||
["--wait-for-timeout <timeout>", "wait for timeout in milliseconds before taking a screenshot"],
|
||||
["--full-page", "whether to take a full page screenshot (entire scrollable area)"]
|
||||
]
|
||||
).action(async function(url, filename, command) {
|
||||
const { screenshot } = require("./browserActions");
|
||||
screenshot(command, command, url, filename).catch(logErrorAndExit);
|
||||
}).addHelpText("afterAll", `
|
||||
Examples:
|
||||
|
||||
$ screenshot -b webkit https://example.com example.png`);
|
||||
commandWithOpenOptions(
|
||||
"pdf <url> <filename>",
|
||||
"save page as pdf",
|
||||
[
|
||||
["--paper-format <format>", "paper format: Letter, Legal, Tabloid, Ledger, A0, A1, A2, A3, A4, A5, A6"],
|
||||
["--wait-for-selector <selector>", "wait for given selector before saving as pdf"],
|
||||
["--wait-for-timeout <timeout>", "wait for given timeout in milliseconds before saving as pdf"]
|
||||
]
|
||||
).action(async function(url, filename, options) {
|
||||
const { pdf } = require("./browserActions");
|
||||
pdf(options, options, url, filename).catch(logErrorAndExit);
|
||||
}).addHelpText("afterAll", `
|
||||
Examples:
|
||||
|
||||
$ pdf https://example.com example.pdf`);
|
||||
import_utilsBundle.program.command("run-driver", { hidden: true }).action(async function(options) {
|
||||
const { runDriver } = require("./driver");
|
||||
runDriver();
|
||||
});
|
||||
import_utilsBundle.program.command("run-server", { hidden: true }).option("--port <port>", "Server port").option("--host <host>", "Server host").option("--path <path>", "Endpoint Path", "/").option("--max-clients <maxClients>", "Maximum clients").option("--mode <mode>", 'Server mode, either "default" or "extension"').option("--artifacts-dir <artifactsDir>", "Artifacts directory").action(async function(options) {
|
||||
const { runServer } = require("./driver");
|
||||
runServer({
|
||||
port: options.port ? +options.port : void 0,
|
||||
host: options.host,
|
||||
path: options.path,
|
||||
maxConnections: options.maxClients ? +options.maxClients : Infinity,
|
||||
extension: options.mode === "extension" || !!process.env.PW_EXTENSION_MODE,
|
||||
artifactsDir: options.artifactsDir
|
||||
}).catch(logErrorAndExit);
|
||||
});
|
||||
import_utilsBundle.program.command("print-api-json", { hidden: true }).action(async function(options) {
|
||||
const { printApiJson } = require("./driver");
|
||||
printApiJson();
|
||||
});
|
||||
import_utilsBundle.program.command("launch-server", { hidden: true }).requiredOption("--browser <browserName>", 'Browser name, one of "chromium", "firefox" or "webkit"').option("--config <path-to-config-file>", "JSON file with launchServer options").action(async function(options) {
|
||||
const { launchBrowserServer } = require("./driver");
|
||||
launchBrowserServer(options.browser, options.config);
|
||||
});
|
||||
import_utilsBundle.program.command("show-trace [trace]").option("-b, --browser <browserType>", "browser to use, one of cr, chromium, ff, firefox, wk, webkit", "chromium").option("-h, --host <host>", "Host to serve trace on; specifying this option opens trace in a browser tab").option("-p, --port <port>", "Port to serve trace on, 0 for any free port; specifying this option opens trace in a browser tab").option("--stdin", "Accept trace URLs over stdin to update the viewer").description("show trace viewer").action(async function(trace, options) {
|
||||
if (options.browser === "cr")
|
||||
options.browser = "chromium";
|
||||
if (options.browser === "ff")
|
||||
options.browser = "firefox";
|
||||
if (options.browser === "wk")
|
||||
options.browser = "webkit";
|
||||
const openOptions = {
|
||||
host: options.host,
|
||||
port: +options.port,
|
||||
isServer: !!options.stdin
|
||||
};
|
||||
const { runTraceInBrowser, runTraceViewerApp } = require("../server/trace/viewer/traceViewer");
|
||||
if (options.port !== void 0 || options.host !== void 0)
|
||||
runTraceInBrowser(trace, openOptions).catch(logErrorAndExit);
|
||||
else
|
||||
runTraceViewerApp(trace, options.browser, openOptions).catch(logErrorAndExit);
|
||||
}).addHelpText("afterAll", `
|
||||
Examples:
|
||||
|
||||
$ show-trace
|
||||
$ show-trace https://example.com/trace.zip`);
|
||||
(0, import_traceCli.addTraceCommands)(import_utilsBundle.program, logErrorAndExit);
|
||||
import_utilsBundle.program.command("cli", { hidden: true }).allowExcessArguments(true).allowUnknownOption(true).action(async (options) => {
|
||||
const { program: cliProgram } = require("../tools/cli-client/program");
|
||||
process.argv.splice(process.argv.indexOf("cli"), 1);
|
||||
cliProgram().catch(logErrorAndExit);
|
||||
});
|
||||
function logErrorAndExit(e) {
|
||||
if (process.env.PWDEBUGIMPL)
|
||||
console.error(e);
|
||||
else
|
||||
console.error(e.name + ": " + e.message);
|
||||
(0, import_utils.gracefullyProcessExitDoNotHang)(1);
|
||||
}
|
||||
function codegenId() {
|
||||
return process.env.PW_LANG_NAME || "playwright-test";
|
||||
}
|
||||
function commandWithOpenOptions(command, description, options) {
|
||||
let result = import_utilsBundle.program.command(command).description(description);
|
||||
for (const option of options)
|
||||
result = result.option(option[0], ...option.slice(1));
|
||||
return result.option("-b, --browser <browserType>", "browser to use, one of cr, chromium, ff, firefox, wk, webkit", "chromium").option("--block-service-workers", "block service workers").option("--channel <channel>", 'Chromium distribution channel, "chrome", "chrome-beta", "msedge-dev", etc').option("--color-scheme <scheme>", 'emulate preferred color scheme, "light" or "dark"').option("--device <deviceName>", 'emulate device, for example "iPhone 11"').option("--geolocation <coordinates>", 'specify geolocation coordinates, for example "37.819722,-122.478611"').option("--ignore-https-errors", "ignore https errors").option("--load-storage <filename>", "load context storage state from the file, previously saved with --save-storage").option("--lang <language>", 'specify language / locale, for example "en-GB"').option("--proxy-server <proxy>", 'specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"').option("--proxy-bypass <bypass>", 'comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com"').option("--save-har <filename>", "save HAR file with all network activity at the end").option("--save-har-glob <glob pattern>", "filter entries in the HAR by matching url against this glob pattern").option("--save-storage <filename>", "save context storage state at the end, for later use with --load-storage").option("--timezone <time zone>", 'time zone to emulate, for example "Europe/Rome"').option("--timeout <timeout>", "timeout for Playwright actions in milliseconds, no timeout by default").option("--user-agent <ua string>", "specify user agent string").option("--user-data-dir <directory>", "use the specified user data directory instead of a new context").option("--viewport-size <size>", 'specify browser viewport size in pixels, for example "1280, 720"');
|
||||
}
|
||||
function buildBasePlaywrightCLICommand(cliTargetLang) {
|
||||
switch (cliTargetLang) {
|
||||
case "python":
|
||||
return `playwright`;
|
||||
case "java":
|
||||
return `mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="...options.."`;
|
||||
case "csharp":
|
||||
return `pwsh bin/Debug/netX/playwright.ps1`;
|
||||
default: {
|
||||
const packageManagerCommand = (0, import_utils.getPackageManagerExecCommand)();
|
||||
return `${packageManagerCommand} playwright`;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
program
|
||||
});
|
||||
74
api/ambre-pw-tests/node_modules/playwright-core/lib/cli/programWithTestStub.js
generated
vendored
Normal file
74
api/ambre-pw-tests/node_modules/playwright-core/lib/cli/programWithTestStub.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var programWithTestStub_exports = {};
|
||||
__export(programWithTestStub_exports, {
|
||||
program: () => import_program2.program
|
||||
});
|
||||
module.exports = __toCommonJS(programWithTestStub_exports);
|
||||
var import_processLauncher = require("../server/utils/processLauncher");
|
||||
var import_utils = require("../utils");
|
||||
var import_program = require("./program");
|
||||
var import_program2 = require("./program");
|
||||
function printPlaywrightTestError(command) {
|
||||
const packages = [];
|
||||
for (const pkg of ["playwright", "playwright-chromium", "playwright-firefox", "playwright-webkit"]) {
|
||||
try {
|
||||
require.resolve(pkg);
|
||||
packages.push(pkg);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
if (!packages.length)
|
||||
packages.push("playwright");
|
||||
const packageManager = (0, import_utils.getPackageManager)();
|
||||
if (packageManager === "yarn") {
|
||||
console.error(`Please install @playwright/test package before running "yarn playwright ${command}"`);
|
||||
console.error(` yarn remove ${packages.join(" ")}`);
|
||||
console.error(" yarn add -D @playwright/test");
|
||||
} else if (packageManager === "pnpm") {
|
||||
console.error(`Please install @playwright/test package before running "pnpm exec playwright ${command}"`);
|
||||
console.error(` pnpm remove ${packages.join(" ")}`);
|
||||
console.error(" pnpm add -D @playwright/test");
|
||||
} else {
|
||||
console.error(`Please install @playwright/test package before running "npx playwright ${command}"`);
|
||||
console.error(` npm uninstall ${packages.join(" ")}`);
|
||||
console.error(" npm install -D @playwright/test");
|
||||
}
|
||||
}
|
||||
const kExternalPlaywrightTestCommands = [
|
||||
["test", "Run tests with Playwright Test."],
|
||||
["show-report", "Show Playwright Test HTML report."],
|
||||
["merge-reports", "Merge Playwright Test Blob reports"]
|
||||
];
|
||||
function addExternalPlaywrightTestCommands() {
|
||||
for (const [command, description] of kExternalPlaywrightTestCommands) {
|
||||
const playwrightTest = import_program.program.command(command).allowUnknownOption(true).allowExcessArguments(true);
|
||||
playwrightTest.description(`${description} Available in @playwright/test package.`);
|
||||
playwrightTest.action(async () => {
|
||||
printPlaywrightTestError(command);
|
||||
(0, import_processLauncher.gracefullyProcessExitDoNotHang)(1);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!process.env.PW_LANG_NAME)
|
||||
addExternalPlaywrightTestCommands();
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
program
|
||||
});
|
||||
361
api/ambre-pw-tests/node_modules/playwright-core/lib/client/android.js
generated
vendored
Normal file
361
api/ambre-pw-tests/node_modules/playwright-core/lib/client/android.js
generated
vendored
Normal file
@@ -0,0 +1,361 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var android_exports = {};
|
||||
__export(android_exports, {
|
||||
Android: () => Android,
|
||||
AndroidDevice: () => AndroidDevice,
|
||||
AndroidInput: () => AndroidInput,
|
||||
AndroidSocket: () => AndroidSocket,
|
||||
AndroidWebView: () => AndroidWebView
|
||||
});
|
||||
module.exports = __toCommonJS(android_exports);
|
||||
var import_eventEmitter = require("./eventEmitter");
|
||||
var import_browserContext = require("./browserContext");
|
||||
var import_channelOwner = require("./channelOwner");
|
||||
var import_errors = require("./errors");
|
||||
var import_events = require("./events");
|
||||
var import_waiter = require("./waiter");
|
||||
var import_timeoutSettings = require("./timeoutSettings");
|
||||
var import_rtti = require("../utils/isomorphic/rtti");
|
||||
var import_time = require("../utils/isomorphic/time");
|
||||
var import_timeoutRunner = require("../utils/isomorphic/timeoutRunner");
|
||||
var import_connect = require("./connect");
|
||||
class Android extends import_channelOwner.ChannelOwner {
|
||||
static from(android) {
|
||||
return android._object;
|
||||
}
|
||||
constructor(parent, type, guid, initializer) {
|
||||
super(parent, type, guid, initializer);
|
||||
this._timeoutSettings = new import_timeoutSettings.TimeoutSettings(this._platform);
|
||||
}
|
||||
setDefaultTimeout(timeout) {
|
||||
this._timeoutSettings.setDefaultTimeout(timeout);
|
||||
}
|
||||
async devices(options = {}) {
|
||||
const { devices } = await this._channel.devices(options);
|
||||
return devices.map((d) => AndroidDevice.from(d));
|
||||
}
|
||||
async launchServer(options = {}) {
|
||||
if (!this._serverLauncher)
|
||||
throw new Error("Launching server is not supported");
|
||||
return await this._serverLauncher.launchServer(options);
|
||||
}
|
||||
async connect(endpoint, options = {}) {
|
||||
return await this._wrapApiCall(async () => {
|
||||
const deadline = options.timeout ? (0, import_time.monotonicTime)() + options.timeout : 0;
|
||||
const headers = { "x-playwright-browser": "android", ...options.headers };
|
||||
const connectParams = { endpoint, headers, slowMo: options.slowMo, timeout: options.timeout || 0 };
|
||||
const connection = await (0, import_connect.connectToEndpoint)(this._connection, connectParams);
|
||||
let device;
|
||||
connection.on("close", () => {
|
||||
device?._didClose();
|
||||
});
|
||||
const result = await (0, import_timeoutRunner.raceAgainstDeadline)(async () => {
|
||||
const playwright = await connection.initializePlaywright();
|
||||
if (!playwright._initializer.preConnectedAndroidDevice) {
|
||||
connection.close();
|
||||
throw new Error("Malformed endpoint. Did you use Android.launchServer method?");
|
||||
}
|
||||
device = AndroidDevice.from(playwright._initializer.preConnectedAndroidDevice);
|
||||
device._shouldCloseConnectionOnClose = true;
|
||||
device.on(import_events.Events.AndroidDevice.Close, () => connection.close());
|
||||
return device;
|
||||
}, deadline);
|
||||
if (!result.timedOut) {
|
||||
return result.result;
|
||||
} else {
|
||||
connection.close();
|
||||
throw new Error(`Timeout ${options.timeout}ms exceeded`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
class AndroidDevice extends import_channelOwner.ChannelOwner {
|
||||
constructor(parent, type, guid, initializer) {
|
||||
super(parent, type, guid, initializer);
|
||||
this._webViews = /* @__PURE__ */ new Map();
|
||||
this._shouldCloseConnectionOnClose = false;
|
||||
this._android = parent;
|
||||
this.input = new AndroidInput(this);
|
||||
this._timeoutSettings = new import_timeoutSettings.TimeoutSettings(this._platform, parent._timeoutSettings);
|
||||
this._channel.on("webViewAdded", ({ webView }) => this._onWebViewAdded(webView));
|
||||
this._channel.on("webViewRemoved", ({ socketName }) => this._onWebViewRemoved(socketName));
|
||||
this._channel.on("close", () => this._didClose());
|
||||
}
|
||||
static from(androidDevice) {
|
||||
return androidDevice._object;
|
||||
}
|
||||
_onWebViewAdded(webView) {
|
||||
const view = new AndroidWebView(this, webView);
|
||||
this._webViews.set(webView.socketName, view);
|
||||
this.emit(import_events.Events.AndroidDevice.WebView, view);
|
||||
}
|
||||
_onWebViewRemoved(socketName) {
|
||||
const view = this._webViews.get(socketName);
|
||||
this._webViews.delete(socketName);
|
||||
if (view)
|
||||
view.emit(import_events.Events.AndroidWebView.Close);
|
||||
}
|
||||
setDefaultTimeout(timeout) {
|
||||
this._timeoutSettings.setDefaultTimeout(timeout);
|
||||
}
|
||||
serial() {
|
||||
return this._initializer.serial;
|
||||
}
|
||||
model() {
|
||||
return this._initializer.model;
|
||||
}
|
||||
webViews() {
|
||||
return [...this._webViews.values()];
|
||||
}
|
||||
async webView(selector, options) {
|
||||
const predicate = (v) => {
|
||||
if (selector.pkg)
|
||||
return v.pkg() === selector.pkg;
|
||||
if (selector.socketName)
|
||||
return v._socketName() === selector.socketName;
|
||||
return false;
|
||||
};
|
||||
const webView = [...this._webViews.values()].find(predicate);
|
||||
if (webView)
|
||||
return webView;
|
||||
return await this.waitForEvent("webview", { ...options, predicate });
|
||||
}
|
||||
async wait(selector, options = {}) {
|
||||
await this._channel.wait({ androidSelector: toSelectorChannel(selector), ...options, timeout: this._timeoutSettings.timeout(options) });
|
||||
}
|
||||
async fill(selector, text, options = {}) {
|
||||
await this._channel.fill({ androidSelector: toSelectorChannel(selector), text, ...options, timeout: this._timeoutSettings.timeout(options) });
|
||||
}
|
||||
async press(selector, key, options = {}) {
|
||||
await this.tap(selector, options);
|
||||
await this.input.press(key);
|
||||
}
|
||||
async tap(selector, options = {}) {
|
||||
await this._channel.tap({ androidSelector: toSelectorChannel(selector), ...options, timeout: this._timeoutSettings.timeout(options) });
|
||||
}
|
||||
async drag(selector, dest, options = {}) {
|
||||
await this._channel.drag({ androidSelector: toSelectorChannel(selector), dest, ...options, timeout: this._timeoutSettings.timeout(options) });
|
||||
}
|
||||
async fling(selector, direction, options = {}) {
|
||||
await this._channel.fling({ androidSelector: toSelectorChannel(selector), direction, ...options, timeout: this._timeoutSettings.timeout(options) });
|
||||
}
|
||||
async longTap(selector, options = {}) {
|
||||
await this._channel.longTap({ androidSelector: toSelectorChannel(selector), ...options, timeout: this._timeoutSettings.timeout(options) });
|
||||
}
|
||||
async pinchClose(selector, percent, options = {}) {
|
||||
await this._channel.pinchClose({ androidSelector: toSelectorChannel(selector), percent, ...options, timeout: this._timeoutSettings.timeout(options) });
|
||||
}
|
||||
async pinchOpen(selector, percent, options = {}) {
|
||||
await this._channel.pinchOpen({ androidSelector: toSelectorChannel(selector), percent, ...options, timeout: this._timeoutSettings.timeout(options) });
|
||||
}
|
||||
async scroll(selector, direction, percent, options = {}) {
|
||||
await this._channel.scroll({ androidSelector: toSelectorChannel(selector), direction, percent, ...options, timeout: this._timeoutSettings.timeout(options) });
|
||||
}
|
||||
async swipe(selector, direction, percent, options = {}) {
|
||||
await this._channel.swipe({ androidSelector: toSelectorChannel(selector), direction, percent, ...options, timeout: this._timeoutSettings.timeout(options) });
|
||||
}
|
||||
async info(selector) {
|
||||
return (await this._channel.info({ androidSelector: toSelectorChannel(selector) })).info;
|
||||
}
|
||||
async screenshot(options = {}) {
|
||||
const { binary } = await this._channel.screenshot();
|
||||
if (options.path)
|
||||
await this._platform.fs().promises.writeFile(options.path, binary);
|
||||
return binary;
|
||||
}
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.close();
|
||||
}
|
||||
async close() {
|
||||
try {
|
||||
if (this._shouldCloseConnectionOnClose)
|
||||
this._connection.close();
|
||||
else
|
||||
await this._channel.close();
|
||||
} catch (e) {
|
||||
if ((0, import_errors.isTargetClosedError)(e))
|
||||
return;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
_didClose() {
|
||||
this.emit(import_events.Events.AndroidDevice.Close, this);
|
||||
}
|
||||
async shell(command) {
|
||||
const { result } = await this._channel.shell({ command });
|
||||
return result;
|
||||
}
|
||||
async open(command) {
|
||||
return AndroidSocket.from((await this._channel.open({ command })).socket);
|
||||
}
|
||||
async installApk(file, options) {
|
||||
await this._channel.installApk({ file: await loadFile(this._platform, file), args: options && options.args });
|
||||
}
|
||||
async push(file, path, options) {
|
||||
await this._channel.push({ file: await loadFile(this._platform, file), path, mode: options ? options.mode : void 0 });
|
||||
}
|
||||
async launchBrowser(options = {}) {
|
||||
const contextOptions = await (0, import_browserContext.prepareBrowserContextParams)(this._platform, options);
|
||||
const result = await this._channel.launchBrowser(contextOptions);
|
||||
const context = import_browserContext.BrowserContext.from(result.context);
|
||||
const selectors = this._android._playwright.selectors;
|
||||
selectors._contextsForSelectors.add(context);
|
||||
context.once(import_events.Events.BrowserContext.Close, () => selectors._contextsForSelectors.delete(context));
|
||||
await context._initializeHarFromOptions(options.recordHar);
|
||||
return context;
|
||||
}
|
||||
async waitForEvent(event, optionsOrPredicate = {}) {
|
||||
return await this._wrapApiCall(async () => {
|
||||
const timeout = this._timeoutSettings.timeout(typeof optionsOrPredicate === "function" ? {} : optionsOrPredicate);
|
||||
const predicate = typeof optionsOrPredicate === "function" ? optionsOrPredicate : optionsOrPredicate.predicate;
|
||||
const waiter = import_waiter.Waiter.createForEvent(this, event);
|
||||
waiter.rejectOnTimeout(timeout, `Timeout ${timeout}ms exceeded while waiting for event "${event}"`);
|
||||
if (event !== import_events.Events.AndroidDevice.Close)
|
||||
waiter.rejectOnEvent(this, import_events.Events.AndroidDevice.Close, () => new import_errors.TargetClosedError());
|
||||
const result = await waiter.waitForEvent(this, event, predicate);
|
||||
waiter.dispose();
|
||||
return result;
|
||||
});
|
||||
}
|
||||
}
|
||||
class AndroidSocket extends import_channelOwner.ChannelOwner {
|
||||
static from(androidDevice) {
|
||||
return androidDevice._object;
|
||||
}
|
||||
constructor(parent, type, guid, initializer) {
|
||||
super(parent, type, guid, initializer);
|
||||
this._channel.on("data", ({ data }) => this.emit(import_events.Events.AndroidSocket.Data, data));
|
||||
this._channel.on("close", () => this.emit(import_events.Events.AndroidSocket.Close));
|
||||
}
|
||||
async write(data) {
|
||||
await this._channel.write({ data });
|
||||
}
|
||||
async close() {
|
||||
await this._channel.close();
|
||||
}
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.close();
|
||||
}
|
||||
}
|
||||
async function loadFile(platform, file) {
|
||||
if ((0, import_rtti.isString)(file))
|
||||
return await platform.fs().promises.readFile(file);
|
||||
return file;
|
||||
}
|
||||
class AndroidInput {
|
||||
constructor(device) {
|
||||
this._device = device;
|
||||
}
|
||||
async type(text) {
|
||||
await this._device._channel.inputType({ text });
|
||||
}
|
||||
async press(key) {
|
||||
await this._device._channel.inputPress({ key });
|
||||
}
|
||||
async tap(point) {
|
||||
await this._device._channel.inputTap({ point });
|
||||
}
|
||||
async swipe(from, segments, steps) {
|
||||
await this._device._channel.inputSwipe({ segments, steps });
|
||||
}
|
||||
async drag(from, to, steps) {
|
||||
await this._device._channel.inputDrag({ from, to, steps });
|
||||
}
|
||||
}
|
||||
function toSelectorChannel(selector) {
|
||||
const {
|
||||
checkable,
|
||||
checked,
|
||||
clazz,
|
||||
clickable,
|
||||
depth,
|
||||
desc,
|
||||
enabled,
|
||||
focusable,
|
||||
focused,
|
||||
hasChild,
|
||||
hasDescendant,
|
||||
longClickable,
|
||||
pkg,
|
||||
res,
|
||||
scrollable,
|
||||
selected,
|
||||
text
|
||||
} = selector;
|
||||
const toRegex = (value) => {
|
||||
if (value === void 0)
|
||||
return void 0;
|
||||
if ((0, import_rtti.isRegExp)(value))
|
||||
return value.source;
|
||||
return "^" + value.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d") + "$";
|
||||
};
|
||||
return {
|
||||
checkable,
|
||||
checked,
|
||||
clazz: toRegex(clazz),
|
||||
pkg: toRegex(pkg),
|
||||
desc: toRegex(desc),
|
||||
res: toRegex(res),
|
||||
text: toRegex(text),
|
||||
clickable,
|
||||
depth,
|
||||
enabled,
|
||||
focusable,
|
||||
focused,
|
||||
hasChild: hasChild ? { androidSelector: toSelectorChannel(hasChild.selector) } : void 0,
|
||||
hasDescendant: hasDescendant ? { androidSelector: toSelectorChannel(hasDescendant.selector), maxDepth: hasDescendant.maxDepth } : void 0,
|
||||
longClickable,
|
||||
scrollable,
|
||||
selected
|
||||
};
|
||||
}
|
||||
class AndroidWebView extends import_eventEmitter.EventEmitter {
|
||||
constructor(device, data) {
|
||||
super(device._platform);
|
||||
this._device = device;
|
||||
this._data = data;
|
||||
}
|
||||
pid() {
|
||||
return this._data.pid;
|
||||
}
|
||||
pkg() {
|
||||
return this._data.pkg;
|
||||
}
|
||||
_socketName() {
|
||||
return this._data.socketName;
|
||||
}
|
||||
async page() {
|
||||
if (!this._pagePromise)
|
||||
this._pagePromise = this._fetchPage();
|
||||
return await this._pagePromise;
|
||||
}
|
||||
async _fetchPage() {
|
||||
const { context } = await this._device._channel.connectToWebView({ socketName: this._data.socketName });
|
||||
return import_browserContext.BrowserContext.from(context).pages()[0];
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Android,
|
||||
AndroidDevice,
|
||||
AndroidInput,
|
||||
AndroidSocket,
|
||||
AndroidWebView
|
||||
});
|
||||
137
api/ambre-pw-tests/node_modules/playwright-core/lib/client/api.js
generated
vendored
Normal file
137
api/ambre-pw-tests/node_modules/playwright-core/lib/client/api.js
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var api_exports = {};
|
||||
__export(api_exports, {
|
||||
APIRequest: () => import_fetch.APIRequest,
|
||||
APIRequestContext: () => import_fetch.APIRequestContext,
|
||||
APIResponse: () => import_fetch.APIResponse,
|
||||
Android: () => import_android.Android,
|
||||
AndroidDevice: () => import_android.AndroidDevice,
|
||||
AndroidInput: () => import_android.AndroidInput,
|
||||
AndroidSocket: () => import_android.AndroidSocket,
|
||||
AndroidWebView: () => import_android.AndroidWebView,
|
||||
Browser: () => import_browser.Browser,
|
||||
BrowserContext: () => import_browserContext.BrowserContext,
|
||||
BrowserType: () => import_browserType.BrowserType,
|
||||
CDPSession: () => import_cdpSession.CDPSession,
|
||||
Clock: () => import_clock.Clock,
|
||||
ConsoleMessage: () => import_consoleMessage.ConsoleMessage,
|
||||
Coverage: () => import_coverage.Coverage,
|
||||
Debugger: () => import_debugger.Debugger,
|
||||
Dialog: () => import_dialog.Dialog,
|
||||
Download: () => import_download.Download,
|
||||
Electron: () => import_electron.Electron,
|
||||
ElectronApplication: () => import_electron.ElectronApplication,
|
||||
ElementHandle: () => import_elementHandle.ElementHandle,
|
||||
FileChooser: () => import_fileChooser.FileChooser,
|
||||
Frame: () => import_frame.Frame,
|
||||
FrameLocator: () => import_locator.FrameLocator,
|
||||
JSHandle: () => import_jsHandle.JSHandle,
|
||||
Keyboard: () => import_input.Keyboard,
|
||||
Locator: () => import_locator.Locator,
|
||||
Mouse: () => import_input.Mouse,
|
||||
Page: () => import_page.Page,
|
||||
Playwright: () => import_playwright.Playwright,
|
||||
Request: () => import_network.Request,
|
||||
Response: () => import_network.Response,
|
||||
Route: () => import_network.Route,
|
||||
Selectors: () => import_selectors.Selectors,
|
||||
TimeoutError: () => import_errors.TimeoutError,
|
||||
Touchscreen: () => import_input.Touchscreen,
|
||||
Tracing: () => import_tracing.Tracing,
|
||||
Video: () => import_video.Video,
|
||||
WebError: () => import_webError.WebError,
|
||||
WebSocket: () => import_network.WebSocket,
|
||||
WebSocketRoute: () => import_network.WebSocketRoute,
|
||||
Worker: () => import_worker.Worker
|
||||
});
|
||||
module.exports = __toCommonJS(api_exports);
|
||||
var import_android = require("./android");
|
||||
var import_browser = require("./browser");
|
||||
var import_browserContext = require("./browserContext");
|
||||
var import_browserType = require("./browserType");
|
||||
var import_clock = require("./clock");
|
||||
var import_consoleMessage = require("./consoleMessage");
|
||||
var import_coverage = require("./coverage");
|
||||
var import_debugger = require("./debugger");
|
||||
var import_dialog = require("./dialog");
|
||||
var import_download = require("./download");
|
||||
var import_electron = require("./electron");
|
||||
var import_locator = require("./locator");
|
||||
var import_elementHandle = require("./elementHandle");
|
||||
var import_fileChooser = require("./fileChooser");
|
||||
var import_errors = require("./errors");
|
||||
var import_frame = require("./frame");
|
||||
var import_input = require("./input");
|
||||
var import_jsHandle = require("./jsHandle");
|
||||
var import_network = require("./network");
|
||||
var import_fetch = require("./fetch");
|
||||
var import_page = require("./page");
|
||||
var import_selectors = require("./selectors");
|
||||
var import_tracing = require("./tracing");
|
||||
var import_video = require("./video");
|
||||
var import_worker = require("./worker");
|
||||
var import_cdpSession = require("./cdpSession");
|
||||
var import_playwright = require("./playwright");
|
||||
var import_webError = require("./webError");
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
APIRequest,
|
||||
APIRequestContext,
|
||||
APIResponse,
|
||||
Android,
|
||||
AndroidDevice,
|
||||
AndroidInput,
|
||||
AndroidSocket,
|
||||
AndroidWebView,
|
||||
Browser,
|
||||
BrowserContext,
|
||||
BrowserType,
|
||||
CDPSession,
|
||||
Clock,
|
||||
ConsoleMessage,
|
||||
Coverage,
|
||||
Debugger,
|
||||
Dialog,
|
||||
Download,
|
||||
Electron,
|
||||
ElectronApplication,
|
||||
ElementHandle,
|
||||
FileChooser,
|
||||
Frame,
|
||||
FrameLocator,
|
||||
JSHandle,
|
||||
Keyboard,
|
||||
Locator,
|
||||
Mouse,
|
||||
Page,
|
||||
Playwright,
|
||||
Request,
|
||||
Response,
|
||||
Route,
|
||||
Selectors,
|
||||
TimeoutError,
|
||||
Touchscreen,
|
||||
Tracing,
|
||||
Video,
|
||||
WebError,
|
||||
WebSocket,
|
||||
WebSocketRoute,
|
||||
Worker
|
||||
});
|
||||
79
api/ambre-pw-tests/node_modules/playwright-core/lib/client/artifact.js
generated
vendored
Normal file
79
api/ambre-pw-tests/node_modules/playwright-core/lib/client/artifact.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var artifact_exports = {};
|
||||
__export(artifact_exports, {
|
||||
Artifact: () => Artifact
|
||||
});
|
||||
module.exports = __toCommonJS(artifact_exports);
|
||||
var import_channelOwner = require("./channelOwner");
|
||||
var import_stream = require("./stream");
|
||||
var import_fileUtils = require("./fileUtils");
|
||||
class Artifact extends import_channelOwner.ChannelOwner {
|
||||
static from(channel) {
|
||||
return channel._object;
|
||||
}
|
||||
async pathAfterFinished() {
|
||||
if (this._connection.isRemote())
|
||||
throw new Error(`Path is not available when connecting remotely. Use saveAs() to save a local copy.`);
|
||||
return (await this._channel.pathAfterFinished()).value;
|
||||
}
|
||||
async saveAs(path) {
|
||||
if (!this._connection.isRemote()) {
|
||||
await this._channel.saveAs({ path });
|
||||
return;
|
||||
}
|
||||
const result = await this._channel.saveAsStream();
|
||||
const stream = import_stream.Stream.from(result.stream);
|
||||
await (0, import_fileUtils.mkdirIfNeeded)(this._platform, path);
|
||||
await new Promise((resolve, reject) => {
|
||||
stream.stream().pipe(this._platform.fs().createWriteStream(path)).on("finish", resolve).on("error", reject);
|
||||
});
|
||||
}
|
||||
async failure() {
|
||||
return (await this._channel.failure()).error || null;
|
||||
}
|
||||
async createReadStream() {
|
||||
const result = await this._channel.stream();
|
||||
const stream = import_stream.Stream.from(result.stream);
|
||||
return stream.stream();
|
||||
}
|
||||
async readIntoBuffer() {
|
||||
const stream = await this.createReadStream();
|
||||
return await new Promise((resolve, reject) => {
|
||||
const chunks = [];
|
||||
stream.on("data", (chunk) => {
|
||||
chunks.push(chunk);
|
||||
});
|
||||
stream.on("end", () => {
|
||||
resolve(Buffer.concat(chunks));
|
||||
});
|
||||
stream.on("error", reject);
|
||||
});
|
||||
}
|
||||
async cancel() {
|
||||
return await this._channel.cancel();
|
||||
}
|
||||
async delete() {
|
||||
return await this._channel.delete();
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Artifact
|
||||
});
|
||||
169
api/ambre-pw-tests/node_modules/playwright-core/lib/client/browser.js
generated
vendored
Normal file
169
api/ambre-pw-tests/node_modules/playwright-core/lib/client/browser.js
generated
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var browser_exports = {};
|
||||
__export(browser_exports, {
|
||||
Browser: () => Browser
|
||||
});
|
||||
module.exports = __toCommonJS(browser_exports);
|
||||
var import_artifact = require("./artifact");
|
||||
var import_browserContext = require("./browserContext");
|
||||
var import_cdpSession = require("./cdpSession");
|
||||
var import_channelOwner = require("./channelOwner");
|
||||
var import_errors = require("./errors");
|
||||
var import_events = require("./events");
|
||||
var import_fileUtils = require("./fileUtils");
|
||||
class Browser extends import_channelOwner.ChannelOwner {
|
||||
constructor(parent, type, guid, initializer) {
|
||||
super(parent, type, guid, initializer);
|
||||
this._contexts = /* @__PURE__ */ new Set();
|
||||
this._isConnected = true;
|
||||
this._shouldCloseConnectionOnClose = false;
|
||||
this._options = {};
|
||||
this._name = initializer.name;
|
||||
this._browserName = initializer.browserName;
|
||||
this._channel.on("context", ({ context }) => this._didCreateContext(import_browserContext.BrowserContext.from(context)));
|
||||
this._channel.on("close", () => this._didClose());
|
||||
this._closedPromise = new Promise((f) => this.once(import_events.Events.Browser.Disconnected, f));
|
||||
}
|
||||
static from(browser) {
|
||||
return browser._object;
|
||||
}
|
||||
browserType() {
|
||||
return this._browserType;
|
||||
}
|
||||
async newContext(options = {}) {
|
||||
return await this._innerNewContext(options, false);
|
||||
}
|
||||
async _newContextForReuse(options = {}) {
|
||||
return await this._innerNewContext(options, true);
|
||||
}
|
||||
async _disconnectFromReusedContext(reason) {
|
||||
const context = [...this._contexts].find((context2) => context2._forReuse);
|
||||
if (!context)
|
||||
return;
|
||||
await this._instrumentation.runBeforeCloseBrowserContext(context);
|
||||
for (const page of context.pages())
|
||||
page._onClose();
|
||||
context._onClose();
|
||||
await this._channel.disconnectFromReusedContext({ reason });
|
||||
}
|
||||
async _innerNewContext(userOptions = {}, forReuse) {
|
||||
const options = this._browserType._playwright.selectors._withSelectorOptions(userOptions);
|
||||
await this._instrumentation.runBeforeCreateBrowserContext(options);
|
||||
const contextOptions = await (0, import_browserContext.prepareBrowserContextParams)(this._platform, options);
|
||||
const response = forReuse ? await this._channel.newContextForReuse(contextOptions) : await this._channel.newContext(contextOptions);
|
||||
const context = import_browserContext.BrowserContext.from(response.context);
|
||||
if (forReuse)
|
||||
context._forReuse = true;
|
||||
if (options.logger)
|
||||
context._logger = options.logger;
|
||||
await context._initializeHarFromOptions(options.recordHar);
|
||||
await this._instrumentation.runAfterCreateBrowserContext(context);
|
||||
return context;
|
||||
}
|
||||
_connectToBrowserType(browserType, browserOptions, logger) {
|
||||
this._browserType = browserType;
|
||||
this._options = browserOptions;
|
||||
this._logger = logger;
|
||||
for (const context of this._contexts)
|
||||
this._setupBrowserContext(context);
|
||||
}
|
||||
_didCreateContext(context) {
|
||||
context._browser = this;
|
||||
this._contexts.add(context);
|
||||
if (this._browserType)
|
||||
this._setupBrowserContext(context);
|
||||
}
|
||||
_setupBrowserContext(context) {
|
||||
context._logger = this._logger;
|
||||
context.tracing._tracesDir = this._options.tracesDir;
|
||||
this._browserType._contexts.add(context);
|
||||
this._browserType._playwright.selectors._contextsForSelectors.add(context);
|
||||
context.setDefaultTimeout(this._browserType._playwright._defaultContextTimeout);
|
||||
context.setDefaultNavigationTimeout(this._browserType._playwright._defaultContextNavigationTimeout);
|
||||
}
|
||||
contexts() {
|
||||
return [...this._contexts];
|
||||
}
|
||||
version() {
|
||||
return this._initializer.version;
|
||||
}
|
||||
async bind(title, options = {}) {
|
||||
const { endpoint } = await this._channel.startServer({ title, ...options });
|
||||
return { endpoint };
|
||||
}
|
||||
async unbind() {
|
||||
await this._channel.stopServer();
|
||||
}
|
||||
async newPage(options = {}) {
|
||||
return await this._wrapApiCall(async () => {
|
||||
const context = await this.newContext(options);
|
||||
const page = await context.newPage();
|
||||
page._ownedContext = context;
|
||||
context._ownerPage = page;
|
||||
return page;
|
||||
}, { title: "Create page" });
|
||||
}
|
||||
isConnected() {
|
||||
return this._isConnected;
|
||||
}
|
||||
async newBrowserCDPSession() {
|
||||
return import_cdpSession.CDPSession.from((await this._channel.newBrowserCDPSession()).session);
|
||||
}
|
||||
async startTracing(page, options = {}) {
|
||||
this._path = options.path;
|
||||
await this._channel.startTracing({ ...options, page: page ? page._channel : void 0 });
|
||||
}
|
||||
async stopTracing() {
|
||||
const artifact = import_artifact.Artifact.from((await this._channel.stopTracing()).artifact);
|
||||
const buffer = await artifact.readIntoBuffer();
|
||||
await artifact.delete();
|
||||
if (this._path) {
|
||||
await (0, import_fileUtils.mkdirIfNeeded)(this._platform, this._path);
|
||||
await this._platform.fs().promises.writeFile(this._path, buffer);
|
||||
this._path = void 0;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.close();
|
||||
}
|
||||
async close(options = {}) {
|
||||
this._closeReason = options.reason;
|
||||
try {
|
||||
if (this._shouldCloseConnectionOnClose)
|
||||
this._connection.close();
|
||||
else
|
||||
await this._channel.close(options);
|
||||
await this._closedPromise;
|
||||
} catch (e) {
|
||||
if ((0, import_errors.isTargetClosedError)(e))
|
||||
return;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
_didClose() {
|
||||
this._isConnected = false;
|
||||
this.emit(import_events.Events.Browser.Disconnected, this);
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Browser
|
||||
});
|
||||
563
api/ambre-pw-tests/node_modules/playwright-core/lib/client/browserContext.js
generated
vendored
Normal file
563
api/ambre-pw-tests/node_modules/playwright-core/lib/client/browserContext.js
generated
vendored
Normal file
@@ -0,0 +1,563 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var browserContext_exports = {};
|
||||
__export(browserContext_exports, {
|
||||
BrowserContext: () => BrowserContext,
|
||||
prepareBrowserContextParams: () => prepareBrowserContextParams,
|
||||
toClientCertificatesProtocol: () => toClientCertificatesProtocol
|
||||
});
|
||||
module.exports = __toCommonJS(browserContext_exports);
|
||||
var import_artifact = require("./artifact");
|
||||
var import_cdpSession = require("./cdpSession");
|
||||
var import_channelOwner = require("./channelOwner");
|
||||
var import_clientHelper = require("./clientHelper");
|
||||
var import_clock = require("./clock");
|
||||
var import_consoleMessage = require("./consoleMessage");
|
||||
var import_debugger = require("./debugger");
|
||||
var import_dialog = require("./dialog");
|
||||
var import_disposable = require("./disposable");
|
||||
var import_errors = require("./errors");
|
||||
var import_events = require("./events");
|
||||
var import_fetch = require("./fetch");
|
||||
var import_frame = require("./frame");
|
||||
var import_harRouter = require("./harRouter");
|
||||
var network = __toESM(require("./network"));
|
||||
var import_page = require("./page");
|
||||
var import_tracing = require("./tracing");
|
||||
var import_waiter = require("./waiter");
|
||||
var import_webError = require("./webError");
|
||||
var import_worker = require("./worker");
|
||||
var import_timeoutSettings = require("./timeoutSettings");
|
||||
var import_fileUtils = require("./fileUtils");
|
||||
var import_headers = require("../utils/isomorphic/headers");
|
||||
var import_urlMatch = require("../utils/isomorphic/urlMatch");
|
||||
var import_rtti = require("../utils/isomorphic/rtti");
|
||||
var import_stackTrace = require("../utils/isomorphic/stackTrace");
|
||||
class BrowserContext extends import_channelOwner.ChannelOwner {
|
||||
constructor(parent, type, guid, initializer) {
|
||||
super(parent, type, guid, initializer);
|
||||
this._pages = /* @__PURE__ */ new Set();
|
||||
this._routes = [];
|
||||
this._webSocketRoutes = [];
|
||||
// Browser is null for browser contexts created outside of normal browser, e.g. android or electron.
|
||||
this._browser = null;
|
||||
this._bindings = /* @__PURE__ */ new Map();
|
||||
this._forReuse = false;
|
||||
this._serviceWorkers = /* @__PURE__ */ new Set();
|
||||
this._harRecorders = /* @__PURE__ */ new Map();
|
||||
this._closingStatus = "none";
|
||||
this._harRouters = [];
|
||||
this._options = initializer.options;
|
||||
this._timeoutSettings = new import_timeoutSettings.TimeoutSettings(this._platform);
|
||||
this.debugger = import_debugger.Debugger.from(initializer.debugger);
|
||||
this.tracing = import_tracing.Tracing.from(initializer.tracing);
|
||||
this.request = import_fetch.APIRequestContext.from(initializer.requestContext);
|
||||
this.request._timeoutSettings = this._timeoutSettings;
|
||||
this.clock = new import_clock.Clock(this);
|
||||
this._channel.on("bindingCall", ({ binding }) => this._onBinding(import_page.BindingCall.from(binding)));
|
||||
this._channel.on("close", () => this._onClose());
|
||||
this._channel.on("page", ({ page }) => this._onPage(import_page.Page.from(page)));
|
||||
this._channel.on("route", ({ route }) => this._onRoute(network.Route.from(route)));
|
||||
this._channel.on("webSocketRoute", ({ webSocketRoute }) => this._onWebSocketRoute(network.WebSocketRoute.from(webSocketRoute)));
|
||||
this._channel.on("serviceWorker", ({ worker }) => {
|
||||
const serviceWorker = import_worker.Worker.from(worker);
|
||||
serviceWorker._context = this;
|
||||
this._serviceWorkers.add(serviceWorker);
|
||||
this.emit(import_events.Events.BrowserContext.ServiceWorker, serviceWorker);
|
||||
});
|
||||
this._channel.on("console", (event) => {
|
||||
const worker = import_worker.Worker.fromNullable(event.worker);
|
||||
const page = import_page.Page.fromNullable(event.page);
|
||||
const consoleMessage = new import_consoleMessage.ConsoleMessage(this._platform, event, page, worker);
|
||||
worker?.emit(import_events.Events.Worker.Console, consoleMessage);
|
||||
page?.emit(import_events.Events.Page.Console, consoleMessage);
|
||||
if (worker && this._serviceWorkers.has(worker)) {
|
||||
const scope = this._serviceWorkerScope(worker);
|
||||
for (const page2 of this._pages) {
|
||||
if (scope && page2.url().startsWith(scope))
|
||||
page2.emit(import_events.Events.Page.Console, consoleMessage);
|
||||
}
|
||||
}
|
||||
this.emit(import_events.Events.BrowserContext.Console, consoleMessage);
|
||||
});
|
||||
this._channel.on("pageError", ({ error, page }) => {
|
||||
const pageObject = import_page.Page.from(page);
|
||||
const parsedError = (0, import_errors.parseError)(error);
|
||||
this.emit(import_events.Events.BrowserContext.WebError, new import_webError.WebError(pageObject, parsedError));
|
||||
if (pageObject)
|
||||
pageObject.emit(import_events.Events.Page.PageError, parsedError);
|
||||
});
|
||||
this._channel.on("dialog", ({ dialog }) => {
|
||||
const dialogObject = import_dialog.Dialog.from(dialog);
|
||||
let hasListeners = this.emit(import_events.Events.BrowserContext.Dialog, dialogObject);
|
||||
const page = dialogObject.page();
|
||||
if (page)
|
||||
hasListeners = page.emit(import_events.Events.Page.Dialog, dialogObject) || hasListeners;
|
||||
if (!hasListeners) {
|
||||
if (dialogObject.type() === "beforeunload")
|
||||
dialog.accept({}).catch(() => {
|
||||
});
|
||||
else
|
||||
dialog.dismiss().catch(() => {
|
||||
});
|
||||
}
|
||||
});
|
||||
this._channel.on("request", ({ request, page }) => this._onRequest(network.Request.from(request), import_page.Page.fromNullable(page)));
|
||||
this._channel.on("requestFailed", ({ request, failureText, responseEndTiming, page }) => this._onRequestFailed(network.Request.from(request), responseEndTiming, failureText, import_page.Page.fromNullable(page)));
|
||||
this._channel.on("requestFinished", (params) => this._onRequestFinished(params));
|
||||
this._channel.on("response", ({ response, page }) => this._onResponse(network.Response.from(response), import_page.Page.fromNullable(page)));
|
||||
this._channel.on("recorderEvent", ({ event, data, page, code }) => {
|
||||
if (event === "actionAdded")
|
||||
this._onRecorderEventSink?.actionAdded?.(import_page.Page.from(page), data, code);
|
||||
else if (event === "actionUpdated")
|
||||
this._onRecorderEventSink?.actionUpdated?.(import_page.Page.from(page), data, code);
|
||||
else if (event === "signalAdded")
|
||||
this._onRecorderEventSink?.signalAdded?.(import_page.Page.from(page), data);
|
||||
});
|
||||
this._closedPromise = new Promise((f) => this.once(import_events.Events.BrowserContext.Close, f));
|
||||
this._setEventToSubscriptionMapping(/* @__PURE__ */ new Map([
|
||||
[import_events.Events.BrowserContext.Console, "console"],
|
||||
[import_events.Events.BrowserContext.Dialog, "dialog"],
|
||||
[import_events.Events.BrowserContext.Request, "request"],
|
||||
[import_events.Events.BrowserContext.Response, "response"],
|
||||
[import_events.Events.BrowserContext.RequestFinished, "requestFinished"],
|
||||
[import_events.Events.BrowserContext.RequestFailed, "requestFailed"]
|
||||
]));
|
||||
}
|
||||
static from(context) {
|
||||
return context._object;
|
||||
}
|
||||
static fromNullable(context) {
|
||||
return context ? BrowserContext.from(context) : null;
|
||||
}
|
||||
async _initializeHarFromOptions(recordHar) {
|
||||
if (!recordHar)
|
||||
return;
|
||||
const defaultContent = recordHar.path.endsWith(".zip") ? "attach" : "embed";
|
||||
await this._recordIntoHAR(recordHar.path, null, {
|
||||
url: recordHar.urlFilter,
|
||||
updateContent: recordHar.content ?? (recordHar.omitContent ? "omit" : defaultContent),
|
||||
updateMode: recordHar.mode ?? "full"
|
||||
});
|
||||
}
|
||||
_onPage(page) {
|
||||
this._pages.add(page);
|
||||
this.emit(import_events.Events.BrowserContext.Page, page);
|
||||
if (page._opener && !page._opener.isClosed())
|
||||
page._opener.emit(import_events.Events.Page.Popup, page);
|
||||
}
|
||||
_onRequest(request, page) {
|
||||
this.emit(import_events.Events.BrowserContext.Request, request);
|
||||
if (page)
|
||||
page.emit(import_events.Events.Page.Request, request);
|
||||
}
|
||||
_onResponse(response, page) {
|
||||
this.emit(import_events.Events.BrowserContext.Response, response);
|
||||
if (page)
|
||||
page.emit(import_events.Events.Page.Response, response);
|
||||
}
|
||||
_onRequestFailed(request, responseEndTiming, failureText, page) {
|
||||
request._failureText = failureText || null;
|
||||
request._setResponseEndTiming(responseEndTiming);
|
||||
this.emit(import_events.Events.BrowserContext.RequestFailed, request);
|
||||
if (page)
|
||||
page.emit(import_events.Events.Page.RequestFailed, request);
|
||||
}
|
||||
_onRequestFinished(params) {
|
||||
const { responseEndTiming } = params;
|
||||
const request = network.Request.from(params.request);
|
||||
const response = network.Response.fromNullable(params.response);
|
||||
const page = import_page.Page.fromNullable(params.page);
|
||||
request._setResponseEndTiming(responseEndTiming);
|
||||
this.emit(import_events.Events.BrowserContext.RequestFinished, request);
|
||||
if (page)
|
||||
page.emit(import_events.Events.Page.RequestFinished, request);
|
||||
if (response)
|
||||
response._finishedPromise.resolve(null);
|
||||
}
|
||||
async _onRoute(route) {
|
||||
route._context = this;
|
||||
const page = route.request()._safePage();
|
||||
const routeHandlers = this._routes.slice();
|
||||
for (const routeHandler of routeHandlers) {
|
||||
if (page?._closeWasCalled || this.isClosed())
|
||||
return;
|
||||
if (!routeHandler.matches(route.request().url()))
|
||||
continue;
|
||||
const index = this._routes.indexOf(routeHandler);
|
||||
if (index === -1)
|
||||
continue;
|
||||
if (routeHandler.willExpire())
|
||||
this._routes.splice(index, 1);
|
||||
const handled = await routeHandler.handle(route);
|
||||
if (!this._routes.length)
|
||||
this._updateInterceptionPatterns({ internal: true }).catch(() => {
|
||||
});
|
||||
if (handled)
|
||||
return;
|
||||
}
|
||||
await route._innerContinue(
|
||||
true
|
||||
/* isFallback */
|
||||
).catch(() => {
|
||||
});
|
||||
}
|
||||
async _onWebSocketRoute(webSocketRoute) {
|
||||
const routeHandler = this._webSocketRoutes.find((route) => route.matches(webSocketRoute.url()));
|
||||
if (routeHandler)
|
||||
await routeHandler.handle(webSocketRoute);
|
||||
else
|
||||
webSocketRoute.connectToServer();
|
||||
}
|
||||
async _onBinding(bindingCall) {
|
||||
const func = this._bindings.get(bindingCall._initializer.name);
|
||||
if (!func)
|
||||
return;
|
||||
await bindingCall.call(func);
|
||||
}
|
||||
_serviceWorkerScope(serviceWorker) {
|
||||
try {
|
||||
let url = new URL(".", serviceWorker.url()).href;
|
||||
if (!url.endsWith("/"))
|
||||
url += "/";
|
||||
return url;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
setDefaultNavigationTimeout(timeout) {
|
||||
this._timeoutSettings.setDefaultNavigationTimeout(timeout);
|
||||
}
|
||||
setDefaultTimeout(timeout) {
|
||||
this._timeoutSettings.setDefaultTimeout(timeout);
|
||||
}
|
||||
browser() {
|
||||
return this._browser;
|
||||
}
|
||||
pages() {
|
||||
return [...this._pages];
|
||||
}
|
||||
isClosed() {
|
||||
return this._closingStatus !== "none";
|
||||
}
|
||||
async newPage() {
|
||||
if (this._ownerPage)
|
||||
throw new Error("Please use browser.newContext()");
|
||||
return import_page.Page.from((await this._channel.newPage()).page);
|
||||
}
|
||||
async cookies(urls) {
|
||||
if (!urls)
|
||||
urls = [];
|
||||
if (urls && typeof urls === "string")
|
||||
urls = [urls];
|
||||
return (await this._channel.cookies({ urls })).cookies;
|
||||
}
|
||||
async addCookies(cookies) {
|
||||
await this._channel.addCookies({ cookies });
|
||||
}
|
||||
async clearCookies(options = {}) {
|
||||
await this._channel.clearCookies({
|
||||
name: (0, import_rtti.isString)(options.name) ? options.name : void 0,
|
||||
nameRegexSource: (0, import_rtti.isRegExp)(options.name) ? options.name.source : void 0,
|
||||
nameRegexFlags: (0, import_rtti.isRegExp)(options.name) ? options.name.flags : void 0,
|
||||
domain: (0, import_rtti.isString)(options.domain) ? options.domain : void 0,
|
||||
domainRegexSource: (0, import_rtti.isRegExp)(options.domain) ? options.domain.source : void 0,
|
||||
domainRegexFlags: (0, import_rtti.isRegExp)(options.domain) ? options.domain.flags : void 0,
|
||||
path: (0, import_rtti.isString)(options.path) ? options.path : void 0,
|
||||
pathRegexSource: (0, import_rtti.isRegExp)(options.path) ? options.path.source : void 0,
|
||||
pathRegexFlags: (0, import_rtti.isRegExp)(options.path) ? options.path.flags : void 0
|
||||
});
|
||||
}
|
||||
async grantPermissions(permissions, options) {
|
||||
await this._channel.grantPermissions({ permissions, ...options });
|
||||
}
|
||||
async clearPermissions() {
|
||||
await this._channel.clearPermissions();
|
||||
}
|
||||
async setGeolocation(geolocation) {
|
||||
await this._channel.setGeolocation({ geolocation: geolocation || void 0 });
|
||||
}
|
||||
async setExtraHTTPHeaders(headers) {
|
||||
network.validateHeaders(headers);
|
||||
await this._channel.setExtraHTTPHeaders({ headers: (0, import_headers.headersObjectToArray)(headers) });
|
||||
}
|
||||
async setOffline(offline) {
|
||||
await this._channel.setOffline({ offline });
|
||||
}
|
||||
async setHTTPCredentials(httpCredentials) {
|
||||
await this._channel.setHTTPCredentials({ httpCredentials: httpCredentials || void 0 });
|
||||
}
|
||||
async addInitScript(script, arg) {
|
||||
const source = await (0, import_clientHelper.evaluationScript)(this._platform, script, arg);
|
||||
return import_disposable.DisposableObject.from((await this._channel.addInitScript({ source })).disposable);
|
||||
}
|
||||
async exposeBinding(name, callback, options = {}) {
|
||||
const result = await this._channel.exposeBinding({ name, needsHandle: options.handle });
|
||||
this._bindings.set(name, callback);
|
||||
return import_disposable.DisposableObject.from(result.disposable);
|
||||
}
|
||||
async exposeFunction(name, callback) {
|
||||
const result = await this._channel.exposeBinding({ name });
|
||||
const binding = (source, ...args) => callback(...args);
|
||||
this._bindings.set(name, binding);
|
||||
return import_disposable.DisposableObject.from(result.disposable);
|
||||
}
|
||||
async route(url, handler, options = {}) {
|
||||
this._routes.unshift(new network.RouteHandler(this._platform, this._options.baseURL, url, handler, options.times));
|
||||
await this._updateInterceptionPatterns({ title: "Route requests" });
|
||||
return new import_disposable.DisposableStub(() => this.unroute(url, handler));
|
||||
}
|
||||
async routeWebSocket(url, handler) {
|
||||
this._webSocketRoutes.unshift(new network.WebSocketRouteHandler(this._options.baseURL, url, handler));
|
||||
await this._updateWebSocketInterceptionPatterns({ title: "Route WebSockets" });
|
||||
}
|
||||
async _recordIntoHAR(har, page, options = {}) {
|
||||
const { harId } = await this._channel.harStart({
|
||||
page: page?._channel,
|
||||
options: {
|
||||
zip: har.endsWith(".zip"),
|
||||
content: options.updateContent ?? "attach",
|
||||
urlGlob: (0, import_rtti.isString)(options.url) ? options.url : void 0,
|
||||
urlRegexSource: (0, import_rtti.isRegExp)(options.url) ? options.url.source : void 0,
|
||||
urlRegexFlags: (0, import_rtti.isRegExp)(options.url) ? options.url.flags : void 0,
|
||||
mode: options.updateMode ?? "minimal"
|
||||
}
|
||||
});
|
||||
this._harRecorders.set(harId, { path: har, content: options.updateContent ?? "attach" });
|
||||
}
|
||||
async routeFromHAR(har, options = {}) {
|
||||
const localUtils = this._connection.localUtils();
|
||||
if (!localUtils)
|
||||
throw new Error("Route from har is not supported in thin clients");
|
||||
if (options.update) {
|
||||
await this._recordIntoHAR(har, null, options);
|
||||
return;
|
||||
}
|
||||
const harRouter = await import_harRouter.HarRouter.create(localUtils, har, options.notFound || "abort", { urlMatch: options.url });
|
||||
this._harRouters.push(harRouter);
|
||||
await harRouter.addContextRoute(this);
|
||||
}
|
||||
_disposeHarRouters() {
|
||||
this._harRouters.forEach((router) => router.dispose());
|
||||
this._harRouters = [];
|
||||
}
|
||||
async unrouteAll(options) {
|
||||
await this._unrouteInternal(this._routes, [], options?.behavior);
|
||||
this._disposeHarRouters();
|
||||
}
|
||||
async unroute(url, handler) {
|
||||
const removed = [];
|
||||
const remaining = [];
|
||||
for (const route of this._routes) {
|
||||
if ((0, import_urlMatch.urlMatchesEqual)(route.url, url) && (!handler || route.handler === handler))
|
||||
removed.push(route);
|
||||
else
|
||||
remaining.push(route);
|
||||
}
|
||||
await this._unrouteInternal(removed, remaining, "default");
|
||||
}
|
||||
async _unrouteInternal(removed, remaining, behavior) {
|
||||
this._routes = remaining;
|
||||
if (behavior && behavior !== "default") {
|
||||
const promises = removed.map((routeHandler) => routeHandler.stop(behavior));
|
||||
await Promise.all(promises);
|
||||
}
|
||||
await this._updateInterceptionPatterns({ title: "Unroute requests" });
|
||||
}
|
||||
async _updateInterceptionPatterns(options) {
|
||||
const patterns = network.RouteHandler.prepareInterceptionPatterns(this._routes);
|
||||
await this._wrapApiCall(() => this._channel.setNetworkInterceptionPatterns({ patterns }), options);
|
||||
}
|
||||
async _updateWebSocketInterceptionPatterns(options) {
|
||||
const patterns = network.WebSocketRouteHandler.prepareInterceptionPatterns(this._webSocketRoutes);
|
||||
await this._wrapApiCall(() => this._channel.setWebSocketInterceptionPatterns({ patterns }), options);
|
||||
}
|
||||
_effectiveCloseReason() {
|
||||
return this._closeReason || this._browser?._closeReason;
|
||||
}
|
||||
async waitForEvent(event, optionsOrPredicate = {}) {
|
||||
return await this._wrapApiCall(async () => {
|
||||
const timeout = this._timeoutSettings.timeout(typeof optionsOrPredicate === "function" ? {} : optionsOrPredicate);
|
||||
const predicate = typeof optionsOrPredicate === "function" ? optionsOrPredicate : optionsOrPredicate.predicate;
|
||||
const waiter = import_waiter.Waiter.createForEvent(this, event);
|
||||
waiter.rejectOnTimeout(timeout, `Timeout ${timeout}ms exceeded while waiting for event "${event}"`);
|
||||
if (event !== import_events.Events.BrowserContext.Close)
|
||||
waiter.rejectOnEvent(this, import_events.Events.BrowserContext.Close, () => new import_errors.TargetClosedError(this._effectiveCloseReason()));
|
||||
const result = await waiter.waitForEvent(this, event, predicate);
|
||||
waiter.dispose();
|
||||
return result;
|
||||
});
|
||||
}
|
||||
async storageState(options = {}) {
|
||||
const state = await this._channel.storageState({ indexedDB: options.indexedDB });
|
||||
if (options.path) {
|
||||
await (0, import_fileUtils.mkdirIfNeeded)(this._platform, options.path);
|
||||
await this._platform.fs().promises.writeFile(options.path, JSON.stringify(state, void 0, 2), "utf8");
|
||||
}
|
||||
return state;
|
||||
}
|
||||
async setStorageState(storageState) {
|
||||
const state = await prepareStorageState(this._platform, storageState);
|
||||
await this._channel.setStorageState({ storageState: state });
|
||||
}
|
||||
backgroundPages() {
|
||||
return [];
|
||||
}
|
||||
serviceWorkers() {
|
||||
return [...this._serviceWorkers];
|
||||
}
|
||||
async newCDPSession(page) {
|
||||
if (!(page instanceof import_page.Page) && !(page instanceof import_frame.Frame))
|
||||
throw new Error("page: expected Page or Frame");
|
||||
const result = await this._channel.newCDPSession(page instanceof import_page.Page ? { page: page._channel } : { frame: page._channel });
|
||||
return import_cdpSession.CDPSession.from(result.session);
|
||||
}
|
||||
_onClose() {
|
||||
this._closingStatus = "closed";
|
||||
this._browser?._contexts.delete(this);
|
||||
this._browser?._browserType._contexts.delete(this);
|
||||
this._browser?._browserType._playwright.selectors._contextsForSelectors.delete(this);
|
||||
this._disposeHarRouters();
|
||||
this.tracing._resetStackCounter();
|
||||
this.emit(import_events.Events.BrowserContext.Close, this);
|
||||
}
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.close();
|
||||
}
|
||||
async close(options = {}) {
|
||||
if (this.isClosed())
|
||||
return;
|
||||
this._closeReason = options.reason;
|
||||
this._closingStatus = "closing";
|
||||
await this.request.dispose(options);
|
||||
await this._instrumentation.runBeforeCloseBrowserContext(this);
|
||||
await this._wrapApiCall(async () => {
|
||||
for (const [harId, harParams] of this._harRecorders) {
|
||||
const har = await this._channel.harExport({ harId });
|
||||
const artifact = import_artifact.Artifact.from(har.artifact);
|
||||
const isCompressed = harParams.content === "attach" || harParams.path.endsWith(".zip");
|
||||
const needCompressed = harParams.path.endsWith(".zip");
|
||||
if (isCompressed && !needCompressed) {
|
||||
const localUtils = this._connection.localUtils();
|
||||
if (!localUtils)
|
||||
throw new Error("Uncompressed har is not supported in thin clients");
|
||||
await artifact.saveAs(harParams.path + ".tmp");
|
||||
await localUtils.harUnzip({ zipFile: harParams.path + ".tmp", harFile: harParams.path });
|
||||
} else {
|
||||
await artifact.saveAs(harParams.path);
|
||||
}
|
||||
await artifact.delete();
|
||||
}
|
||||
}, { internal: true });
|
||||
await this._channel.close(options);
|
||||
await this._closedPromise;
|
||||
}
|
||||
async _enableRecorder(params, eventSink) {
|
||||
if (eventSink)
|
||||
this._onRecorderEventSink = eventSink;
|
||||
await this._channel.enableRecorder(params);
|
||||
}
|
||||
async _disableRecorder() {
|
||||
this._onRecorderEventSink = void 0;
|
||||
await this._channel.disableRecorder();
|
||||
}
|
||||
async _exposeConsoleApi() {
|
||||
await this._channel.exposeConsoleApi();
|
||||
}
|
||||
}
|
||||
async function prepareStorageState(platform, storageState) {
|
||||
if (typeof storageState !== "string")
|
||||
return storageState;
|
||||
try {
|
||||
return JSON.parse(await platform.fs().promises.readFile(storageState, "utf8"));
|
||||
} catch (e) {
|
||||
(0, import_stackTrace.rewriteErrorMessage)(e, `Error reading storage state from ${storageState}:
|
||||
` + e.message);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
async function prepareBrowserContextParams(platform, options) {
|
||||
if (options.videoSize && !options.videosPath)
|
||||
throw new Error(`"videoSize" option requires "videosPath" to be specified`);
|
||||
if (options.extraHTTPHeaders)
|
||||
network.validateHeaders(options.extraHTTPHeaders);
|
||||
const contextParams = {
|
||||
...options,
|
||||
viewport: options.viewport === null ? void 0 : options.viewport,
|
||||
noDefaultViewport: options.viewport === null,
|
||||
extraHTTPHeaders: options.extraHTTPHeaders ? (0, import_headers.headersObjectToArray)(options.extraHTTPHeaders) : void 0,
|
||||
storageState: options.storageState ? await prepareStorageState(platform, options.storageState) : void 0,
|
||||
serviceWorkers: options.serviceWorkers,
|
||||
colorScheme: options.colorScheme === null ? "no-override" : options.colorScheme,
|
||||
reducedMotion: options.reducedMotion === null ? "no-override" : options.reducedMotion,
|
||||
forcedColors: options.forcedColors === null ? "no-override" : options.forcedColors,
|
||||
contrast: options.contrast === null ? "no-override" : options.contrast,
|
||||
acceptDownloads: toAcceptDownloadsProtocol(options.acceptDownloads),
|
||||
clientCertificates: await toClientCertificatesProtocol(platform, options.clientCertificates)
|
||||
};
|
||||
if (!contextParams.recordVideo && options.videosPath) {
|
||||
contextParams.recordVideo = {
|
||||
dir: options.videosPath,
|
||||
size: options.videoSize
|
||||
};
|
||||
}
|
||||
if (contextParams.recordVideo && contextParams.recordVideo.dir)
|
||||
contextParams.recordVideo.dir = platform.path().resolve(contextParams.recordVideo.dir);
|
||||
return contextParams;
|
||||
}
|
||||
function toAcceptDownloadsProtocol(acceptDownloads) {
|
||||
if (acceptDownloads === void 0)
|
||||
return void 0;
|
||||
if (acceptDownloads)
|
||||
return "accept";
|
||||
return "deny";
|
||||
}
|
||||
async function toClientCertificatesProtocol(platform, certs) {
|
||||
if (!certs)
|
||||
return void 0;
|
||||
const bufferizeContent = async (value, path) => {
|
||||
if (value)
|
||||
return value;
|
||||
if (path)
|
||||
return await platform.fs().promises.readFile(path);
|
||||
};
|
||||
return await Promise.all(certs.map(async (cert) => ({
|
||||
origin: cert.origin,
|
||||
cert: await bufferizeContent(cert.cert, cert.certPath),
|
||||
key: await bufferizeContent(cert.key, cert.keyPath),
|
||||
pfx: await bufferizeContent(cert.pfx, cert.pfxPath),
|
||||
passphrase: cert.passphrase
|
||||
})));
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
BrowserContext,
|
||||
prepareBrowserContextParams,
|
||||
toClientCertificatesProtocol
|
||||
});
|
||||
153
api/ambre-pw-tests/node_modules/playwright-core/lib/client/browserType.js
generated
vendored
Normal file
153
api/ambre-pw-tests/node_modules/playwright-core/lib/client/browserType.js
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var browserType_exports = {};
|
||||
__export(browserType_exports, {
|
||||
BrowserType: () => BrowserType
|
||||
});
|
||||
module.exports = __toCommonJS(browserType_exports);
|
||||
var import_browser = require("./browser");
|
||||
var import_browserContext = require("./browserContext");
|
||||
var import_channelOwner = require("./channelOwner");
|
||||
var import_clientHelper = require("./clientHelper");
|
||||
var import_assert = require("../utils/isomorphic/assert");
|
||||
var import_headers = require("../utils/isomorphic/headers");
|
||||
var import_connect = require("./connect");
|
||||
var import_timeoutSettings = require("./timeoutSettings");
|
||||
class BrowserType extends import_channelOwner.ChannelOwner {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._contexts = /* @__PURE__ */ new Set();
|
||||
}
|
||||
static from(browserType) {
|
||||
return browserType._object;
|
||||
}
|
||||
executablePath() {
|
||||
if (!this._initializer.executablePath)
|
||||
throw new Error("Browser is not supported on current platform");
|
||||
return this._initializer.executablePath;
|
||||
}
|
||||
name() {
|
||||
return this._initializer.name;
|
||||
}
|
||||
async launch(options = {}) {
|
||||
(0, import_assert.assert)(!options.userDataDir, "userDataDir option is not supported in `browserType.launch`. Use `browserType.launchPersistentContext` instead");
|
||||
(0, import_assert.assert)(!options.port, "Cannot specify a port without launching as a server.");
|
||||
const logger = options.logger || this._playwright._defaultLaunchOptions?.logger;
|
||||
options = { ...this._playwright._defaultLaunchOptions, ...options };
|
||||
const launchOptions = {
|
||||
...options,
|
||||
ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : void 0,
|
||||
ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs),
|
||||
env: options.env ? (0, import_clientHelper.envObjectToArray)(options.env) : void 0,
|
||||
timeout: new import_timeoutSettings.TimeoutSettings(this._platform).launchTimeout(options)
|
||||
};
|
||||
return await this._wrapApiCall(async () => {
|
||||
const browser = import_browser.Browser.from((await this._channel.launch(launchOptions)).browser);
|
||||
browser._connectToBrowserType(this, options, logger);
|
||||
return browser;
|
||||
});
|
||||
}
|
||||
async launchServer(options = {}) {
|
||||
if (!this._serverLauncher)
|
||||
throw new Error("Launching server is not supported");
|
||||
options = { ...this._playwright._defaultLaunchOptions, ...options };
|
||||
return await this._serverLauncher.launchServer(options);
|
||||
}
|
||||
async launchPersistentContext(userDataDir, options = {}) {
|
||||
(0, import_assert.assert)(!options.port, "Cannot specify a port without launching as a server.");
|
||||
options = this._playwright.selectors._withSelectorOptions({
|
||||
...this._playwright._defaultLaunchOptions,
|
||||
...options
|
||||
});
|
||||
await this._instrumentation.runBeforeCreateBrowserContext(options);
|
||||
const logger = options.logger || this._playwright._defaultLaunchOptions?.logger;
|
||||
const contextParams = await (0, import_browserContext.prepareBrowserContextParams)(this._platform, options);
|
||||
const persistentParams = {
|
||||
...contextParams,
|
||||
ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : void 0,
|
||||
ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs),
|
||||
env: options.env ? (0, import_clientHelper.envObjectToArray)(options.env) : void 0,
|
||||
channel: options.channel,
|
||||
userDataDir: this._platform.path().isAbsolute(userDataDir) || !userDataDir ? userDataDir : this._platform.path().resolve(userDataDir),
|
||||
timeout: new import_timeoutSettings.TimeoutSettings(this._platform).launchTimeout(options)
|
||||
};
|
||||
const context = await this._wrapApiCall(async () => {
|
||||
const result = await this._channel.launchPersistentContext(persistentParams);
|
||||
const browser = import_browser.Browser.from(result.browser);
|
||||
browser._connectToBrowserType(this, options, logger);
|
||||
const context2 = import_browserContext.BrowserContext.from(result.context);
|
||||
await context2._initializeHarFromOptions(options.recordHar);
|
||||
return context2;
|
||||
});
|
||||
await this._instrumentation.runAfterCreateBrowserContext(context);
|
||||
return context;
|
||||
}
|
||||
async connect(optionsOrEndpoint, options) {
|
||||
if (typeof optionsOrEndpoint === "string")
|
||||
return await this._connect({ ...options, endpoint: optionsOrEndpoint });
|
||||
(0, import_assert.assert)(optionsOrEndpoint.wsEndpoint, "options.wsEndpoint is required");
|
||||
return await this._connect({ ...options, endpoint: optionsOrEndpoint.wsEndpoint });
|
||||
}
|
||||
async _connect(params) {
|
||||
const logger = params.logger;
|
||||
return await this._wrapApiCall(async () => {
|
||||
const browser = await (0, import_connect.connectToBrowser)(this._playwright, { browserName: this.name(), ...params });
|
||||
browser._connectToBrowserType(this, {}, logger);
|
||||
return browser;
|
||||
});
|
||||
}
|
||||
async connectOverCDP(endpointURLOrOptions, options) {
|
||||
if (typeof endpointURLOrOptions === "string")
|
||||
return await this._connectOverCDP(endpointURLOrOptions, options);
|
||||
const endpointURL = "endpointURL" in endpointURLOrOptions ? endpointURLOrOptions.endpointURL : endpointURLOrOptions.wsEndpoint;
|
||||
(0, import_assert.assert)(endpointURL, "Cannot connect over CDP without wsEndpoint.");
|
||||
return await this.connectOverCDP(endpointURL, endpointURLOrOptions);
|
||||
}
|
||||
async _connectOverCDP(endpointURL, params = {}) {
|
||||
if (this.name() !== "chromium")
|
||||
throw new Error("Connecting over CDP is only supported in Chromium.");
|
||||
const headers = params.headers ? (0, import_headers.headersObjectToArray)(params.headers) : void 0;
|
||||
const result = await this._channel.connectOverCDP({
|
||||
endpointURL,
|
||||
headers,
|
||||
slowMo: params.slowMo,
|
||||
timeout: new import_timeoutSettings.TimeoutSettings(this._platform).timeout(params),
|
||||
isLocal: params.isLocal
|
||||
});
|
||||
const browser = import_browser.Browser.from(result.browser);
|
||||
browser._connectToBrowserType(this, {}, params.logger);
|
||||
if (result.defaultContext)
|
||||
await this._instrumentation.runAfterCreateBrowserContext(import_browserContext.BrowserContext.from(result.defaultContext));
|
||||
return browser;
|
||||
}
|
||||
async _connectOverCDPTransport(transport) {
|
||||
if (this.name() !== "chromium")
|
||||
throw new Error("Connecting over CDP is only supported in Chromium.");
|
||||
const result = await this._channel.connectOverCDPTransport({ transport });
|
||||
const browser = import_browser.Browser.from(result.browser);
|
||||
browser._connectToBrowserType(this, {}, void 0);
|
||||
if (result.defaultContext)
|
||||
await this._instrumentation.runAfterCreateBrowserContext(import_browserContext.BrowserContext.from(result.defaultContext));
|
||||
return browser;
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
BrowserType
|
||||
});
|
||||
55
api/ambre-pw-tests/node_modules/playwright-core/lib/client/cdpSession.js
generated
vendored
Normal file
55
api/ambre-pw-tests/node_modules/playwright-core/lib/client/cdpSession.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var cdpSession_exports = {};
|
||||
__export(cdpSession_exports, {
|
||||
CDPSession: () => CDPSession
|
||||
});
|
||||
module.exports = __toCommonJS(cdpSession_exports);
|
||||
var import_channelOwner = require("./channelOwner");
|
||||
class CDPSession extends import_channelOwner.ChannelOwner {
|
||||
static from(cdpSession) {
|
||||
return cdpSession._object;
|
||||
}
|
||||
constructor(parent, type, guid, initializer) {
|
||||
super(parent, type, guid, initializer);
|
||||
this._channel.on("event", (event) => {
|
||||
this.emit(event.method, event.params);
|
||||
this.emit("event", event);
|
||||
});
|
||||
this._channel.on("close", () => {
|
||||
this.emit("close", this);
|
||||
});
|
||||
this.on = super.on;
|
||||
this.addListener = super.addListener;
|
||||
this.off = super.removeListener;
|
||||
this.removeListener = super.removeListener;
|
||||
this.once = super.once;
|
||||
}
|
||||
async send(method, params) {
|
||||
const result = await this._channel.send({ method, params });
|
||||
return result.result;
|
||||
}
|
||||
async detach() {
|
||||
return await this._channel.detach();
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
CDPSession
|
||||
});
|
||||
194
api/ambre-pw-tests/node_modules/playwright-core/lib/client/channelOwner.js
generated
vendored
Normal file
194
api/ambre-pw-tests/node_modules/playwright-core/lib/client/channelOwner.js
generated
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var channelOwner_exports = {};
|
||||
__export(channelOwner_exports, {
|
||||
ChannelOwner: () => ChannelOwner
|
||||
});
|
||||
module.exports = __toCommonJS(channelOwner_exports);
|
||||
var import_eventEmitter = require("./eventEmitter");
|
||||
var import_validator = require("../protocol/validator");
|
||||
var import_protocolMetainfo = require("../utils/isomorphic/protocolMetainfo");
|
||||
var import_clientStackTrace = require("./clientStackTrace");
|
||||
var import_stackTrace = require("../utils/isomorphic/stackTrace");
|
||||
class ChannelOwner extends import_eventEmitter.EventEmitter {
|
||||
constructor(parent, type, guid, initializer) {
|
||||
const connection = parent instanceof ChannelOwner ? parent._connection : parent;
|
||||
super(connection._platform);
|
||||
this._objects = /* @__PURE__ */ new Map();
|
||||
this._eventToSubscriptionMapping = /* @__PURE__ */ new Map();
|
||||
this._wasCollected = false;
|
||||
this.setMaxListeners(0);
|
||||
this._connection = connection;
|
||||
this._type = type;
|
||||
this._guid = guid;
|
||||
this._parent = parent instanceof ChannelOwner ? parent : void 0;
|
||||
this._instrumentation = this._connection._instrumentation;
|
||||
this._connection._objects.set(guid, this);
|
||||
if (this._parent) {
|
||||
this._parent._objects.set(guid, this);
|
||||
this._logger = this._parent._logger;
|
||||
}
|
||||
this._channel = this._createChannel(new import_eventEmitter.EventEmitter(connection._platform));
|
||||
this._initializer = initializer;
|
||||
}
|
||||
_setEventToSubscriptionMapping(mapping) {
|
||||
this._eventToSubscriptionMapping = mapping;
|
||||
}
|
||||
_updateSubscription(event, enabled) {
|
||||
const protocolEvent = this._eventToSubscriptionMapping.get(String(event));
|
||||
if (protocolEvent)
|
||||
this._channel.updateSubscription({ event: protocolEvent, enabled }).catch(() => {
|
||||
});
|
||||
}
|
||||
on(event, listener) {
|
||||
if (!this.listenerCount(event))
|
||||
this._updateSubscription(event, true);
|
||||
super.on(event, listener);
|
||||
return this;
|
||||
}
|
||||
addListener(event, listener) {
|
||||
if (!this.listenerCount(event))
|
||||
this._updateSubscription(event, true);
|
||||
super.addListener(event, listener);
|
||||
return this;
|
||||
}
|
||||
prependListener(event, listener) {
|
||||
if (!this.listenerCount(event))
|
||||
this._updateSubscription(event, true);
|
||||
super.prependListener(event, listener);
|
||||
return this;
|
||||
}
|
||||
off(event, listener) {
|
||||
super.off(event, listener);
|
||||
if (!this.listenerCount(event))
|
||||
this._updateSubscription(event, false);
|
||||
return this;
|
||||
}
|
||||
removeListener(event, listener) {
|
||||
super.removeListener(event, listener);
|
||||
if (!this.listenerCount(event))
|
||||
this._updateSubscription(event, false);
|
||||
return this;
|
||||
}
|
||||
_adopt(child) {
|
||||
child._parent._objects.delete(child._guid);
|
||||
this._objects.set(child._guid, child);
|
||||
child._parent = this;
|
||||
}
|
||||
_dispose(reason) {
|
||||
if (this._parent)
|
||||
this._parent._objects.delete(this._guid);
|
||||
this._connection._objects.delete(this._guid);
|
||||
this._wasCollected = reason === "gc";
|
||||
for (const object of [...this._objects.values()])
|
||||
object._dispose(reason);
|
||||
this._objects.clear();
|
||||
}
|
||||
_debugScopeState() {
|
||||
return {
|
||||
_guid: this._guid,
|
||||
objects: Array.from(this._objects.values()).map((o) => o._debugScopeState())
|
||||
};
|
||||
}
|
||||
_validatorToWireContext() {
|
||||
return {
|
||||
tChannelImpl: tChannelImplToWire,
|
||||
binary: this._connection.rawBuffers() ? "buffer" : "toBase64",
|
||||
isUnderTest: () => this._platform.isUnderTest()
|
||||
};
|
||||
}
|
||||
_createChannel(base) {
|
||||
const channel = new Proxy(base, {
|
||||
get: (obj, prop) => {
|
||||
if (typeof prop === "string") {
|
||||
const validator = (0, import_validator.maybeFindValidator)(this._type, prop, "Params");
|
||||
const { internal } = (0, import_protocolMetainfo.getMetainfo)({ type: this._type, method: prop }) || {};
|
||||
if (validator) {
|
||||
return async (params) => {
|
||||
return await this._wrapApiCall(async (apiZone) => {
|
||||
const validatedParams = validator(params, "", this._validatorToWireContext());
|
||||
if (!apiZone.internal && !apiZone.reported) {
|
||||
apiZone.reported = true;
|
||||
this._instrumentation.onApiCallBegin(apiZone, { type: this._type, method: prop, params });
|
||||
logApiCall(this._platform, this._logger, `=> ${apiZone.apiName} started`);
|
||||
return await this._connection.sendMessageToServer(this, prop, validatedParams, apiZone);
|
||||
}
|
||||
return await this._connection.sendMessageToServer(this, prop, validatedParams, { internal: true });
|
||||
}, { internal });
|
||||
};
|
||||
}
|
||||
}
|
||||
return obj[prop];
|
||||
}
|
||||
});
|
||||
channel._object = this;
|
||||
return channel;
|
||||
}
|
||||
async _wrapApiCall(func, options) {
|
||||
const logger = this._logger;
|
||||
const existingApiZone = this._platform.zones.current().data();
|
||||
if (existingApiZone)
|
||||
return await func(existingApiZone);
|
||||
const stackTrace = (0, import_clientStackTrace.captureLibraryStackTrace)(this._platform);
|
||||
const apiZone = { title: options?.title, apiName: stackTrace.apiName, frames: stackTrace.frames, internal: options?.internal ?? false, reported: false, userData: void 0, stepId: void 0 };
|
||||
try {
|
||||
const result = await this._platform.zones.current().push(apiZone).run(async () => await func(apiZone));
|
||||
if (!options?.internal) {
|
||||
logApiCall(this._platform, logger, `<= ${apiZone.apiName} succeeded`);
|
||||
this._instrumentation.onApiCallEnd(apiZone);
|
||||
}
|
||||
return result;
|
||||
} catch (e) {
|
||||
const innerError = (this._platform.showInternalStackFrames() || this._platform.isUnderTest()) && e.stack ? "\n<inner error>\n" + e.stack : "";
|
||||
if (apiZone.apiName && !apiZone.apiName.includes("<anonymous>"))
|
||||
e.message = apiZone.apiName + ": " + e.message;
|
||||
const stackFrames = "\n" + (0, import_stackTrace.stringifyStackFrames)(stackTrace.frames).join("\n") + innerError;
|
||||
if (stackFrames.trim())
|
||||
e.stack = e.message + stackFrames;
|
||||
else
|
||||
e.stack = "";
|
||||
if (!options?.internal) {
|
||||
apiZone.error = e;
|
||||
logApiCall(this._platform, logger, `<= ${apiZone.apiName} failed`);
|
||||
this._instrumentation.onApiCallEnd(apiZone);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
toJSON() {
|
||||
return {
|
||||
_type: this._type,
|
||||
_guid: this._guid
|
||||
};
|
||||
}
|
||||
}
|
||||
function logApiCall(platform, logger, message) {
|
||||
if (logger && logger.isEnabled("api", "info"))
|
||||
logger.log("api", "info", message, [], { color: "cyan" });
|
||||
platform.log("api", message);
|
||||
}
|
||||
function tChannelImplToWire(names, arg, path, context) {
|
||||
if (arg._object instanceof ChannelOwner && (names === "*" || names.includes(arg._object._type)))
|
||||
return { guid: arg._object._guid };
|
||||
throw new import_validator.ValidationError(`${path}: expected channel ${names.toString()}`);
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ChannelOwner
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user