Enhanced test case and fixed a bug in openPopup() if state was changed on same server roundtrip