1414 * limitations under the License.
1515 */
1616
17+ import { iso } from '../../packages/playwright-core/lib/coreBundle' ;
1718import { test , expect } from './pageTest' ;
1819
20+ const { ManualPromise } = iso ;
21+
1922test ( 'LH-001 should work' , async ( { page, server } ) => {
2023 await page . goto ( server . PREFIX + '/input/handle-locator.html' ) ;
2124
@@ -120,14 +123,19 @@ test('LH-004 should not work with force:true', async ({ page, server }) => {
120123 expect ( await page . evaluate ( 'window.clicked' ) ) . toBe ( undefined ) ;
121124} ) ;
122125
123- test ( 'LH-005 should throw when handler times out' , async ( { page, server } ) => {
126+ test ( 'LH-005 should throw when handler times out' , {
127+ annotation : { type : 'issue' , description : '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/microsoft/playwright/issues/43607' } ,
128+ } , async ( { page, server } ) => {
124129 await page . goto ( server . PREFIX + '/input/handle-locator.html' ) ;
125130
126131 let called = 0 ;
132+ const releaseHandler = new ManualPromise ( ) ;
133+ const handlerFinished = new ManualPromise < Error | void > ( ) ;
127134 await page . addLocatorHandler ( page . getByText ( 'This interstitial covers the button' ) , async ( ) => {
128135 ++ called ;
129136 // Deliberately timeout.
130- await new Promise ( ( ) => { } ) ;
137+ await releaseHandler ;
138+ handlerFinished . resolve ( await page . locator ( '#close' ) . click ( { timeout : 3000 } ) . catch ( e => e ) ) ;
131139 } ) ;
132140
133141 await page . locator ( '#aside' ) . hover ( ) ;
@@ -143,6 +151,9 @@ test('LH-005 should throw when handler times out', async ({ page, server }) => {
143151
144152 // Should not enter the same handler while it is still running.
145153 expect ( called ) . toBe ( 1 ) ;
154+
155+ releaseHandler . resolve ( ) ;
156+ expect ( await handlerFinished ) . toBeUndefined ( ) ;
146157} ) ;
147158
148159test ( 'LH-006 should work with toBeVisible' , async ( { page, server } ) => {
0 commit comments