Skip to content

Commit 3f0fad9

Browse files
committed
wip timing
1 parent ed4ed20 commit 3f0fad9

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

tests/acceptance/lute_test_client.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import time
1818
import json
1919
import requests
20-
from playwright.sync_api import Keyboard, Mouse
20+
from playwright.sync_api import Keyboard, Mouse, expect
2121

2222

2323
class LuteTestClient: # pylint: disable=too-many-public-methods
@@ -159,9 +159,11 @@ def get_book_table_content(self):
159159
# - "last opened" date is a hassle to check
160160
# - "actions" is just "..."
161161
ret = "; ".join(rowtext[:-2]).strip()
162+
# Hacky cleanup ok for tests.
163+
ret = ret.replace("\u200B", "").replace("\n", "").replace("\\n", "")
162164
content.append(ret)
163165

164-
return "\n".join(content)
166+
return "\n".join([c for c in content if c.strip() != ""]).strip()
165167

166168
def get_book_page_start_dates(self):
167169
"get content from sql check"
@@ -219,9 +221,17 @@ def _fill_tagify_field(self, frame, fieldid, text):
219221
if span is None:
220222
raise RuntimeError(f"unable to find {fieldid}")
221223

222-
# Focus the span and type text
224+
# Focus the span and type text. Various timing hacks added to
225+
# ensure that tagify wires things up correctly in response to
226+
# clicks ... hacky, but fixed errors during ci runs.
227+
expect(span).to_be_visible()
228+
expect(span).to_be_enabled()
223229
span.click()
224-
span.type(text)
230+
time.sleep(0.1)
231+
expect(span).to_be_focused()
232+
time.sleep(0.1)
233+
span.fill(text)
234+
time.sleep(0.1)
225235
span.press("Enter")
226236
time.sleep(0.3)
227237

@@ -320,6 +330,7 @@ def get_term_table_content(self):
320330

321331
def _delimited_tags(td):
322332
"""Get the cleaned tags."""
333+
# print(f"GOT RAW TAGS = {td.inner_text()}", flush=True)
323334
tags = [t.strip() for t in td.inner_text().split("\n")]
324335
tags = [t for t in tags if t not in ["", "\u200B"]]
325336
return ", ".join(tags)
@@ -353,11 +364,17 @@ def _delimited_tags(td):
353364
)
354365
rowtext.append(selected_text)
355366

367+
# Hacky cleanup, ok for tests.
368+
# print(f"RAW ROWTEXT = {rowtext}", flush=True)
369+
rowtext = [
370+
r.replace("\u200B", "").replace("\n", "").replace("\\n", "")
371+
for r in rowtext
372+
]
356373
rowval = "; ".join(rowtext).strip()
357-
cleaned_rowval = rowval.replace("\u200B", "")
358-
rowstring.append(cleaned_rowval)
374+
rowstring.append(rowval)
359375

360-
return "\n".join(rowstring)
376+
# print(f"RAW ROWSTRINGs = {rowstring}", flush=True)
377+
return "\n".join([r for r in rowstring if r.strip() != ""]).strip()
361378

362379
################################3
363380
# Reading/rendering

0 commit comments

Comments
 (0)