prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Unexpected popup in server_roles fixture
  The server_roles fixture attempts to explicitly navigate to the current server's settings page before clicking any checkboxen, but the call to do that (`settings_pg.click_on_current_server_tree_node()`) occasionally fails because a popup appears. We'll need to make sure the popup can be safely ignored, and conditionally ignore it if it appears.
  
  Until this is fixed, a workaround is to assume that navigation with the `cnf_configuration_pg` fixture will land on the current server settings page:
  
  ``` diff
  diff --git a/fixtures/server_roles.py b/fixtures/server_roles.py
  index dfcb574..2b99836 100644
  --- a/fixtures/server_roles.py
  +++ b/fixtures/server_roles.py
  @@ -94,7 +94,9 @@ def server_roles(fixtureconf, cfme_data, cnf_configuration_pg):
  
       # Nav to the settings tab
       settings_pg = cnf_configuration_pg.click_on_settings()
  -    server_settings_pg = settings_pg.click_on_current_server_tree_node()
  +    #server_settings_pg = settings_pg.click_on_current_server_tree_node()
  +    from pages.configuration_subpages.settings_subpages.server_settings import ServerSettings
  +    server_settings_pg = ServerSettings(settings_pg.testsetup)
       # sst is a configuration_subpages.settings_subpages.server_settings_subpages.
       #   server_settings_tab.ServerSettingsTab
       sst = server_settings_pg.click_on_server_tab()
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `fixtures/server_roles.py`
  Content:
  ```
  1 import logging
  2 
  3 import pytest
  4 from unittestzero import Assert
  5 
  6 logger = logging.getLogger(__name__)
  7 
  8 default_roles = (
  9     'database_operations',
  10     'event',
  11     'ems_inventory',
  12     'ems_operations',
  13     'reporting',
  14     'scheduler',
  15     'smartstate',
  16     'user_interface',
  17     'web_services',
  18 )
  19 
  20 @pytest.fixture
  21 def server_roles(fixtureconf, cfme_data, cnf_configuration_pg):
  22     """Set the server roles based on a list of roles attached to the test using this fixture
  23 
  24     Usage examples:
  25 
  26         Pass the desired roles in to the "server_roles_set" decorator:
  27 
  28         _roles = ('database_operations', 'event', 'user_interface', 'web_services')
  29 
  30         @pytest.mark.fixtureconf(server_roles=_roles)
  31         def test_appliance_roles(server_roles):
  32             assert len(server_roles) == 4
  33 
  34         Roles can be pulled from the cfme_data fixture using yaml selectors,
  35         which will do a 'set' with the list of roles found at the target path:
  36 
  37         @pytest.mark.fixtureconf(server_roles_cfmedata=('level1', 'sublevel2'))
  38         def test_appliance_roles(server_roles):
  39             assert len(server_roles) == 3
  40 
  41         Which corresponds to this yaml layout:
  42 
  43         level1:
  44             sublevel2:
  45                 - database_operations
  46                 - user_interface
  47                 - web_services
  48 
  49         To ensure the appliance has the default roles:
  50 
  51         from fixtures.server_roles import default_roles
  52 
  53         @pytest.mark.fixtureconf(server_roles=default_roles)
  54         def test_appliance_roles(server_roles):
  55             assert len(server_roles) == len(default_roles)
  56 
  57     List of server role names currently exposed in the CFME interface:
  58 
  59         - automate
  60         - ems_metrics_coordinator
  61         - ems_metrics_collector
  62         - ems_metrics_processor
  63         - database_operations
  64         - database_synchronization
  65         - event
  66         - ems_inventory
  67         - ems_operations
  68         - notifier
  69         - reporting
  70         - scheduler
  71         - smartproxy
  72         - smartstate
  73         - user_interface
  74         - web_services
  75 
  76     """
  77 
  78     if 'server_roles' in fixtureconf:
  79         roles_list = list(fixtureconf['server_roles'])
  80     elif 'server_roles_cfmedata' in fixtureconf:
  81         roles_list = cfme_data.data
  82         # Drills down into cfme_data YAML by selector, expecting a list
  83         # of roles at the end. A KeyError here probably means the YAMe
  84         # selector is wrong
  85         for selector in fixtureconf['server_roles_cfmedata']:
  86             roles_list = roles_list[selector]
  87     else:
  88         raise Exception('server_roles config not found on test callable')
  89 
  90     # Deselecting the user interface role is really un-fun, and is
  91     # counterproductive in the middle of user interface testing.
  92     if 'user_interface' not in roles_list:
  93         raise Exception('Refusing to remove the user_interface role')
  94 
  95     # Nav to the settings tab
  96     settings_pg = cnf_configuration_pg.click_on_settings()
  97     server_settings_pg = settings_pg.click_on_current_server_tree_node()
  98     # sst is a configuration_subpages.settings_subpages.server_settings_subpages.
  99     #   server_settings_tab.ServerSettingsTab
  100     sst = server_settings_pg.click_on_server_tab()
  101 
  102     # Set the roles!
  103     if sorted(sst.selected_server_role_names) != sorted(roles_list):
  104         sst.set_server_roles(roles_list)
  105         sst.save()
  106         sst._wait_for_results_refresh()
  107     else:
  108         logger.info('Server roles already match configured fixture roles, not changing server roles')
  109 
  110     # If this assert fails, check roles names for typos or other minor differences
  111     Assert.equal(sorted(sst.selected_server_role_names), sorted(roles_list))
  112 
  113     return sst.selected_server_role_names
  114 
  115
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/fixtures/server_roles.py b/fixtures/server_roles.py
  --- a/fixtures/server_roles.py
  +++ b/fixtures/server_roles.py
  @@ -17,6 +17,7 @@
       'web_services',
   )
   
  +
   @pytest.fixture
   def server_roles(fixtureconf, cfme_data, cnf_configuration_pg):
       """Set the server roles based on a list of roles attached to the test using this fixture
  @@ -94,7 +95,11 @@
   
       # Nav to the settings tab
       settings_pg = cnf_configuration_pg.click_on_settings()
  -    server_settings_pg = settings_pg.click_on_current_server_tree_node()
  +    # Workaround to rudely bypass a popup that sometimes appears for
  +    # unknown reasons.
  +    # See also: https://github.com/RedHatQE/cfme_tests/issues/168
  +    from pages.configuration_subpages.settings_subpages.server_settings import ServerSettings
  +    server_settings_pg = ServerSettings(settings_pg.testsetup)
       # sst is a configuration_subpages.settings_subpages.server_settings_subpages.
       #   server_settings_tab.ServerSettingsTab
       sst = server_settings_pg.click_on_server_tab()
  @@ -105,10 +110,9 @@
           sst.save()
           sst._wait_for_results_refresh()
       else:
  -        logger.info('Server roles already match configured fixture roles, not changing server roles')
  +        logger.info('Server roles match configured fixture roles, not changing server roles')
   
       # If this assert fails, check roles names for typos or other minor differences
       Assert.equal(sorted(sst.selected_server_role_names), sorted(roles_list))
   
       return sst.selected_server_role_names
  -
  
verification_info: {"golden_diff": "diff --git a/fixtures/server_roles.py b/fixtures/server_roles.py\n--- a/fixtures/server_roles.py\n+++ b/fixtures/server_roles.py\n@@ -17,6 +17,7 @@\n     'web_services',\n )\n \n+\n @pytest.fixture\n def server_roles(fixtureconf, cfme_data, cnf_configuration_pg):\n     \"\"\"Set the server roles based on a list of roles attached to the test using this fixture\n@@ -94,7 +95,11 @@\n \n     # Nav to the settings tab\n     settings_pg = cnf_configuration_pg.click_on_settings()\n-    server_settings_pg = settings_pg.click_on_current_server_tree_node()\n+    # Workaround to rudely bypass a popup that sometimes appears for\n+    # unknown reasons.\n+    # See also: https://github.com/RedHatQE/cfme_tests/issues/168\n+    from pages.configuration_subpages.settings_subpages.server_settings import ServerSettings\n+    server_settings_pg = ServerSettings(settings_pg.testsetup)\n     # sst is a configuration_subpages.settings_subpages.server_settings_subpages.\n     #   server_settings_tab.ServerSettingsTab\n     sst = server_settings_pg.click_on_server_tab()\n@@ -105,10 +110,9 @@\n         sst.save()\n         sst._wait_for_results_refresh()\n     else:\n-        logger.info('Server roles already match configured fixture roles, not changing server roles')\n+        logger.info('Server roles match configured fixture roles, not changing server roles')\n \n     # If this assert fails, check roles names for typos or other minor differences\n     Assert.equal(sorted(sst.selected_server_role_names), sorted(roles_list))\n \n     return sst.selected_server_role_names\n-\n", "issue": "Unexpected popup in server_roles fixture\nThe server_roles fixture attempts to explicitly navigate to the current server's settings page before clicking any checkboxen, but the call to do that (`settings_pg.click_on_current_server_tree_node()`) occasionally fails because a popup appears. We'll need to make sure the popup can be safely ignored, and conditionally ignore it if it appears.\n\nUntil this is fixed, a workaround is to assume that navigation with the `cnf_configuration_pg` fixture will land on the current server settings page:\n\n``` diff\ndiff --git a/fixtures/server_roles.py b/fixtures/server_roles.py\nindex dfcb574..2b99836 100644\n--- a/fixtures/server_roles.py\n+++ b/fixtures/server_roles.py\n@@ -94,7 +94,9 @@ def server_roles(fixtureconf, cfme_data, cnf_configuration_pg):\n\n     # Nav to the settings tab\n     settings_pg = cnf_configuration_pg.click_on_settings()\n-    server_settings_pg = settings_pg.click_on_current_server_tree_node()\n+    #server_settings_pg = settings_pg.click_on_current_server_tree_node()\n+    from pages.configuration_subpages.settings_subpages.server_settings import ServerSettings\n+    server_settings_pg = ServerSettings(settings_pg.testsetup)\n     # sst is a configuration_subpages.settings_subpages.server_settings_subpages.\n     #   server_settings_tab.ServerSettingsTab\n     sst = server_settings_pg.click_on_server_tab()\n```\n\n", "before_files": [{"content": "import logging\n\nimport pytest\nfrom unittestzero import Assert\n\nlogger = logging.getLogger(__name__)\n\ndefault_roles = (\n    'database_operations',\n    'event',\n    'ems_inventory',\n    'ems_operations',\n    'reporting',\n    'scheduler',\n    'smartstate',\n    'user_interface',\n    'web_services',\n)\n\n@pytest.fixture\ndef server_roles(fixtureconf, cfme_data, cnf_configuration_pg):\n    \"\"\"Set the server roles based on a list of roles attached to the test using this fixture\n\n    Usage examples:\n\n        Pass the desired roles in to the \"server_roles_set\" decorator:\n\n        _roles = ('database_operations', 'event', 'user_interface', 'web_services')\n\n        @pytest.mark.fixtureconf(server_roles=_roles)\n        def test_appliance_roles(server_roles):\n            assert len(server_roles) == 4\n\n        Roles can be pulled from the cfme_data fixture using yaml selectors,\n        which will do a 'set' with the list of roles found at the target path:\n\n        @pytest.mark.fixtureconf(server_roles_cfmedata=('level1', 'sublevel2'))\n        def test_appliance_roles(server_roles):\n            assert len(server_roles) == 3\n\n        Which corresponds to this yaml layout:\n\n        level1:\n            sublevel2:\n                - database_operations\n                - user_interface\n                - web_services\n\n        To ensure the appliance has the default roles:\n\n        from fixtures.server_roles import default_roles\n\n        @pytest.mark.fixtureconf(server_roles=default_roles)\n        def test_appliance_roles(server_roles):\n            assert len(server_roles) == len(default_roles)\n\n    List of server role names currently exposed in the CFME interface:\n\n        - automate\n        - ems_metrics_coordinator\n        - ems_metrics_collector\n        - ems_metrics_processor\n        - database_operations\n        - database_synchronization\n        - event\n        - ems_inventory\n        - ems_operations\n        - notifier\n        - reporting\n        - scheduler\n        - smartproxy\n        - smartstate\n        - user_interface\n        - web_services\n\n    \"\"\"\n\n    if 'server_roles' in fixtureconf:\n        roles_list = list(fixtureconf['server_roles'])\n    elif 'server_roles_cfmedata' in fixtureconf:\n        roles_list = cfme_data.data\n        # Drills down into cfme_data YAML by selector, expecting a list\n        # of roles at the end. A KeyError here probably means the YAMe\n        # selector is wrong\n        for selector in fixtureconf['server_roles_cfmedata']:\n            roles_list = roles_list[selector]\n    else:\n        raise Exception('server_roles config not found on test callable')\n\n    # Deselecting the user interface role is really un-fun, and is\n    # counterproductive in the middle of user interface testing.\n    if 'user_interface' not in roles_list:\n        raise Exception('Refusing to remove the user_interface role')\n\n    # Nav to the settings tab\n    settings_pg = cnf_configuration_pg.click_on_settings()\n    server_settings_pg = settings_pg.click_on_current_server_tree_node()\n    # sst is a configuration_subpages.settings_subpages.server_settings_subpages.\n    #   server_settings_tab.ServerSettingsTab\n    sst = server_settings_pg.click_on_server_tab()\n\n    # Set the roles!\n    if sorted(sst.selected_server_role_names) != sorted(roles_list):\n        sst.set_server_roles(roles_list)\n        sst.save()\n        sst._wait_for_results_refresh()\n    else:\n        logger.info('Server roles already match configured fixture roles, not changing server roles')\n\n    # If this assert fails, check roles names for typos or other minor differences\n    Assert.equal(sorted(sst.selected_server_role_names), sorted(roles_list))\n\n    return sst.selected_server_role_names\n\n", "path": "fixtures/server_roles.py"}], "after_files": [{"content": "import logging\n\nimport pytest\nfrom unittestzero import Assert\n\nlogger = logging.getLogger(__name__)\n\ndefault_roles = (\n    'database_operations',\n    'event',\n    'ems_inventory',\n    'ems_operations',\n    'reporting',\n    'scheduler',\n    'smartstate',\n    'user_interface',\n    'web_services',\n)\n\n\n@pytest.fixture\ndef server_roles(fixtureconf, cfme_data, cnf_configuration_pg):\n    \"\"\"Set the server roles based on a list of roles attached to the test using this fixture\n\n    Usage examples:\n\n        Pass the desired roles in to the \"server_roles_set\" decorator:\n\n        _roles = ('database_operations', 'event', 'user_interface', 'web_services')\n\n        @pytest.mark.fixtureconf(server_roles=_roles)\n        def test_appliance_roles(server_roles):\n            assert len(server_roles) == 4\n\n        Roles can be pulled from the cfme_data fixture using yaml selectors,\n        which will do a 'set' with the list of roles found at the target path:\n\n        @pytest.mark.fixtureconf(server_roles_cfmedata=('level1', 'sublevel2'))\n        def test_appliance_roles(server_roles):\n            assert len(server_roles) == 3\n\n        Which corresponds to this yaml layout:\n\n        level1:\n            sublevel2:\n                - database_operations\n                - user_interface\n                - web_services\n\n        To ensure the appliance has the default roles:\n\n        from fixtures.server_roles import default_roles\n\n        @pytest.mark.fixtureconf(server_roles=default_roles)\n        def test_appliance_roles(server_roles):\n            assert len(server_roles) == len(default_roles)\n\n    List of server role names currently exposed in the CFME interface:\n\n        - automate\n        - ems_metrics_coordinator\n        - ems_metrics_collector\n        - ems_metrics_processor\n        - database_operations\n        - database_synchronization\n        - event\n        - ems_inventory\n        - ems_operations\n        - notifier\n        - reporting\n        - scheduler\n        - smartproxy\n        - smartstate\n        - user_interface\n        - web_services\n\n    \"\"\"\n\n    if 'server_roles' in fixtureconf:\n        roles_list = list(fixtureconf['server_roles'])\n    elif 'server_roles_cfmedata' in fixtureconf:\n        roles_list = cfme_data.data\n        # Drills down into cfme_data YAML by selector, expecting a list\n        # of roles at the end. A KeyError here probably means the YAMe\n        # selector is wrong\n        for selector in fixtureconf['server_roles_cfmedata']:\n            roles_list = roles_list[selector]\n    else:\n        raise Exception('server_roles config not found on test callable')\n\n    # Deselecting the user interface role is really un-fun, and is\n    # counterproductive in the middle of user interface testing.\n    if 'user_interface' not in roles_list:\n        raise Exception('Refusing to remove the user_interface role')\n\n    # Nav to the settings tab\n    settings_pg = cnf_configuration_pg.click_on_settings()\n    # Workaround to rudely bypass a popup that sometimes appears for\n    # unknown reasons.\n    # See also: https://github.com/RedHatQE/cfme_tests/issues/168\n    from pages.configuration_subpages.settings_subpages.server_settings import ServerSettings\n    server_settings_pg = ServerSettings(settings_pg.testsetup)\n    # sst is a configuration_subpages.settings_subpages.server_settings_subpages.\n    #   server_settings_tab.ServerSettingsTab\n    sst = server_settings_pg.click_on_server_tab()\n\n    # Set the roles!\n    if sorted(sst.selected_server_role_names) != sorted(roles_list):\n        sst.set_server_roles(roles_list)\n        sst.save()\n        sst._wait_for_results_refresh()\n    else:\n        logger.info('Server roles match configured fixture roles, not changing server roles')\n\n    # If this assert fails, check roles names for typos or other minor differences\n    Assert.equal(sorted(sst.selected_server_role_names), sorted(roles_list))\n\n    return sst.selected_server_role_names\n", "path": "fixtures/server_roles.py"}]}