How to take screenshot when test fail?

I have a GitHub action that runs e2e tests with Appium for my iOS and Android app.

When it fails in the CI to found a selected element, and not locally, I have no idea why it fails.

How can I make a screenshot before closing the device ?

Our project is in TS similar to

didn’t try it myself. I record the whole test using appium screen recorder.
but, try to look at this:

as well, you can also try to get page source from the driver(driver.getPageSource()) which my benefit when encountering into a problem.

I would recommend to record the test since it is hard to know the exact moment to take a snapshot because there might have been previous actions that you would like to know about in addition to a screenshot only on failure.

Hi @ido_oserovitz and thanks for your reply.

We are now able to take screenshots within our github action and it is blank, any clue why ?

I filled a bug report here :