feat(research): download original canonical run results (RP08)
This commit is contained in:
parent
8e9d0cf619
commit
e8a6b70968
8 changed files with 245 additions and 13 deletions
|
|
@ -1930,6 +1930,9 @@ test('canonical_native_smoke', async () => {
|
|||
expect(
|
||||
await f.page.getByRole('button', { name: 'Download retained dataset', exact: true }).count()
|
||||
).toBe(0);
|
||||
expect(
|
||||
await f.page.getByRole('button', { name: 'Download run result', exact: true }).count()
|
||||
).toBe(0);
|
||||
// The editable template moves to a different retained source; this run's
|
||||
// export must still resolve its immutable original request hash.
|
||||
const replacement = canonicalSmaFixture(['A'], { volume: 2000 }).dataset;
|
||||
|
|
@ -1943,6 +1946,25 @@ test('canonical_native_smoke', async () => {
|
|||
await f.page.getByText('Immutable configuration and reporting policy', { exact: true }).click();
|
||||
await visible(f.page, result.request.datasetHash);
|
||||
await downloadDatasetInBrowser(f, dataset);
|
||||
const exportRequests: string[] = [];
|
||||
const recordExportRequest = (request: Request) => {
|
||||
if (new URL(request.url()).pathname.startsWith('/api/')) {
|
||||
exportRequests.push(request.url());
|
||||
}
|
||||
};
|
||||
f.page.on('request', recordExportRequest);
|
||||
const downloadingResult = f.page.waitForEvent('download');
|
||||
await f.page.getByRole('button', { name: 'Download run result', exact: true }).click();
|
||||
const downloadedResult = await downloadingResult;
|
||||
expect(downloadedResult.suggestedFilename()).toBe(`run-${runId}.json`);
|
||||
expect(await downloadedResult.failure()).toBeNull();
|
||||
const resultPath = await downloadedResult.path();
|
||||
if (!resultPath) {
|
||||
throw new Error('Expected a downloaded canonical result file');
|
||||
}
|
||||
expect(JSON.parse(readFileSync(resultPath, 'utf8'))).toEqual(result);
|
||||
f.page.off('request', recordExportRequest);
|
||||
expect(exportRequests).toEqual([]);
|
||||
expect((await f.request(`/api/v2/backtests/${id}`)).config.datasetHash).toBe(
|
||||
replacement.manifest.hash
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue