Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions newsfragments/1486.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Make ``upload_vumark_template`` return the ID of the target it uploaded.
It now waits for VWS to finish processing the target, which takes longer
than waiting for the target to appear in the targets table.
21 changes: 19 additions & 2 deletions src/vws_web_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,14 @@ def upload_vumark_template(
svg_file_path: Path,
template_name: str,
width: float,
) -> None:
"""Upload a VuMark SVG template to a VuMark database."""
) -> str:
"""Upload a VuMark SVG template to a VuMark database.

Returns:
The ID of the uploaded target. Waiting for the ID means waiting
for VWS to finish processing the target, which takes longer than
waiting for the target to appear in the targets table.
"""
navigate_to_database(driver=driver, database_name=database_name)

thirty_second_wait = WebDriverWait(
Expand Down Expand Up @@ -675,6 +681,17 @@ def upload_vumark_template(
),
)

wait_for_vumark_target_link(
driver=driver,
database_name=database_name,
target_name=template_name,
)
return get_vumark_target_id(
driver=driver,
database_name=database_name,
target_name=template_name,
)


@beartype
def _xpath_literal(
Expand Down
5 changes: 4 additions & 1 deletion tests/test_create_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def test_upload_vumark_template(
assert test_file_path is not None
svg_path = test_file_path.parent / "fixtures" / "vumark_template.svg"
template_name = f"template-{random_str}"
vws_web_tools.upload_vumark_template(
target_id = vws_web_tools.upload_vumark_template(
driver=chrome_driver,
database_name=database_name,
svg_file_path=svg_path,
Expand All @@ -358,6 +358,9 @@ def test_upload_vumark_template(
)

assert template_name in chrome_driver.page_source
expected_target_id_length = 32
assert len(target_id) == expected_target_id_length
assert target_id.isalnum()


def test_upload_vumark_template_cli(
Expand Down