fix(microscopy): rename measurement in microscopy mode (#5866)

This commit is contained in:
Ghadeer Albattarni authored and GitHub committed 2026-03-04 15:28:41 -05:00
1 parent df22109013
commit 2358a73c3c
5 files changed
+86 -8

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import { test, visitStudy, expect } from './utils';
test.beforeEach(async ({ page }) => {
const studyInstanceUID = '1.2.276.0.7230010.3.1.2.296485376.1.1665793212.499772';
const mode = 'microscopy';
await visitStudy(page, studyInstanceUID, mode, 5000);
});
test('should rename a microscopy measurement label', async ({
page,
mainToolbarPageObject,
DOMOverlayPageObject,
rightPanelPageObject,
viewportPageObject,
}) => {
const newLabel = 'Renamed Measurement';
await mainToolbarPageObject.measurementTools.line.click();
await viewportPageObject.active.clickAt([{ x: 400, y: 200 }]);
await page.waitForTimeout(200);
await viewportPageObject.active.clickAt([{ x: 550, y: 250 }]);
const measurementRow = rightPanelPageObject.microscopyPanel.nthMeasurement(0);
await expect(measurementRow.locator).toBeVisible();
await expect(measurementRow.title).toHaveText('(empty)');
await measurementRow.actions.rename(newLabel);
await expect(DOMOverlayPageObject.dialog.input.locator).toBeHidden();
await expect(measurementRow.title).toHaveText(newLabel);
});
+15 -1
View File
@@ -194,7 +194,6 @@ export class MainToolbarPageObject {
},
};
},
get freehandROI() {
const button = page.getByTestId('PlanarFreehandROI');
return {
@@ -205,6 +204,21 @@ export class MainToolbarPageObject {
},
};
},
/* microscopy specific tools */
// `.last()` targets the menu item inside the dropdown, not the active-tool
// indicator inside the split-button primary
// because both share the same data-cy value (e.g. "line")
// Other microscopy tools might follow the same pattern
get line() {
const button = page.getByTestId('line').last();
return {
button,
async click() {
await measurementTools.click();
await button.click();
},
};
},
};
}
+22
View File
@@ -46,6 +46,9 @@ export class RightPanelPageObject {
get actions() {
return getActionsMenu(row);
},
get title() {
return row.getByTestId('data-row-title');
},
click: async () => {
await row.click();
},
@@ -323,4 +326,23 @@ export class RightPanelPageObject {
},
};
}
get microscopyPanel() {
const page = this.page;
const getMeasurementByIdx = (index: number) => this.getPanelRowByIdx(index);
const getMeasurementByText = (text: string) => this.getPanelRowByText(text);
return {
locator: page.getByTestId('measurements-panel'),
getMeasurementCount: async () => {
return await page.getByTestId('data-row').count();
},
nthMeasurement(index: number) {
return getMeasurementByIdx(index);
},
measurementByText(text: string) {
return getMeasurementByText(text);
},
};
}
}