This is a sort of chicken/egg type scenario in reality. On one hand, obviously you don't want to spend (presumably) millions to build something only to pull a "Hold onto yours butts" moment at the 11th hour and pray everything turns on for the first time, but also a lot of the time the ride profile, dispatch rate, and certain dialed in effects all combine to create a lot of moving parts that affect the final product too.
It really does vary wildly, but sometimes there is a sort of test profile that is used to prove functionality and allow for a longer test/adjust phase to tweak the non-ride components objectively. Think Spiderman with no motion profile built in, just purely riding between scenes, parking for the filmed bits, and then driving to the next scene. They will then go through a continue to build up the sequencing, adding more effects as they go, before compiling the final guest experience. There is a famous clip of an imagineer riding Dinosaur with a control box in their hand, programming the motion profile from inside the Time Rover itself that comes to mind. This type of process is really pretty spread out through the construction phase and right up until opening (sometimes even taking place during soft opens).
Now, obviously you can't just turn off gravity and take something like a coaster at a leisurely pace (for the most part) but this is where pullthroughs and envelope testing come in. Typically this takes place when the coaster is close to or completed as a closed circuit (which we can see them doing for some of the coasters here already) but sometimes for trickier spaces these take place pretty much from the jump.
Again, it really widely varies, but as we have seen with a lot of the more outdoor attractions at EU, sometimes the ride will be fully completed only to be immediately packaged back up to prevent damage from scenic work taking place, so a closed building does not necessarily a test-ready ride make. (excuse my wordy response, was up all night building theater sets and still haven't been to bed, lol)
EDIT: Welp, turns out I literally just typed everything Alicia was already responding with as I was typing it, haha, I should really check the whole "There have been more responses to this thread" tag before posting