def test(self, grid: str, device: Device) -> None: chrome: Remote = Chrome(grid) registration = RegisterAccountPage(chrome) random_email = EmailsGeneration() registration.open(device) registration.fill_personal_details( "Jon", "Doe", random_email.creating_full_email(), "123456" ) registration.fill_password("supersecret") registration.press_continue() assert RegistrationSuccessPage(chrome).loaded()
class ForgotPassword(Testcase): email = EmailsGeneration().creating_full_email() password = "******" @setup def creating_account(self, device: Device) -> None: assert "success" in UserRegistration( Identity("Test", "Test", "+380957772255"), Credentials(self.email, self.password, "0") ).registration_response(device) @test def test_forgot_password_for_known_user(self, device: Device) -> None: parameters = {"email": self.email} urllib3.disable_warnings() request = requests.post( f"https://{device.connections.main.ip}/index.php?route=account/forgotten", parameters, verify=False, ) assert "An email with a confirmation link has been sent your email address." in request.text @test def test_forgot_password_for_unknown_user(self, device: Device) -> None: parameters = {"email": "*****@*****.**"} urllib3.disable_warnings() request = requests.post( f"https://{device.connections.main.ip}/index.php?route=account/forgotten", parameters, verify=False, ) assert "The E-Mail Address was not found in our records, please try again!" in request.text
class ForgotPassword(Testcase): email = EmailsGeneration().creating_full_email() password = "******" @setup def create_account(self, device: Device) -> None: assert "success" in UserRegistration( Identity("Test", "test", "+38090890812"), Credentials(self.email, self.password, "0")).registration_response(device) @test def test_forgot_password(self, grid: str, device: Device) -> None: chrome: Remote = Chrome(grid) forgot_password = ForgotPasswordPage(chrome) forgot_password.open(device) forgot_password.fill_email(self.email) forgot_password.press_continue_button() assert ConfirmationMessage(chrome).loaded() @test def test_forgot_password_with_not_existing_email(self, grid: str, device: Device) -> None: chrome: Remote = Chrome(grid) forgot_password = ForgotPasswordPage(chrome) forgot_password.open(device) forgot_password.fill_email("*****@*****.**") forgot_password.press_continue_button() assert not ConfirmationMessage(chrome).loaded()
class Login(Testcase): email = EmailsGeneration().creating_full_email() password = "******" @setup def create_account(self, device: Device) -> None: assert "success" in UserRegistration( Identity("Alex", "Ivanov", "+38090890812"), Credentials(self.email, self.password, "0")).registration_response(device) @test def login_exists_credentials(self, device: Device) -> None: assert ("Edit Account" in requests.post( f"https://{device.connections.main.ip}/index.php?route=account/login", { "email": self.email, "password": self.password }, verify=False, ).text) @test def login_empty_email_parameter(self, device: Device) -> None: assert ("Edit Account" not in requests.post( f"https://{device.connections.main.ip}/index.php?route=account/login", { "email": "", "password": self.password }, verify=False, ).text) @test def login_empty_password_parameter(self, device: Device) -> None: assert ("Edit Account" not in requests.post( f"https://{device.connections.main.ip}/index.php?route=account/login", { "email": self.email, "password": "" }, verify=False, ).text)
class Login(Testcase): email = EmailsGeneration().creating_full_email() password = "******" @setup def create_account(self, device: Device) -> None: assert "success" in UserRegistration( Identity("Petr", "Petrov", "+38090890812"), Credentials(self.email, self.password, "0") ).registration_response(device) @test def login_exists_credentials(self, grid: str, device: Device) -> None: chrome: Remote = Chrome(grid) login = LoginPage(chrome) login.open(device) login.fill_credentials(self.email, self.password) login.press_login_button() assert AccountPage(chrome).loaded() @test def login_nonexistent_email(self, grid: str, device: Device) -> None: chrome: Remote = Chrome(grid) login = LoginPage(chrome) login.open(device) login.fill_credentials("*****@*****.**", self.password) login.press_login_button() assert not AccountPage(chrome).loaded() @test def login_nonexistent_password(self, grid: str, device: Device) -> None: chrome: Remote = Chrome(grid) login = LoginPage(chrome) login.open(device) login.fill_credentials(self.email, "12345789") login.press_login_button() assert not AccountPage(chrome).loaded()
def setup(self) -> None: self.email = EmailsGeneration().creating_full_email()
def test_special_symbols_are_absent(self) -> None: special_symbols = list(str("!$#%^&*()+=?/," "№;:?*[]{}|")) for each_symbol in special_symbols: assert each_symbol is not EmailsGeneration().creating_full_email()
def test_second_part_of_email(self) -> None: assert len( (EmailsGeneration().creating_full_email().split(".")).pop(1)) <= 4
def test_length_first_part_of_email(self) -> None: assert len( (EmailsGeneration().creating_full_email().split("@")).pop(0)) == 7
def test_email_contains_dog(self) -> None: assert (EmailsGeneration().creating_full_email().count("@")) == 1
def test_emails_pattern(self) -> None: random_email = EmailsGeneration().creating_full_email() assert random_email == ((re.findall(r"\w{1,7}@\w+.\w+", random_email)).pop(0))
def test_creating_emails_is_string(self) -> None: assert isinstance(EmailsGeneration().creating_full_email(), str)
def registration_positive_test(self, device: Device) -> None: assert "success" in UserRegistration( Identity("Alex", "Ivanov", "+38090890812"), Credentials(EmailsGeneration().creating_full_email(), "12345678", "0"), ).registration_response(device)