Ejemplo n.º 1
0
 def validate_element_translation(self, field_type, element, language, key):
     actual_translation = self.get_element_translation(field_type, element)
     expected_translation = self.get_translation_from_json(language, key)
     assertion_message = f"{FieldType[field_type].name} element translation is not correct: " \
                         f" should be {expected_translation} but is {actual_translation}"
     add_to_shared_dict("assertion_message", assertion_message)
     assert actual_translation in expected_translation, assertion_message
 def validate_no_iframe_field_validation_message(self, field_type,
                                                 expected_message):
     actual_message = self.get_field_validation_message(field_type)
     assertion_message = f'{FieldType[field_type].name} field validation message is not correct, ' \
                         f'should be: "{expected_message}" but is: "{actual_message}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_message in actual_message, assertion_message
Ejemplo n.º 3
0
 def validate_number_of_requests_with_fraudcontroltransactionid_flag(self, request_type,
                                                                     expected_number_of_requests):
     actual_number_of_requests = get_number_of_requests_with_fraudcontroltransactionid_flag(request_type)
     assertion_message = f'Number of {request_type} requests or request data are not correct, ' \
                         f'should be: "{expected_number_of_requests}" but is: "{actual_number_of_requests}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_number_of_requests == actual_number_of_requests, assertion_message
 def validate_data_on_animated_card(self, expected_data, field_type,
                                    card_type):
     actual_data_on_animated_card = self.get_data_from_animated_card(
         field_type, card_type)
     assertion_message = f'Data on animated card is not correct, should be: ' \
                         f'"{expected_data}" but is: "{actual_data_on_animated_card}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_data in actual_data_on_animated_card, assertion_message
Ejemplo n.º 5
0
 def validate_if_url_contains_info_about_payment(self, expected_url):
     self._executor.wait_for_javascript()
     actual_url = self._executor.get_page_url()
     if expected_url not in actual_url:
         time.sleep(3)
         actual_url = self._executor.get_page_url()
     assertion_message = f'Url is not correct, should be: "{expected_url}" but is: "{actual_url}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_url in actual_url, assertion_message
 def validate_credit_card_icon(self, expected_card_icon,
                               is_field_in_iframe):
     if is_field_in_iframe:
         self._action.switch_to_iframe(FieldType.ANIMATED_CARD.value)
     actual_credit_card_icon = self.get_card_type_icon_from_animated_card()
     assertion_message = f'Credit card icon is not correct, ' \
                         f'should be: "{expected_card_icon}" but is: "{actual_credit_card_icon}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_card_icon in actual_credit_card_icon, assertion_message
 def validate_animated_card_element_translation(self, element, language,
                                                key, is_field_in_iframe):
     actual_translation = self.get_animated_card_label_translation(
         element, is_field_in_iframe)
     expected_translation = self.get_translation_from_json(language, key)
     if "safari" not in ioc_config.CONFIG.resolve('driver').browser:
         expected_translation = expected_translation.upper()
     assertion_message = f"Translation is not correct: should be {expected_translation} but is {actual_translation}"
     add_to_shared_dict("assertion_message", assertion_message)
     assert actual_translation in expected_translation, assertion_message
Ejemplo n.º 8
0
 def validate_payment_status_message(self, expected_message):
     if CONFIGURATION.REMOTE_DEVICE is not None:
         self.scroll_to_top()
     actual_message = self.get_payment_status_message()
     if len(actual_message) == 0:
         time.sleep(2)
         actual_message = self.get_payment_status_message()
     assertion_message = f'Payment status is not correct, should be: "{expected_message}" but is: "{actual_message}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_message in actual_message, assertion_message
Ejemplo n.º 9
0
 def validate_if_callback_popup_is_displayed(self, callback_popup):
     is_displayed = False
     if 'success' in callback_popup:
         is_displayed = self._action.is_element_displayed(PaymentMethodsLocators.callback_success_popup)
     elif 'error' in callback_popup:
         is_displayed = self._action.is_element_displayed(PaymentMethodsLocators.callback_error_popup)
     elif 'cancel' in callback_popup:
         is_displayed = self._action.is_element_displayed(PaymentMethodsLocators.callback_cancel_popup)
     assertion_message = f'{callback_popup} callback popup is not displayed but should be'
     add_to_shared_dict("assertion_message", assertion_message)
     assert is_displayed is True, assertion_message
 def validate_if_animated_card_is_flipped(self, card_type,
                                          is_field_in_iframe):
     # Disabled checking flipping card for safari because switch_to_iframe method make card is back to the original
     # position. This case is checked in animated card repo (without iframe)
     if is_field_in_iframe and 'Safari' in CONFIGURATION.REMOTE_BROWSER:
         pass
     else:
         animated_card_side = self._action.get_element_attribute(
             AnimatedCardLocators.animated_card, "class")
         if card_type == "AMEX":
             assertion_message = f'Animated card is flipped for AMEX but should not be'
             add_to_shared_dict("assertion_message", assertion_message)
             assert "flip-card" not in animated_card_side, assertion_message
         else:
             assertion_message = f'Animated card is not flipped but should be'
             add_to_shared_dict("assertion_message", assertion_message)
             assert "flip-card" in animated_card_side, assertion_message
Ejemplo n.º 11
0
 def validate_number_of_thirdparty_requests(self, request_type, walletsource, expected_number_of_requests):
     actual_number_of_requests = get_number_of_thirdparty_requests(request_type, walletsource)
     assertion_message = f'Number of request with {request_type} is not correct, ' \
                         f'should be: "{expected_number_of_requests}" but is: "{actual_number_of_requests}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_number_of_requests == actual_number_of_requests, assertion_message
Ejemplo n.º 12
0
 def validate_css_style(self, field_type, property, expected_style):
     actual_css_style = self.get_field_css_style(field_type, property)
     assertion_message = f'{FieldType[field_type].name} style is not correct, ' \
                         f'should be  "{expected_style}" but is "{actual_css_style}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_style in actual_css_style, assertion_message
Ejemplo n.º 13
0
 def validate_if_field_is_highlighted(self, field_type):
     attribute_value = self.get_element_attribute(field_type, "class")
     assertion_message = f'{FieldType[field_type].name} field is not highlighted but should be'
     add_to_shared_dict("assertion_message", assertion_message)
     assert "error" in attribute_value, assertion_message
Ejemplo n.º 14
0
 def validate_placeholder(self, field_type, expected_placeholder):
     actual_placeholder = self.get_element_attribute(field_type, "placeholder")
     assertion_message = f'Placeholder for {FieldType[field_type].name} field is not correct, should be {expected_placeholder}' \
                         f'but is {actual_placeholder}'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_placeholder in actual_placeholder, assertion_message
 def validate_if_field_is_disabled(self, field_type):
     is_enabled = self.is_field_enabled(field_type)
     assertion_message = f'{FieldType[field_type].name} field is not disabled but should be'
     add_to_shared_dict("assertion_message", assertion_message)
     assert is_enabled is False, assertion_message
 def validate_if_no_iframe_field_is_highlighted(self, field_type):
     is_highlighted = self.is_field_highlighted(field_type)
     assertion_message = f'{FieldType[field_type].name} field is not highlighted but should be'
     add_to_shared_dict("assertion_message", assertion_message)
     assert is_highlighted is True, assertion_message
Ejemplo n.º 17
0
 def validate_credit_card_icon_in_input_field(self, expected_card_icon):
     actual_credit_card_icon = self.get_card_type_icon_from_input_field()
     assertion_message = f'Credit card icon is not correct, ' \
                         f'should be: "{expected_card_icon}" but is: "{actual_credit_card_icon}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_card_icon in actual_credit_card_icon, assertion_message
Ejemplo n.º 18
0
 def validate_updated_jwt_in_request(self, request_type, update_jwt, expected_number_of_requests):
     actual_number_of_requests = get_number_of_requests_with_updated_jwt(request_type, update_jwt)
     assertion_message = f'Number of {request_type} with updated jwt is not correct, ' \
                         f'should be: "{expected_number_of_requests}" but is: "{actual_number_of_requests}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_number_of_requests == actual_number_of_requests, assertion_message
Ejemplo n.º 19
0
 def validate_number_of_requests_without_data(self, request_type, expected_number_of_requests):
     actual_number_of_requests = get_number_of_requests_without_data(request_type)
     assertion_message = f'Number of {request_type} requests is not correct, ' \
                         f'should be: "{expected_number_of_requests}" but is: "{actual_number_of_requests}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_number_of_requests == actual_number_of_requests, assertion_message
Ejemplo n.º 20
0
 def validate_number_of_requests(self, request_type, pan, expiry_date, cvv, expected_number_of_requests):
     actual_number_of_requests = get_number_of_requests(request_type, pan, expiry_date, cvv)
     assertion_message = f'Number of request with "{request_type}" is not correct, ' \
                         f'should be: "{expected_number_of_requests}" but is: "{actual_number_of_requests}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_number_of_requests == actual_number_of_requests, assertion_message
Ejemplo n.º 21
0
 def validate_notification_frame_color(self, color):
     actual_color = self.get_color_of_notification_frame()
     assertion_message = f'Notification frame color is not correct, should be: "{color}" but is: "{actual_color}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert color in actual_color, assertion_message
Ejemplo n.º 22
0
 def validate_number_of_wallet_verify_requests(self, url, expected_number_of_requests):
     actual_number_of_requests = get_number_of_wallet_verify_requests(url)
     assertion_message = f'Number of {url} requests is not correct, ' \
                         f'should be: "{expected_number_of_requests}" but is: "{actual_number_of_requests}"'
     add_to_shared_dict("assertion_message", assertion_message)
     assert expected_number_of_requests == actual_number_of_requests, assertion_message