Screenshots are not being saved, even though the CI says they are

I’m not often trying forums to get unstuck, but this has been blocking me for several days now.

My CI pipeline is failing and I’m trying to get screenshots to figure out why. Running the same tests locally passes without issues, so it must be something on the Github actions agents that is unexpected.

It claims to be saving the screenshots, but when I ask for the file listing, they are not there.

What am I missing here. Why are those files not there, so I can check them out and figure out why the CI is failing.

Any hints appreciated.

Each Step in a Workflow runs independently of any other Step: the default working directory for each Step is the Workspace root ($GITHUB_WORKSPACE). I can see from your behat Step that you first change to the tests directory and then in the behat log we can see that these screenshots are created in a relative path (output/screenshots) which I think is…


The Display output step changes to GITHUB_WORKSPACE and then lists files in output so you’re effectively doing this:

find $GITHUB_WORKSPACE/output -type f

These paths don’t match. I think you can validate this with an additional Step:

- working-directory: ./tests/output/screenshots
  run: find . -type f

I think the reason you’re seeing an output directory exist (without screenshots) is that in the configuration for behat you’re using multiple plugins with similar paths: two paths are being created, and you’re looking in the wrong one.

As an aside, you can avoid the need for s3 by using Workflow artifacts, e.g:

- name: Upload tests output
  if: always()
  uses: actions/upload-artifact@v2
      path: "./tests/output"
      name: "results"

And you can use artifacts to debug these sort of issues with a Runner Workspace more easily. For example:

- name: Upload runner Workspace as artifact
  if: always()
  uses: actions/upload-artifact@v2
      path: "."
      name: "workspace"

Let me know if that helps or if any further pointers are needed :slight_smile:

1 Like

Thanks. Yes, I’m aware of artifacts, but I haven’t figured out where to download them. I thought they were to share between jobs. In this case, I need the screenshot to figure out why the Behat test is failing. It passes without issues when I run it locally, so it’s something on the runner that is not as expected.

Ok, I did a full file listing and found the screenshots:

Thanks for your help.

1 Like

Ah, I now also found where the artifacts go. Downloading workflow artifacts - GitHub Docs

That’s indeed much easier. Thanks for the pointer.

1 Like