Skip to content
Merged

V0153 #123

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@klinok/api-node",
"version": "0.15.2",
"version": "0.15.3",
"private": true,
"type": "module",
"main": "./dist/server.js",
Expand Down
79 changes: 73 additions & 6 deletions e2e/operational.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,12 @@ test("fresh provisioning, Doctor approval, grant, draft, and confirmation", asyn
await hematocritInput.fill("42");
const hemoglobinInput = await addLaboratoryIndicator(/Гемоглобин \(Hgb\)/, "Гемоглобин (Hgb)");
await hemoglobinInput.fill("145");
const erythrocytesInput = await addLaboratoryIndicator(/Эритроциты \(RBC\)/, "Эритроциты (RBC)");
await erythrocytesInput.fill("7.2");
const plateletsInput = await addLaboratoryIndicator(/Тромбоциты \(Plt\)/, "Тромбоциты (Plt)");
await plateletsInput.fill("256");
const meanCellVolumeInput = await addLaboratoryIndicator(/Средний объем эритроцита \(MCV\)/, "Средний объем эритроцита (MCV)");
await meanCellVolumeInput.fill("45");
expect(await laboratoryCard.locator(".laboratory-study-card").evaluate((card) => {
const results = card.querySelector(".laboratory-panel-results");
const create = card.querySelector(".laboratory-indicator-create");
Expand Down Expand Up @@ -1596,18 +1602,73 @@ test("fresh provisioning, Doctor approval, grant, draft, and confirmation", asyn
".owner-pet-detail > :is(.owner-epicrisis, .laboratory-comparison, .owner-medical-record)",
));
await ownerPage.setViewportSize({ width: 1280, height: 720 });
await laboratoryComparison.locator(".app-catalog-toggle").click();
await laboratoryComparison.getByRole("option", { name: /Лейкоциты \(WBC\)/ }).click();
await laboratoryComparison.locator(".app-catalog-toggle").click();
await laboratoryComparison.getByRole("option", { name: /Гематокрит \(Hct, PCV\)/ }).click();
const laboratoryIndicatorToggle = laboratoryComparison.locator(".app-catalog-toggle");
await laboratoryIndicatorToggle.click();
await ownerPage.mouse.move(0, 0);
const ownerStateRefresh = ownerPage.waitForResponse((response) => {
const url = new URL(response.url());
return response.request().method() === "GET"
&& url.pathname.endsWith("/api/state")
&& url.searchParams.get("role") === "owner"
&& (response.ok() || response.status() === 304);
});
await laboratoryIndicatorToggle.hover();
await ownerStateRefresh;
await expect(laboratoryIndicatorToggle).toHaveAttribute("aria-expanded", "true");
await laboratoryIndicatorToggle.click();
for (const indicatorName of [
/Лейкоциты \(WBC\)/,
/Гематокрит \(Hct, PCV\)/,
/Гемоглобин \(Hgb\)/,
/Эритроциты \(RBC\)/,
/Тромбоциты \(Plt\)/,
/Средний объем эритроцита \(MCV\)/,
]) {
await laboratoryIndicatorToggle.click();
await laboratoryComparison.getByRole("option", { name: indicatorName }).click();
}
await expect(laboratoryComparison.locator(
".laboratory-results thead .laboratory-comparison-column-heading",
)).toHaveCount(2);
)).toHaveCount(6);
await expect(laboratoryComparison.locator(".laboratory-comparison-selections")).toHaveCount(0);
await expect(laboratoryComparison.locator(".laboratory-comparison-table")).toBeVisible();
await expect(laboratoryComparison.locator(".laboratory-results-scroll")).toHaveClass(/owner-access-table-wrap/);
await expect(laboratoryComparison.locator(".laboratory-results")).toHaveClass(/owner-access-table/);
await expect(laboratoryComparison.locator(".laboratory-results")).toBeVisible();
await ownerPage.setViewportSize({ width: 900, height: 720 });
const laboratoryResultsScroll = laboratoryComparison.locator(".laboratory-results-scroll");
const laboratoryLayout = await laboratoryResultsScroll.evaluate((scroll) => {
const table = scroll.querySelector<HTMLTableElement>(".laboratory-results")!;
const headings = [...table.querySelectorAll<HTMLTableCellElement>("thead th")];
const panel = scroll.closest<HTMLElement>(".laboratory-comparison")!;
return {
scrollable: scroll.scrollWidth > scroll.clientWidth + 1,
panelFits: panel.scrollWidth <= panel.clientWidth + 1,
pageFits: document.documentElement.scrollWidth <= window.innerWidth + 1,
tableWidth: table.getBoundingClientRect().width,
dateWidth: headings[0]!.getBoundingClientRect().width,
studyWidth: headings[1]!.getBoundingClientRect().width,
indicatorWidths: headings.slice(2).map((heading) => heading.getBoundingClientRect().width),
dateWhiteSpace: getComputedStyle(headings[0]!).whiteSpace,
indicatorOverflowWrap: getComputedStyle(headings[2]!.querySelector<HTMLElement>(".laboratory-comparison-column-label")!).overflowWrap,
};
});
expect(laboratoryLayout).toMatchObject({
scrollable: true,
panelFits: true,
pageFits: true,
dateWhiteSpace: "nowrap",
indicatorOverflowWrap: "normal",
});
expect(laboratoryLayout.dateWidth).toBeGreaterThanOrEqual(118);
expect(laboratoryLayout.studyWidth).toBeGreaterThanOrEqual(222);
expect(Math.min(...laboratoryLayout.indicatorWidths)).toBeGreaterThanOrEqual(166);
expect(await laboratoryResultsScroll.evaluate((scroll) => {
scroll.scrollLeft = scroll.scrollWidth;
const offset = scroll.scrollLeft;
scroll.scrollLeft = 0;
return offset;
})).toBeGreaterThan(0);
const laboratoryDateHeader = laboratoryComparison.locator(".laboratory-results th").first();
await expect(laboratoryDateHeader).toHaveAttribute("aria-sort", "descending");
await expectTopAligned(
Expand All @@ -1620,7 +1681,7 @@ test("fresh provisioning, Doctor approval, grant, draft, and confirmation", asyn
await expect(laboratoryComparison).toBeVisible({ timeout: replicationTimeout });
await expect(laboratoryComparison.locator(
".laboratory-results thead .laboratory-comparison-column-heading",
)).toHaveCount(2);
)).toHaveCount(6);
const removeLeukocytes = laboratoryComparison.getByRole("button", { name: /Удалить показатель «Лейкоциты \(WBC\),/ });
const removeHematocrit = laboratoryComparison.getByRole("button", { name: /Удалить показатель «Гематокрит \(Hct, PCV\), %»/ });
await expect(removeLeukocytes).toBeVisible();
Expand All @@ -1639,6 +1700,12 @@ test("fresh provisioning, Doctor approval, grant, draft, and confirmation", asyn
expect(Math.abs(removeControlMetrics.iconWidth - removeControlMetrics.fontSize)).toBeLessThanOrEqual(1);
await removeLeukocytes.click();
await expect(removeLeukocytes).toHaveCount(0);
await expect(laboratoryComparison.locator(
".laboratory-results thead .laboratory-comparison-column-heading",
)).toHaveCount(5);
expect(await laboratoryComparison.locator(".laboratory-results").evaluate((table) =>
table.getBoundingClientRect().width
)).toBeLessThan(laboratoryLayout.tableWidth);
await expect(removeHematocrit).toBeVisible();
await expect(laboratoryComparison.getByRole("columnheader", { name: /Лейкоциты \(WBC\)/ })).toHaveCount(0);
await expect(laboratoryComparison.getByRole("columnheader", { name: /Гематокрит \(Hct, PCV\)/ })).toBeVisible();
Expand Down
Loading
Loading