fix(research): keep experiment choices after linked template failure (RP10)
This commit is contained in:
parent
49da701aa7
commit
f0e7d07476
5 changed files with 230 additions and 8 deletions
|
|
@ -1476,9 +1476,39 @@ test('retained_experiment_preview_submit_compare_cancel_and_reopen_browser', asy
|
|||
await f.login();
|
||||
await f.page.goto(`${f.origin}/backtests/${backtest.id}`);
|
||||
await f.page.getByRole('link', { name: 'Create experiment', exact: true }).click();
|
||||
await f.page.getByLabel('Saved backtest').selectOption(backtest.id);
|
||||
// A stale link must not hide the valid saved template in the catalog.
|
||||
const missingBacktestId = randomUUID();
|
||||
const missingLookup = f.page.waitForResponse(response =>
|
||||
response.url().endsWith(`/api/v2/backtests/${missingBacktestId}`)
|
||||
);
|
||||
await f.page.goto(`${f.origin}/experiments?backtestId=${missingBacktestId}`);
|
||||
expect((await missingLookup).status()).toBe(404);
|
||||
await visible(f.page, /Could not load the selected backtest:/);
|
||||
expect(await f.page.getByLabel('Saved backtest').inputValue()).toBe(missingBacktestId);
|
||||
await f.page
|
||||
.getByLabel('Saved backtest')
|
||||
.locator(`option[value="${backtest.id}"]`)
|
||||
.waitFor({ state: 'attached' });
|
||||
await f.page.getByLabel('Experiment name', { exact: true }).fill('Retained SMA sweep');
|
||||
await f.page.getByLabel('Parameter grid (JSON)').fill('{"fastPeriod":[1,2],"slowPeriod":[3]}');
|
||||
expect(
|
||||
await f.page.getByRole('button', { name: 'Preview experiment', exact: true }).isDisabled()
|
||||
).toBe(true);
|
||||
await f.page.getByLabel('Saved backtest').selectOption(backtest.id);
|
||||
expect(await f.page.getByLabel('Experiment name', { exact: true }).inputValue()).toBe(
|
||||
'Retained SMA sweep'
|
||||
);
|
||||
expect(await f.page.getByLabel('Parameter grid (JSON)').inputValue()).toBe(
|
||||
'{"fastPeriod":[1,2],"slowPeriod":[3]}'
|
||||
);
|
||||
expect(await f.request(`/api/v2/backtests/${backtest.id}`)).toEqual(backtest);
|
||||
expect(
|
||||
(await f.pool.query('SELECT count(*)::int AS n FROM research_experiments')).rows[0].n
|
||||
).toBe(0);
|
||||
expect((await f.pool.query('SELECT count(*)::int AS n FROM runs')).rows[0].n).toBe(0);
|
||||
expect((await f.pool.query('SELECT count(*)::int AS n FROM backtest_dispatch')).rows[0].n).toBe(
|
||||
0
|
||||
);
|
||||
const previewing = f.page.waitForResponse(response =>
|
||||
response.url().endsWith('/api/v2/experiments/preview')
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue