Better logging for hanging benchmarks
This commit is contained in:
parent
adf2957537
commit
51c2029b5c
9 changed files with 446 additions and 458 deletions
|
@ -5,22 +5,16 @@
|
|||
import type { PrimaryDevice } from '@signalapp/mock-server';
|
||||
import { StorageState } from '@signalapp/mock-server';
|
||||
|
||||
import type { App } from './fixtures';
|
||||
import { Bootstrap } from './fixtures';
|
||||
|
||||
const CONTACT_COUNT = 1000;
|
||||
|
||||
void (async () => {
|
||||
Bootstrap.benchmark(async (bootstrap: Bootstrap): Promise<void> => {
|
||||
const contactNames = new Array<string>();
|
||||
for (let i = 0; i < CONTACT_COUNT; i += 1) {
|
||||
contactNames.push(`Contact ${i}`);
|
||||
}
|
||||
|
||||
const bootstrap = new Bootstrap({
|
||||
benchmark: true,
|
||||
});
|
||||
|
||||
await bootstrap.init();
|
||||
const { phone, server } = bootstrap;
|
||||
|
||||
let state = StorageState.getEmpty();
|
||||
|
@ -50,25 +44,16 @@ void (async () => {
|
|||
await phone.setStorageState(state);
|
||||
|
||||
const start = Date.now();
|
||||
let app: App | undefined;
|
||||
try {
|
||||
app = await bootstrap.link();
|
||||
const window = await app.getWindow();
|
||||
const app = await bootstrap.link();
|
||||
const window = await app.getWindow();
|
||||
|
||||
const leftPane = window.locator('.left-pane-wrapper');
|
||||
const leftPane = window.locator('.left-pane-wrapper');
|
||||
|
||||
const item = leftPane.locator(
|
||||
`[data-testid="${lastContact?.toContact().uuid}"]`
|
||||
);
|
||||
await item.waitFor();
|
||||
const item = leftPane.locator(
|
||||
`[data-testid="${lastContact?.toContact().uuid}"]`
|
||||
);
|
||||
await item.waitFor();
|
||||
|
||||
const duration = Date.now() - start;
|
||||
console.log(`Took: ${(duration / 1000).toFixed(2)} seconds`);
|
||||
} catch (error) {
|
||||
await bootstrap.saveLogs(app);
|
||||
throw error;
|
||||
} finally {
|
||||
await app?.close();
|
||||
await bootstrap.teardown();
|
||||
}
|
||||
})();
|
||||
const duration = Date.now() - start;
|
||||
console.log(`Took: ${(duration / 1000).toFixed(2)} seconds`);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue