mcdcorp / opentest

Open source test automation tool for web applications, mobile apps and APIs
https://getopentest.org
MIT License
446 stars 107 forks source link

Deleting files from the actor/out/temp directory #637

Closed Keonik1 closed 7 months ago

Keonik1 commented 7 months ago

Hi, @adrianth

Is there a way to clear the actor/out/temp directory during the test (or during the start of the test or at the end, it doesn't matter)

Or maybe there is a way to clear downloaded files on remote selenium chrome node?

I searched a lot of things, but I could not find a solution, it seems like downloaded files should be deleted automatically at the end of the session, but this does not happen

Keonik1 commented 7 months ago

ok, i found solution... There is an undocumented file deletion function - org.getopentest.actions.files.DeleteFiles - link to source

3 arguments are accepted for input - 1 required (directory) and 2 more optional, but at least one of them must be present! Argument Description
directory The directory where you want to delete files
fileName The name of the file to delete
pattern Pattern of files to delete

If the fileName argument is specified, the pattern argument will be ignored

Example: Delete all files, like run-config, main-config and etc., inside /opt/opentest/actor/out/temp/downloads folder.

- description: Other - Delete all *-config from Downloads
  action: org.getopentest.actions.files.DeleteFiles
  args:
    directory: $tempDir + "/downloads"
    pattern: "*-config"