File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,6 @@ def session_chrome_browser(request, _environment_check):
7070 Create a chrome browser.
7171 """
7272 headless = request .config .getoption ("--headless" )
73- mobile = request .config .getoption ("--mobile" )
7473
7574 playwright = sync_playwright ().start ()
7675
@@ -86,6 +85,7 @@ def session_chrome_browser(request, _environment_check):
8685 # Device emulation
8786 context_kwargs = {"viewport" : {"width" : 1920 , "height" : 1080 }}
8887
88+ mobile = request .config .getoption ("--mobile" )
8989 if mobile :
9090 context_kwargs = playwright .devices ["iPhone SE" ]
9191 ### user_agent = " ".join(
@@ -125,8 +125,9 @@ def fixture_lute_client(request, chromebrowser):
125125 Start the lute browser.
126126 """
127127 useport = request .config .getoption ("--port" )
128+ mobile = request .config .getoption ("--mobile" )
128129 url = f"http://localhost:{ useport } "
129- c = LuteTestClient (chromebrowser , url )
130+ c = LuteTestClient (chromebrowser , url , mobile )
130131 yield c
131132
132133
Original file line number Diff line number Diff line change @@ -28,7 +28,8 @@ class LuteTestClient: # pylint: disable=too-many-public-methods
2828 ################################3
2929 # Setup
3030
31- def __init__ (self , p , home ):
31+ def __init__ (self , p , home , has_touch = False ):
32+ self .has_touch = has_touch
3233 self .page = p
3334 self .home = home
3435 self .visit ("dev_api/wipe_db" )
@@ -400,11 +401,17 @@ def _get_element_for_word(self, word):
400401 elements = self .page .query_selector_all ('span[class*="textitem"]' )
401402 es = [e for e in elements if e .text_content () == word ]
402403 assert len (es ) > 0 , f"match for { word } "
404+ # print(f"got match for {word}", flush=True)
403405 return es [0 ]
404406
405407 def click_word (self , word ):
406408 "Click a word in the reading frame."
407- self ._get_element_for_word (word ).click ()
409+ el = self ._get_element_for_word (word )
410+ # print(f"got element {el}", flush=True)
411+ if self .has_touch :
412+ el .tap ()
413+ else :
414+ el .click ()
408415
409416 def shift_click_words (self , words ):
410417 "Shift-click words."
You can’t perform that action at this time.
0 commit comments