Skip to content

Auto Cleanup Unused Files - Deletes too many files if you have both component and e2e tests #178

Open
@stocksr

Description

@stocksr

Describe the bug
Auto Cleanup Unused Files - Does not work if you have both component and e2e tests in the same project
pluginVisualRegressionCleanupUnusedImages=true deletes the files from the other test type.

Activity

added a commit that references this issue on Nov 12, 2022
a83addb
self-assigned this
on Nov 12, 2022
FRSgit

FRSgit commented on Nov 12, 2022

@FRSgit
Member

Hey @stocksr!

Thanks for filing issue - I forgot about this case completely when creating autocleanup feature 😞
I believe PR #181 should resolve this bug, can I ask for a quick review? 😄
Also, I've published content of this PR under version3.1.6-alpha.0, you can safely test it on your machine 🎉

stocksr

stocksr commented on Nov 17, 2022

@stocksr
Author

hi @FRSgit ,

sorry for the delay - been busy on another project just got back to this
I have tested this and think that it is still broken

my test process was

  1. install this plugin @3.1.6-alpha.0,
  2. run with pluginVisualRegressionUpdateImages=true
  3. Commit all the image files to git
  4. Create some misnamed copies of some of the real image files (at least one from each test type) - to simulate abandoned images
  5. run with pluginVisualRegressionCleanupUnusedImages=true
  6. Review the git diff

what I am seeing

  1. The images from the other test type and the test copies remain on disk (this is progress :-) )
  2. All the images from the current test type are deleted - even the good ones
  3. One png file from my project is deleted (this is not the only png file in the project and it is always the same one)
    assets.zip this file contains 2 example pngs that have nothing to do with this plugin (the one called transparent-pixel.png is being deleted - the one called bg.png is not)
stocksr

stocksr commented on Nov 21, 2022

@stocksr
Author

hi @FRSgit ,I was just testing #184 - and it occured to me that these issues might be related, and as that one is now fixed this it might solve this one as well - if you could re-base #181 and publish a new alpha version I am happy to run my tests again.

added a commit that references this issue on Nov 21, 2022
c3b44a4
FRSgit

FRSgit commented on Nov 21, 2022

@FRSgit
Member

Hi @stocksr, I've just rebased #181 and released it again 🎉 Please give me a sign after you give it a spin!

stocksr

stocksr commented on Nov 22, 2022

@stocksr
Author

Hi @FRSgit, so the update has fixed some of the issues (specifically point 3 from my last report)

The current build is correctly targeting the correct images to clean up -if I run an e2e test it is not deleting the component test images anymore however it is deleting all the images from that test type.

I was watching carefully as it ran and spotted that it was deleting images before the test run completed so I am now wondering if the cleanup is running after each test file - rather than at the end of the entire test run.

FRSgit

FRSgit commented on Nov 30, 2022

@FRSgit
Member

Hey @stocksr!

Just wanted to give you an update: you're right, I was running cleanup action within after() instead of using after:run hook.
I'm working currently on a new implementation of autocleanup action that will:

  • run only in headless mode (from Cypress 10 there is no "run all" button in headed mode, so I think there is no real use case for cleanup action here),
  • utilize after:run API to run only once, at the end of the test suite.

I'll ping you whenever I release new alpha version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @stocksr@FRSgit

    Issue actions

      Auto Cleanup Unused Files - Deletes too many files if you have both component and e2e tests · Issue #178 · FRSOURCE/cypress-plugin-visual-regression-diff