Skip to content

Commit adf5ab4

Browse files
authored
E2E test: log out extension related info (#6583)
Capture extension data when tests exit ### QA Notes We should catch the extension file list and the contents of extensions.json for each completed case.
1 parent 1856215 commit adf5ab4

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/e2e/infra/playwrightDriver.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as playwright from '@playwright/test';
77
// eslint-disable-next-line local/code-import-patterns
88
import type { Protocol } from 'playwright-core/types/protocol';
9-
import { dirname, join } from 'path';
9+
import path, { dirname, join } from 'path';
1010
import { promises } from 'fs';
1111
import { IWindowDriver } from './driver';
1212
// eslint-disable-next-line local/code-import-patterns
@@ -186,6 +186,23 @@ export class PlaywrightDriver {
186186

187187
// Desktop: exit via `driver.exitApplication`
188188
else {
189+
190+
// Log all files in extensionsPath
191+
const extensionsPath = this.options.extensionsPath;
192+
this.options.logger.log(`Listing files in: ${extensionsPath}`);
193+
194+
const files = await promises.readdir(extensionsPath);
195+
this.options.logger.log(`Files in extensionsPath: ${files.join(', ')}`);
196+
197+
// Read and log contents of extensions.json (if it exists)
198+
const extensionsJsonPath = path.join(extensionsPath, 'extensions.json');
199+
try {
200+
const extensionsJsonContent = await promises.readFile(extensionsJsonPath, 'utf-8');
201+
this.options.logger.log(`Contents of extensions.json:\n${extensionsJsonContent}`);
202+
} catch (jsonError) {
203+
this.options.logger.log(`extensions.json not found or cannot be read: ${jsonError}`);
204+
}
205+
189206
try {
190207
await measureAndLog(() => this.evaluateWithDriver(([driver]) => driver.exitApplication()), 'driver.exitApplication()', this.options.logger);
191208
} catch (error) {

0 commit comments

Comments
 (0)