When exactly the performance test stop?

At which point of time the test stops looking for re-paints, layout shifts and other changes, and test considered as finished?

The default settings are to stop after 2 seconds of no network activity after the onload has fired for the document.

There are several test options that can change those settings though (like “minimum test duration”).