[tests] update selection overlay tests after canvas migration (#5173)

* [fix] update selection overlay tests after canvas migration

Update browser tests to work with canvas-based selection overlay introduced in PR #5158.
Replaces DOM-based .selection-overlay-container checks with .selection-toolbox visibility
and converts border visibility tests to canvas screenshot comparisons.

Fixes #5158

* [chore] remove unused file flagged by knip

* [fix] adjust test expectations for canvas-based positioning

- Skip animated webp test unrelated to selection overlay changes
- Update toolbox position expectations to match canvas-based coordinates
- Canvas positioning uses different coordinate system than DOM overlay

* [fix] improve positioning test flexibility and revert webp skip

- Make toolbox position test more flexible for canvas-based coordinates
- Revert animated webp test skip as requested in review
- Canvas positioning varies more than DOM, use reasonable bounds instead

* Update test expectations [skip ci]

* [refactor] address review comments - use fixture locators

- Add selectionToolbox locator to ComfyPage fixture as requested
- Replace .isVisible() === false with .not.toBeVisible() pattern
- Update all selection toolbox locators to use fixture instead of inline selectors
- Improves maintainability and follows established patterns

* [refactor] use fixture canvas locator for screenshots

Replace inline canvas locators with comfyPage.canvas fixture property
for consistency and maintainability as suggested in review.

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Christian Byrne
2025-08-23 12:12:28 -07:00
committed by GitHub
parent 5cc916bf9f
commit 95a1c86c23
8 changed files with 35 additions and 124 deletions

View File

@@ -1,80 +0,0 @@
import { onMounted, ref, watch } from 'vue'
import type { Ref, WatchSource } from 'vue'
/**
* A composable that manages retriggerable CSS animations.
* Provides a boolean ref that can be toggled to restart CSS animations.
*
* @param trigger - Optional reactive source that triggers the animation when it changes
* @param options - Configuration options
* @returns An object containing the animation state ref
*
* @example
* ```vue
* <template>
* <div :class="{ 'animate-slide-up': shouldAnimate }">
* Content
* </div>
* </template>
*
* <script setup>
* const { shouldAnimate } = useRetriggerableAnimation(someReactiveTrigger)
* </script>
* ```
*/
export function useRetriggerableAnimation<T = any>(
trigger?: WatchSource<T> | Ref<T>,
options: {
animateOnMount?: boolean
animationDelay?: number
} = {}
) {
const { animateOnMount = true, animationDelay = 0 } = options
const shouldAnimate = ref(false)
/**
* Retriggers the animation by removing and re-adding the animation class
*/
const retriggerAnimation = () => {
// Remove animation class
shouldAnimate.value = false
// Force browser reflow to ensure the class removal is processed
void document.body.offsetHeight
// Re-add animation class in the next frame
requestAnimationFrame(() => {
if (animationDelay > 0) {
setTimeout(() => {
shouldAnimate.value = true
}, animationDelay)
} else {
shouldAnimate.value = true
}
})
}
// Trigger animation on mount if requested
if (animateOnMount) {
onMounted(() => {
if (animationDelay > 0) {
setTimeout(() => {
shouldAnimate.value = true
}, animationDelay)
} else {
shouldAnimate.value = true
}
})
}
// Watch for trigger changes to retrigger animation
if (trigger) {
watch(trigger, () => {
retriggerAnimation()
})
}
return {
shouldAnimate,
retriggerAnimation
}
}