Refactor key list page testing code