Skip to content
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

Merged
merged 5 commits into from
Sep 6, 2024
Merged

Conversation

seanmcguire12
Copy link
Contributor

Test will be much more useful after colour tagging branch is merged.

Comment on lines 19 to 29
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()
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 17 to 19
"page_to_text",
{"tag_text_elements": True, "keep_tags_showing": True},
["remove_tags"],
Copy link
Contributor

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

Copy link
Contributor

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

)

# run cleanup function(s)
for cleanup_function in cleanup_functions:
Copy link
Contributor

@asim-shrestha asim-shrestha Sep 6, 2024

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

Copy link
Contributor Author

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

@seanmcguire12 seanmcguire12 merged commit 4e94453 into main Sep 6, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants