def check_newsletter_signup_email()

in pages/desktop/developers/devhub_home.py [0:0]


    def check_newsletter_signup_email(self, email):
        retry = 0
        while retry < 10:
            # verify that a response is available and get the email subject
            request = requests.get(f"https://restmail.net/mail/{email}", timeout=10)
            response = request.json()
            if response:
                confirmation = [key["subject"] for key in response]
                return confirmation
            elif not response:
                print("Confirmation email not received yet")
                # fail if we retired 10 times and there was no email received
                if retry == 9:
                    pytest.fail("Newsletter confirmation email was not sent")
                # pause between subsequent requests to give more time to the email to be sent
                time.sleep(2)
                retry += 1
        return self