@@ -237,45 +237,39 @@ def test_search_ctrl_k_hotkey_desktop(self):
237237 page = self .browser .new_page ()
238238 page .goto (self .live_server_url )
239239
240- mobile_search_bar , desktop_search_bar = page .query_selector_all ("#id_q" )
240+ mobile_search_bar = page .locator ("#id_mobile-q" )
241+ desktop_search_bar = page .locator ("#id_desktop-q" )
241242 self .assertFalse (mobile_search_bar .is_visible ())
242243 self .assertTrue (desktop_search_bar .is_visible ())
243- is_focused = page .evaluate (
244- "el => document.activeElement === el" , desktop_search_bar
245- )
244+ is_focused = page .evaluate ("document.activeElement.id === 'id_desktop-q'" )
246245 self .assertFalse (is_focused )
247246
248247 page .keyboard .press ("Control+KeyK" )
249- is_focused = page .evaluate (
250- "el => document.activeElement === el" , desktop_search_bar
251- )
248+ is_focused = page .evaluate ("document.activeElement.id === 'id_desktop-q'" )
252249 self .assertTrue (is_focused )
253250 page .close ()
254251
255252 def test_search_ctrl_k_hotkey_mobile (self ):
256253 page = self .browser .new_page (viewport = {"width" : 375 , "height" : 812 })
257254 page .goto (self .live_server_url )
258255
259- mobile_search_bar , desktop_search_bar = page .query_selector_all ("#id_q" )
256+ mobile_search_bar = page .locator ("#id_mobile-q" )
257+ desktop_search_bar = page .locator ("#id_desktop-q" )
260258 self .assertTrue (mobile_search_bar .is_visible ())
261259 self .assertFalse (desktop_search_bar .is_visible ())
262- is_focused = page .evaluate (
263- "el => document.activeElement === el" , mobile_search_bar
264- )
260+ is_focused = page .evaluate ("document.activeElement.id === 'id_mobile-q'" )
265261 self .assertFalse (is_focused )
266262
267263 page .keyboard .press ("Control+KeyK" )
268- is_focused = page .evaluate (
269- "el => document.activeElement === el" , mobile_search_bar
270- )
264+ is_focused = page .evaluate ("document.activeElement.id === 'id_mobile-q'" )
271265 self .assertTrue (is_focused )
272266 page .close ()
273267
274268 def test_search_placeholder_mac_mode (self ):
275269 page = self .browser .new_page (user_agent = "Mozilla/5.0 (Macintosh) AppleWebKit" )
276270 page .goto (self .live_server_url )
277271
278- inputs = page .query_selector_all ("#id_q" )
272+ inputs = page .query_selector_all ('[name="q"]' )
279273 self .assertEqual (len (inputs ), 2 )
280274
281275 for el in inputs :
0 commit comments