Refactor monitor tests to use a shared context
What does this MR do?
Refactors the Monitor specs to use shared_context, as a follow-up suggestion. This will help separate the test setup from the actual feature tests, highly improving readability.
Closes #222278 (closed)