fix tests

This commit is contained in:
Scott Bell 2023-05-02 15:01:36 +02:00
parent 8945f27eed
commit 6dd6c87ceb
2 changed files with 11 additions and 4 deletions

View File

@ -44,7 +44,7 @@ test.describe('Example Imagery Object', () => {
// Verify that the created object is focused
await expect(page.locator('.l-browse-bar__object-name')).toContainText(exampleImagery.name);
await page.locator(backgroundImageSelector).hover({trial: true});
await page.locator('canvas').hover({trial: true});
});
test('Can use Mouse Wheel to zoom in and out of latest image', async ({ page }) => {
@ -664,7 +664,6 @@ async function panZoomAndAssertImageProperties(page) {
async function mouseZoomOnImageAndAssert(page, factor = 2) {
// Zoom in
const originalImageDimensions = await page.locator(backgroundImageSelector).boundingBox();
await page.locator(backgroundImageSelector).hover({trial: true});
const deltaYStep = 100; // equivalent to 1x zoom
await page.mouse.wheel(0, deltaYStep * factor);
const zoomedBoundingBox = await page.locator(backgroundImageSelector).boundingBox();
@ -675,7 +674,11 @@ async function mouseZoomOnImageAndAssert(page, factor = 2) {
await page.mouse.move(imageCenterX, imageCenterY);
// Wait for zoom animation to finish
await page.locator(backgroundImageSelector).hover({trial: true});
await page.locator(backgroundImageSelector).hover({
trial: true,
// eslint-disable-next-line playwright/no-force-option
force: true
});
const imageMouseZoomed = await page.locator(backgroundImageSelector).boundingBox();
if (factor > 0) {

View File

@ -79,6 +79,7 @@ export default {
this.buildAnnotationIndex();
},
beforeDestroy() {
console.debug(`🚮 Canvas destroyed`);
this.openmct.selection.off('change', this.updateSelection);
document.body.removeEventListener('click', this.cancelSelection);
},
@ -157,7 +158,7 @@ export default {
this.context.stroke();
},
trackAnnotationDrag(event) {
if (this.mouseDown && !this.dragging) {
if (this.mouseDown && !this.dragging && event.shiftKey) {
this.startAnnotationDrag(event);
} else if (this.dragging) {
const boundingRect = this.canvas.getBoundingClientRect();
@ -273,6 +274,9 @@ export default {
targetDomainObjects,
annotations: nearbyAnnotations
});
} else {
// nothing selected
this.drawAnnotations();
}
},
selectOrCreateAnnotation(event) {