[ct]: sometimes SvelteComponent.$on() is not in sync
See original GitHub issueIn a regular scenario it seems that custom event is not dispatched in sync with the test execution and after searching in Playwright repo and Svelte repo, i don’t know how to understand this.
The value of result in the test sometimes is null:

I need to do a trick and “await” for the result binding a global var inside the component:

¿await locator("...").click() is not really waiting to the callback finnish when is a well declared Promise? Here is the trick with global var. Previously, there is a dispatcher('end', result).

Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Not synchronized when directly accessing component props ...
1. <script> ; 2. import Component from './Component.svelte' ; 3 ; 4. let c ; 5. let value = 0.
Read more >Changelog - Cypress Documentation
Fixed an issue with Angular Component Testing where urls within SASS/SCSS files were not being correctly resolved which could result in incomplete styling....
Read more >svelte - Prop & store sync issue in grandchild component
i see no solution to this problem other than binding both values to be updated at the same time of the component life-cycle...
Read more >Dynamic behavior in Svelte: working with variables and props
Our Todos.svelte component is currently just displaying static markup; let's start making it a bit more dynamic.
Read more >Svelte Component Testing with Cypress + Vite - This Dot Labs
Cypress is a well-known e2e and integration testing framework. But since v7, a Cypress Component Test Runner was introduced, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You can already achieve that with poll:
Unfortunately there is no generic mechanism that would automatically wait for the desired effects of a user action. Closing this issue as there are several solutions for the problem.
Not sure if possible but it would be great if we don’t have to think about awaiting at all. Maybe with a retry mechanism? Made a simpler version of the problem: