def wait_for_version_autoapproval()

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


    def wait_for_version_autoapproval(self, value):
        """Method that verifies if auto-approval occurs within a set time"""
        timeout_start = time.time()
        # auto-approvals should normally take ~5 minutes;
        # set a loop to verify if approval occurs within this interval
        while time.time() < timeout_start + 420:
            # refresh the page to check if the status has changed
            self.driver.refresh()
            if value not in self.version_approval_status[0].text:
                # wait 30 seconds before we refresh again
                time.sleep(30)
            # break the loop if the status changed to the expected value within set time
            else:
                break
        # if auto-approval took longer than normal, we want to fail the test and capture the final status
        else:
            pytest.fail(
                f"Autoapproval took longer than normal; "
                f'Addon final status was "{self.version_approval_status[0].text}" instead of "{value}"'
            )