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

Image Folder Cleanup #82

Merged
merged 6 commits into from
Feb 25, 2021
Merged

Image Folder Cleanup #82

merged 6 commits into from
Feb 25, 2021

Conversation

josev814
Copy link
Contributor

Adding an option to remove actual and/or diff folders

The folders are only removed when a test is green and when open eyes has the parameter cleanup passed to it with one of the supported options documented in the README.md file

If an entry isn't entered or it doesn't exist in the supported list, no files will be cleaned up.

This is to help with reducing the amount of images and folders that are generated.

We use this library in Azure Pipelines and having the option to remove actuals and diffs of image comparisons that have passed is beneficial in reducing the output size. Additionally, when tests are passed, it's not as much of a concern as when they fail. So only including the actuals and diffs when a test fails helps to reduce the result size as well.

The folders are only removed when a test is green and when open eyes has the parameter cleanup passed to it with one of the supported options documented in the README.md file
If any entry isn't entered or it doesn't exist in the supported list, no files will be cleaned up
@jessezach
Copy link
Owner

jessezach commented Feb 25, 2021

@josev814 Were you able to test this? Need to confirm that report generation does not break with these changes. Changes look good too except a minor comment.


# Keeping this arg to avoid exceptions for those who have added tolerance in the previous versions.
def __init__(self, tolerance=0):
self.ROBOT_LIBRARY_LISTENER = self
self.lib = 'none'

def open_eyes(self, lib='SeleniumLibrary', tolerance=0, template_id=''):
def open_eyes(self, lib='SeleniumLibrary', tolerance=0, cleanup=None, template_id=''):
Copy link
Owner

Choose a reason for hiding this comment

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

Could you keep cleanup argument as last? For those users writing template tests and passing template_id. This could break their tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the cleanup argument to the last position and updated the readme file

made pass_color and fail color class variables to quicker access/change

when running a test without the baseline image color was undefined.  fixed that issue by assigning color to self.pass_color

updated the README.md file to relect changes
@josev814
Copy link
Contributor Author

Were you able to test this? Need to confirm that report generation does not break with these changes.

@jz-jess yes, I tested the report to ensure that it didn't break it. The report had it already baked in to check the existence of the actual and diff folders/files. If the folder/files don't exist, it doesn't include those segments in the file. The main chart still shows the correct pass/fail percentage chart. The tests themselves will show the baseline image being green. The depending on the cleanup option will show nothing in the rest of the columns, the actuals image and tolerance rating or the diff but not the actuals image and tolerance rating.

Example report when using all_passed as the cleanup parameter
image

@jessezach jessezach merged commit 3851151 into jessezach:master Feb 25, 2021
jessezach added a commit that referenced this pull request Feb 25, 2021
jessezach added a commit that referenced this pull request Feb 25, 2021
jessezach added a commit that referenced this pull request Feb 25, 2021
jessezach added a commit that referenced this pull request Feb 25, 2021
* Revert "Revert "Image Folder Cleanup (#82)" (#84)"

This reverts commit decb253.

* Update setup.py
@josev814 josev814 deleted the diff_cleanup branch February 25, 2021 19:44
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.

None yet

2 participants