B737 Undifferentiated or Other Model
Flight Crew Air Transport Pilot (ATP); Flight Crew Instrument; Flight Crew Multiengine
Flight Crew Last 90 Days 180
Communication Breakdown; Situational Awareness
Deviation / Discrepancy - Procedural Published Material / Policy
General Maintenance Action
Human Factors; Procedure
We arrived at ZZZ and were advised that we had been swapped to an aircraft that just finished maintenance. We went through the terminal to the new gate and after ID's were checked; proceeded to the airplane. The door was closed which is normal for a significant amount of first departures so I looked through the viewing port verified no flag was present and opened the door. After opening the door a mechanic that was inside the airplane asked why I opened it they were running tests including something with the pressurization and that I could have been hurt. I asked him why he didn't put the flag over the window and his response was that isn't their procedure. I had no way to see inside the flight deck and had no reason to believe someone was on the aircraft because I was told maintenance was finished with it by the agents.
Flight Crew arriving at airplane parked at gate; was not informed that maintenance was being accomplished.