[website] Fix broken e2e tests because of sqlite db integration update#3172
[website] Fix broken e2e tests because of sqlite db integration update#3172
Conversation
|
@akirk does it work for you locally? I'm getting CORS errors when I try to start Adminer or PHPMyAdmin.
|
|
To fix the CORS errors you'll need #3172. You can do |
|
Oh wait: |
|
This snippet will help, maybe we should commit it. diff --git i/packages/php-wasm/web/src/lib/fetch-with-cors-proxy.ts w/packages/php-wasm/web/src/lib/fetch-with-cors-proxy.ts
index ebb933071..13bbcbf61 100644
--- i/packages/php-wasm/web/src/lib/fetch-with-cors-proxy.ts
+++ w/packages/php-wasm/web/src/lib/fetch-with-cors-proxy.ts
@@ -68,7 +68,17 @@ export async function fetchWithCorsProxy(
// Check for firewall interference: if we got a response but it's
// missing the CORS proxy identification header, the response likely
// came from a network firewall rather than the actual CORS proxy.
- if (!response.headers.has(CORS_PROXY_HEADER)) {
+ // Skip this check for localhost proxies since they're trusted.
+ // A relative URL (starts with /) means it's on the same origin.
+ const isRelativeUrl = corsProxyUrl.startsWith('/');
+ let isLocalhostProxy = isRelativeUrl;
+ if (!isRelativeUrl) {
+ const corsProxyUrlObj = new URL(corsProxyUrl);
+ isLocalhostProxy =
+ corsProxyUrlObj.hostname === 'localhost' ||
+ corsProxyUrlObj.hostname === '127.0.0.1';
+ }
+ if (!isLocalhostProxy && !response.headers.has(CORS_PROXY_HEADER)) {
throw new FirewallInterferenceError(
requestObject.url,
response.status, |
|
I'll merge since this at a very least fixes the fatal error |
|
@akirk Thanks for the fix! I tried to keep this in mind when adding new APIs, but it seems I did so only for I'll fix this on the SQLite side as well. There is also a recently added "loader" file in the SQLite repo so I'll prepare a PR to use that one instead. |

Motivation for the change, related issues
The SQLite database integration plugin was refreshed on Jan 22, introducing new classes (
WP_PDO_Proxy_StatementandWP_PDO_MySQL_On_SQLite). The Adminer and phpMyAdmin extensions weren't updated to load these new files, causing both database tools to fail with:This broke the e2e tests for "Database panel > should load and open Adminer" and "Database panel > should load and open phpMyAdmin".
Implementation details
Added the missing
require_oncestatements for the two new SQLite driver classes to both:adminer-mysql-on-sqlite-driver.phpDbiMysqli.phpTesting Instructions (or ideally a Blueprint)
npx nx e2e playground-websiteand verify the Database panel tests pass