From 1655b62dc3b806087f452c2d9f60637d2d05c3c1 Mon Sep 17 00:00:00 2001 From: diosmosis Date: Mon, 23 Dec 2024 10:45:21 -0800 Subject: [PATCH] debug e2e test failure --- tests/e2e-uninstall/get-matomo-tables.php | 7 ++++++- tests/e2e-uninstall/uninstall.e2e.ts | 10 +++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/e2e-uninstall/get-matomo-tables.php b/tests/e2e-uninstall/get-matomo-tables.php index 2a1a26660..2f5bf5030 100644 --- a/tests/e2e-uninstall/get-matomo-tables.php +++ b/tests/e2e-uninstall/get-matomo-tables.php @@ -24,4 +24,9 @@ $query->execute(); $tables = $query->fetchAll( \PDO::FETCH_COLUMN ); -echo json_encode( $tables ); +echo json_encode( + [ + 'dbname' => $dbname, + 'tables' => $tables, + ] +); diff --git a/tests/e2e-uninstall/uninstall.e2e.ts b/tests/e2e-uninstall/uninstall.e2e.ts index bb6be2357..7088a4d5c 100644 --- a/tests/e2e-uninstall/uninstall.e2e.ts +++ b/tests/e2e-uninstall/uninstall.e2e.ts @@ -16,6 +16,7 @@ describe('MWP Uninstall', () => { }); async function getTablesInstalled(): Promise { + console.log('root url: ' + `${await Website.rootUrl()}/matomo-for-wordpress/tests/e2e-uninstall/get-matomo-tables.php`); let result: any = await fetch(`${await Website.rootUrl()}/matomo-for-wordpress/tests/e2e-uninstall/get-matomo-tables.php`); result = await result.text(); try { @@ -27,7 +28,7 @@ describe('MWP Uninstall', () => { } it('should uninstall and remove all data when the "remove all data" option is enabled', async () => { - let tablesBeforeUninstall = await getTablesInstalled(); + let tablesBeforeUninstall = (await getTablesInstalled()).tables; tablesBeforeUninstall = tablesBeforeUninstall.filter((t: string) => t.includes('matomo')); expect(tablesBeforeUninstall.length).toBeGreaterThan(0); // before uninstalling, check there are tables with "matomo" in the name @@ -65,7 +66,10 @@ describe('MWP Uninstall', () => { expect(result.length).toBeGreaterThan(0); // sanity check - result = result.filter((t: string) => t.includes('matomo')); - expect(result).toEqual([]); // check there are no tables with "matomo" in the name + console.log(`result.dbname is: ${result.dbname}`); + + let tables = result.tables; + tables = tables.filter((t: string) => t.includes('matomo')); + expect(tables).toEqual([]); // check there are no tables with "matomo" in the name }); });