Add explicit per-plan gauge temperature offset
Test and deploy / test-and-deploy (push) Successful in 1m23s
Test and deploy / test-and-deploy (push) Successful in 1m23s
This commit is contained in:
1 parent
d96ed22de1
commit
eda3d8e77f
8 files changed
+90
-7
No files matched your search
@@ -815,3 +815,36 @@ test("browser: an interrupted Bean Bro stream keeps partial text, restores the q
|
||||
assert.equal(await page.locator("#chat-thread .user").count(),1);
|
||||
assert.deepEqual(errors,[]);
|
||||
});
|
||||
|
||||
test("browser: a per-plan gauge offset updates the graph, persists, clones and prints",browserOptions,async(t)=>{
|
||||
const {page,browser,base,create,csrfToken,errors}=await session(t);
|
||||
const saved=await create(warningPlan());
|
||||
await page.goto(base+"/app?plan="+saved.id);
|
||||
await page.getByRole("button",{name:"Preview report",exact:true}).waitFor();
|
||||
const input=page.getByRole("spinbutton",{name:"Gauge temperature offset (°F)"});
|
||||
await input.fill("-50");
|
||||
await page.waitForFunction(()=>document.querySelector("#curve-svg-live").textContent.includes("342°F"));
|
||||
await input.scrollIntoViewIfNeeded();
|
||||
await page.screenshot({path:"/tmp/gauge-offset-desktop.png",animations:"disabled"});
|
||||
await page.getByRole("link",{name:"← Your plans",exact:true}).click();
|
||||
const loaded=(await (await page.request.get(base+"/api/plans/"+saved.id)).json()).plan.plan;
|
||||
assert.equal(loaded.temperatureOffsetF,"-50");
|
||||
const cloned=await (await page.request.post(base+"/api/plans/"+saved.id+"/clone",{headers:{"x-csrf-token":csrfToken}})).json();
|
||||
assert.equal(cloned.plan.plan.temperatureOffsetF,"-50");
|
||||
await page.setViewportSize({width:390,height:844});
|
||||
await page.goto(base+"/app?plan="+saved.id);
|
||||
await input.waitFor();
|
||||
assert.equal(await input.inputValue(),"-50");
|
||||
await input.scrollIntoViewIfNeeded();
|
||||
await page.screenshot({path:"/tmp/gauge-offset-mobile.png",animations:"disabled"});
|
||||
assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),true);
|
||||
const report=await browser.newPage();
|
||||
const html=renderReportHtml(loaded);
|
||||
assert.match(html,/Gauge temperature offset/);assert.match(html,/-50°F/);assert.match(html,/342°F/);
|
||||
await report.setContent(html);
|
||||
const {PDFDocument}=await import("pdf-lib");
|
||||
const pdf=await PDFDocument.load(await report.pdf({format:"Letter",preferCSSPageSize:true}));
|
||||
assert.equal(pdf.getPageCount(),2);
|
||||
await report.close();
|
||||
assert.deepEqual(errors,[]);
|
||||
});
|
||||
Reference in new issue
Block a user