The current state of 2-factor authentication (2FA) poses a challenge for testing applications behind a login flow, particularly when using time-based one-time passwords (TOTP). However, authenticator apps and TOTP flows can be automated using browser automation tools like Playwright. By leveraging the OTP Auth library to generate passcodes, developers can create scripts that log into 2FA-secured accounts, such as GitHub, without relying on manual input or verification steps. The process involves generating a secret from the QR code, pairing it with the current time to produce a one-time password, and filling in the corresponding input field to complete the login flow. With Playwright's auto-waiting feature and the OTP Auth library, developers can automate this process, ensuring their applications are secure and reliable.