In both examples, لَمَّا means that the action had not occurred up to the stated point.
● وَلَمَّا يَدْخُلِ الْإِيمَانُ فِي قُلُوبِكُمْ
Faith had not yet entered your hearts. يَدْخُلِ is jussive; its connecting kasrah is heard before الْإِيمَانُ.
● أَمْ حَسِبْتُمْ أَنْ تَدْخُلُوا الْجَنَّةَ وَلَمَّا يَعْلَمِ اللَّهُ الَّذِينَ جَاهَدُوا مِنْكُمْ
In context: “and Allah had not yet made evident those among you who strove.” يَعْلَمِ is jussive; its connecting kasrah is heard before اللَّهُ.