Runtime error when running tests: TypeError: Cannot read properties of null (reading ‘errorMessage’)

How do you deal with Runtime error when running tests: TypeError: Cannot read properties of null (reading ‘errorMessage’) in your Power Apps Test Studio?

Automated tests

Automated testing in Power Apps can reduce the time to test your app dramatically.

First of all the automated testing in Power Apps is still in preview. About 2 years ago I wrote a post about it, and as the automate testing depends on a preview feature being enabled in your app, we would have to take care when enabling this feature.

Today when I used the automated testing to just confirm that nothing broke as I made some updates, I found that even though my app was working I would get the testing tool to give me a failure.

Cannot read properties of null
Cannot read properties of null

This error isn’t very clear until you analyze the problem.

One of my steps is failing.

Identifying the issue

The problem here is that I have a Label, in a Gallery. However a label in a gallery can also work. In this case however I have a Label that sits inside a container.

Runtime error when running tests: TypeError: Cannot read properties of null (reading 'errorMessage')
Runtime error when running tests: TypeError: Cannot read properties of null (reading 'errorMessage') 1

The above Select however is trying to get the Label from the container. And even though the recording generated the above code. It ignores the container shell that sites around the Label control.

Fixing the issue

If we now try and fix this issue in the Test Studio, we will find out quite quickly that there isn’t a way to get to the Label2 or at least I haven’t found it.

Then I made a slight adjustment to my app. Rather than using a container I used a group instead. Groups and containers aren’t exactly the same but they are sometimes very similar.

Issue fixed
Issue fixed

And now my automated test runs successfully.

FAQs

What are the known limitations of Power Apps Test Studio?

Some of the limitations in Power Apps test Studio are:

  • Co-Authoring is not supported
  • Components are not supported
  • Nested Galleries
  • Media controls
  • Git version control

Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Related Posts

One thought on “Runtime error when running tests: TypeError: Cannot read properties of null (reading ‘errorMessage’)

  1. That is definitely a way around it but that really should be fixed on Microsoftโ€™s side, especially now that they are pushing everything to modern and containers

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.