"When" might be better than "~ and then...".
The last half of the sentence 不満たらたらの生徒の群れを抜け出して、ロンが、ハリーたちの方に走ってくる is the contents of what Harry saw, i.e., it means ハリーは、「不満たらたらの生徒の群れを抜け出して、ロンが、ハリーたちの方に走ってくる」のを見た. It's not a description from the viewpoint of the author (the viewpoint of god), but is still on Harry's viewpoint. (It's the same in my example, too. 彼女が待っていた is what the subject/speaker saw.)