-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add test to check whether tarsier artifacts still exist #147
Conversation
tests/test_artifact_removal.py
Outdated
file_name = data["file_name"] | ||
artifact_selectors = data["artifact_selectors"] | ||
|
||
# Construct the path to the HTML file | ||
html_file_path = os.path.abspath( | ||
os.path.join(os.path.dirname(__file__), "mock_html", file_name) | ||
) | ||
|
||
async with async_playwright() as p: | ||
browser = await p.chromium.launch(headless=True) | ||
page = await browser.new_page() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've written this stuff quite a bit. We can maybe wrap all of this stuff in a context manager function that takes filepath, and goes to the url and returns the page. Let's not do it in this PR but let's make a ticket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/test_artifact_removal.py
Outdated
"page_to_text", | ||
{"tag_text_elements": True, "keep_tags_showing": True}, | ||
["remove_tags"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to make this more concrete and avoid dealing with strings, you can make these lambda functions that take in tarsier/the page as a param, and then you can call the functions with the desired params directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also avoids this get attribute stuff
tests/test_artifact_removal.py
Outdated
) | ||
|
||
# run cleanup function(s) | ||
for cleanup_function in cleanup_functions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only one clean up function, should we remove this loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be more once we merge colour tagging
Test will be much more useful after colour tagging branch is merged.