def test_clonable_not_audit_related_objs_move_to_cloned_audit(
         self, create_and_clone_audit_w_params_to_update, selenium):
     """Check via UI that clonable not audit related objects
 Control, Program move to cloned Audit.
 Preconditions:
 -Execution and return of fixture
 'create_and_clone_audit_w_params_to_update'.
 """
     actual_audit = create_and_clone_audit_w_params_to_update[
         "actual_audit"]
     expected_control = (
         create_and_clone_audit_w_params_to_update["control"].repr_ui())
     expected_program = (
         create_and_clone_audit_w_params_to_update["program"].repr_ui())
     actual_controls = (webui_service.ControlsService(
         selenium).get_list_objs_from_tree_view(src_obj=actual_audit))
     actual_programs = (webui_service.ProgramsService(
         selenium).get_list_objs_from_tree_view(src_obj=actual_audit))
     # 'actual_controls, actual_programs': created_at, updated_at,
     #                                     custom_attributes (None)
     self.general_equal_assert([expected_control], actual_controls,
                               "review_status",
                               "review_status_display_name",
                               *Representation.tree_view_attrs_to_exclude)
     self.general_equal_assert([expected_program], actual_programs,
                               *Representation.tree_view_attrs_to_exclude)
Beispiel #2
0
 def test_info_tab_is_active_by_default(self, program, selenium):
     """Verifies Info tab is active by default."""
     # pylint: disable=invalid-name
     info_page = webui_service.ProgramsService(
         selenium).open_info_page_of_obj(program)
     active_tab_name = info_page.top_tabs.active_tab_name()
     assert active_tab_name == "Program Info"
Beispiel #3
0
 def test_clonable_not_audit_related_objs_move_to_cloned_audit(
         self, create_and_clone_audit, selenium):
     """Check via UI that clonable not audit related objects
 Control, Program move to cloned Audit.
 Preconditions:
 -Execution and return of fixture 'create_and_clone_audit'.
 """
     actual_audit = create_and_clone_audit["actual_audit"]
     # due to 'actual_control.custom_attributes = {None: None}'
     expected_control = (
         create_and_clone_audit["control"].repr_ui().update_attrs(
             custom_attributes={None: None}))
     # due to 'actual_program.manager = None',
     #        'actual_program.custom_attributes = {None: None}'
     expected_program = (
         create_and_clone_audit["program"].repr_ui().update_attrs(
             manager=None, custom_attributes={None: None}))
     actual_controls = (webui_service.ControlsService(
         selenium).get_list_objs_from_tree_view(src_obj=actual_audit))
     actual_programs = (webui_service.ProgramsService(
         selenium).get_list_objs_from_tree_view(src_obj=actual_audit))
     expected_objs = (string_utils.convert_list_elements_to_list(
         [[expected_control], [expected_program]]))
     actual_objs = (string_utils.convert_list_elements_to_list(
         [actual_controls, actual_programs]))
     assert expected_objs == actual_objs, (
         messages.AssertionMessages.format_err_msg_equal(
             expected_objs, actual_objs))
Beispiel #4
0
 def test_clonable_not_audit_related_objs_move_to_cloned_audit(
         self, create_and_clone_audit, selenium):
     """Check via UI that clonable not audit related objects
 Control, Program move to cloned Audit.
 Preconditions:
 -Execution and return of fixture 'create_and_clone_audit'.
 """
     actual_audit = create_and_clone_audit["actual_audit"]
     # due to 'actual_control.custom_attributes = {None: None}'
     expected_control = (
         create_and_clone_audit["control"].repr_ui().update_attrs(
             custom_attributes={None: None}))
     # due to 'actual_program.custom_attributes = {None: None}'
     expected_program = (
         create_and_clone_audit["program"].repr_ui().update_attrs(
             custom_attributes={None: None}))
     actual_controls = (webui_service.ControlsService(
         selenium).get_list_objs_from_tree_view(src_obj=actual_audit))
     actual_programs = (webui_service.ProgramsService(
         selenium).get_list_objs_from_tree_view(src_obj=actual_audit))
     assert [
         expected_control
     ] == actual_controls, (messages.AssertionMessages.format_err_msg_equal(
         [expected_control], actual_controls))
     self.extended_assert([expected_program], actual_programs,
                          "Issue in app GGRC-2381", "manager")
 def test_no_modal_for_program_control(self, login_as_creator, program,
                                       selenium):
     """Tests that 'New Control' modal is not opened
 when creator adds control to a program."""
     programs_service = webui_service.ProgramsService(selenium)
     programs_service.open_info_page_of_obj(program)
     obj_modal = programs_service.add_and_map_obj_widget(objects.CONTROLS)
     assert not obj_modal.is_present, ("'New Control' modal "
                                       "should not be present.")
Beispiel #6
0
 def test_edit_program(self, program, selenium):
     """Tests if data is saved after editing program info page edit modal."""
     new_title = "[EDITED] " + program.title
     program_service = webui_service.ProgramsService(selenium)
     program_service.edit_obj(program, title=new_title)
     actual_program = program_service.get_obj_from_info_page(program)
     program.update_attrs(title=new_title,
                          updated_at=rest_facade.get_obj(
                              actual_program).updated_at).repr_ui()
     self.general_equal_assert(program, actual_program)
Beispiel #7
0
 def test_obj_history_is_updated(self, program_with_approved_review,
                                 selenium):
   """Confirm Review history is updated in Change Log."""
   expected_entry = {
       "author": users.current_user().email,
       "Review State": {"original_value": element.ReviewStates.UNREVIEWED,
                        "new_value": element.ReviewStates.REVIEWED}}
   actual_entries = (webui_service.ProgramsService(selenium).
                     open_info_page_of_obj(program_with_approved_review).
                     get_changelog_entries())
   assert (expected_entry == actual_entries.pop(0) and
           expected_entry not in actual_entries)
Beispiel #8
0
 def test_create_program(self, selenium):
     """Tests program creation via UI."""
     program = entities_factory.ProgramsFactory().create()
     actual_program = webui_service.ProgramsService(
         selenium).create_obj_and_get_obj(program)
     rest_program = rest_facade.get_obj(actual_program)
     program.update_attrs(created_at=rest_program.created_at,
                          updated_at=rest_program.updated_at,
                          modified_by=users.current_user(),
                          slug=rest_program.slug,
                          url=rest_program.url).repr_ui()
     self.general_equal_assert(program, actual_program, "custom_attributes")
Beispiel #9
0
def check_mega_program_icon_in_unified_mapper(selenium, child_program,
                                              parent_program):
  """Performs assert that a mega program has a blue flag icon in unified mapper:
  open a parent program tab -> click the Map btn -> assert blue flag is visible
  """
  program_mapper = (webui_service.ProgramsService(
                    obj_name=objects.PROGRAM_PARENTS, driver=selenium)
                    .get_unified_mapper(child_program))
  parent_program_row = [program for program
                        in program_mapper.tree_view.tree_view_items()
                        if parent_program.title in program.text][0]
  assert parent_program_row.mega_program_icon.exists
Beispiel #10
0
 def test_reviewed_obj_buttons_state(self, program_with_approved_review,
                                     selenium):
   """Confirm 'Mark reviewed' button is hidden and 'Request review' button is
   visible after review approval."""
   info_page = webui_service.ProgramsService(selenium).open_info_page_of_obj(
       program_with_approved_review)
   expected_buttons_state = {"is_mark_reviewed_btn_visible": False,
                             "is_request_review_btn_visible": True}
   actual_buttons_state = copy.deepcopy(expected_buttons_state)
   actual_buttons_state["is_mark_reviewed_btn_visible"] = (
       info_page.mark_reviewed_btn.exists)
   actual_buttons_state["is_request_review_btn_visible"] = (
       info_page.request_review_btn.exists)
   assert actual_buttons_state == expected_buttons_state
Beispiel #11
0
 def test_permalink(self, selenium, program):
     """Verify url is copied to clipboard."""
     info_page = webui_service.ProgramsService(
         selenium).open_info_page_of_obj(program)
     info_page.open_info_3bbs().select_get_permalink()
     # test notification alert
     base.AnimatedComponent(selenium,
                            [locator.WidgetInfoProgram.ALERT_LINK_COPIED],
                            wait_until_visible=True)
     # test generated link
     # Doesn't work on Mac as Chromedriver / Devtools emulate keys on browser
     # level (Cmd + V works on OS level).
     # https://github.com/GoogleChrome/puppeteer/issues/1313
     # https://bugs.chromium.org/p/chromedriver/issues/detail?id=30
     info_page.open_info_3bbs().select_edit()
     modal = object_modal.get_modal_obj("program", selenium)
     modal.title_field.set(keys.Keys.CONTROL, "v")
     assert modal.title_field.value == program.url
Beispiel #12
0
 def test_clonable_not_audit_related_objs_move_to_cloned_audit(
         self, create_and_clone_audit, selenium):
     """Check via UI that clonable not audit related objects
 Control, Program move to cloned Audit.
 Preconditions:
 -Execution and return of fixture 'create_and_clone_audit'.
 """
     actual_audit = create_and_clone_audit["actual_audit"]
     expected_control = create_and_clone_audit["control"]
     expected_program = create_and_clone_audit["program"]
     actual_controls = (webui_service.ControlsService(
         selenium).get_list_objs_from_tree_view(src_obj=actual_audit))
     actual_programs = (webui_service.ProgramsService(
         selenium).get_list_objs_from_tree_view(src_obj=actual_audit))
     expected_objs = [[expected_control], [expected_program]]
     actual_objs = [actual_controls, actual_programs]
     assert expected_objs == actual_objs, (messages.ERR_MSG_FORMAT.format(
         expected_objs, actual_objs))
Beispiel #13
0
 def test_dashboard_gca(self, program, selenium):
     # pylint: disable=anomalous-backslash-in-string
     """Check Dashboard Tab is exist if 'Dashboard' GCA filled
 with right value. Possible values match to regexp r"^https?://[^\s]+$".
 Steps:
   - Create 'Dashboard' gcas for object.
   - Fill with values
   - Check if 'Dashboard' tab exist.
   - Navigate to 'Dashboard' tab.
   - Check only GCAs filled with right values displayed on the tab.
 """
     urls = [
         "https://gmail.by/", "https://www.google.com/",
         environment.app_url,
         StringMethods.random_string(), "ftp://something.com/"
     ]
     cads_rest_service = rest_service.CustomAttributeDefinitionsService()
     gca_defs = (cads_rest_service.create_dashboard_gcas(program.type,
                                                         count=len(urls)))
     program_rest_service = rest_service.ProgramsService()
     program_rest_service.update_obj(
         obj=program,
         custom_attributes=dict(
             zip([gca_def.id for gca_def in gca_defs], urls)))
     expected_dashboards_items = dict(
         zip([
             gca_def.title.replace(aliases.DASHBOARD + "_", "")
             for gca_def in gca_defs
         ], urls[:3]))
     programs_ui_service = webui_service.ProgramsService(selenium)
     is_dashboard_tab_exist = (
         programs_ui_service.is_dashboard_tab_exist(program))
     assert is_dashboard_tab_exist
     actual_dashboards_items = (
         programs_ui_service.get_items_from_dashboard_widget(program))
     assert expected_dashboards_items == actual_dashboards_items
     cads_rest_service.delete_objs(gca_defs)
Beispiel #14
0
def create_program(selenium):
  """Create program via UI"""
  return webui_service.ProgramsService(selenium).create_obj()