@@ -596,7 +596,7 @@ def test_positive_export(session, target_sat, function_org, function_location):
596596@pytest .mark .skipif (
597597 (settings .ui .webdriver != 'chrome' ), reason = 'Currently only chrome is supported'
598598)
599- def test_positive_export_selected_columns (target_sat , current_sat_location ):
599+ def test_positive_export_selected_columns (request , target_sat , current_sat_location ):
600600 """Select certain columns in the hosts table and check that they are exported in the CSV file.
601601
602602 :id: 2b65c1d6-0b94-11ef-a4b7-000c2989e153
@@ -609,47 +609,63 @@ def test_positive_export_selected_columns(target_sat, current_sat_location):
609609
610610 :BZ: 2167146
611611
612+ :Verifies: SAT-38427
613+
612614 :customerscenario: true
613615
614- :BlockedBy: SAT-38427
615616 """
616- # TODO Rewrite for new all hosts page after SAT-38427 is completed
617617
618618 columns = (
619619 Box (ui = 'Power' , csv = 'Power Status' , displayed = True ),
620- Box (ui = 'Recommendations' , csv = 'Insights Recommendations Count' , displayed = True ),
621620 Box (ui = 'Name' , csv = 'Name' , displayed = True ),
622- Box (ui = 'IPv4' , csv = 'Ip' , displayed = True ),
623- Box (ui = 'IPv6' , csv = 'Ip6' , displayed = True ),
624- Box (ui = 'MAC' , csv = 'Mac' , displayed = True ),
625621 Box (ui = 'OS' , csv = 'Operatingsystem' , displayed = True ),
626622 Box (ui = 'Owner' , csv = 'Owner' , displayed = True ),
627623 Box (ui = 'Host group' , csv = 'Hostgroup' , displayed = True ),
628624 Box (ui = 'Boot time' , csv = 'Reported Data - Boot Time' , displayed = True ),
629625 Box (ui = 'Last report' , csv = 'Last Report' , displayed = True ),
630626 Box (ui = 'Comment' , csv = 'Comment' , displayed = True ),
627+ Box (ui = 'IPv4' , csv = 'Ip' , displayed = True ),
628+ Box (ui = 'IPv6' , csv = 'Ip6' , displayed = True ),
629+ Box (ui = 'MAC' , csv = 'Mac' , displayed = True ),
631630 Box (ui = 'Model' , csv = 'Compute Resource Or Model' , displayed = True ),
632631 Box (ui = 'Sockets' , csv = 'Reported Data - Sockets' , displayed = True ),
633632 Box (ui = 'Cores' , csv = 'Reported Data - Cores' , displayed = True ),
634633 Box (ui = 'RAM' , csv = 'Reported Data - Ram' , displayed = True ),
635634 Box (ui = 'Virtual' , csv = 'Virtual' , displayed = True ),
636- Box (ui = 'Disks space' , csv = 'Reported Data - Disks Total' , displayed = True ),
635+ Box (ui = 'Total disk space' , csv = 'Reported Data - Disks Total' , displayed = True ),
637636 Box (ui = 'Kernel version' , csv = 'Reported Data - Kernel Version' , displayed = True ),
638637 Box (ui = 'BIOS vendor' , csv = 'Reported Data - Bios Vendor' , displayed = True ),
639638 Box (ui = 'BIOS release date' , csv = 'Reported Data - Bios Release Date' , displayed = True ),
640639 Box (ui = 'BIOS version' , csv = 'Reported Data - Bios Version' , displayed = True ),
641640 Box (ui = 'RHEL Lifecycle status' , csv = 'Rhel Lifecycle Status' , displayed = True ),
642- Box (ui = 'Installable updates' , csv = 'Installable ...' , displayed = False ),
641+ Box (ui = 'Installable updates' , csv = 'Installable updates' , displayed = False ),
642+ Box (ui = 'Last seen' , csv = 'Last Checkin' , displayed = True ),
643643 Box (ui = 'Lifecycle environment' , csv = 'Lifecycle Environment' , displayed = True ),
644644 Box (ui = 'Content view' , csv = 'Content View' , displayed = True ),
645- Box (ui = 'Registered' , csv = 'Registered' , displayed = True ),
646- Box (ui = 'Last checkin ' , csv = 'Last Checkin ' , displayed = True ),
645+ Box (ui = 'Registered at ' , csv = 'Registered' , displayed = True ),
646+ Box (ui = 'Recommendations ' , csv = 'Recommendations ' , displayed = True ),
647647 )
648648
649649 with target_sat .ui_session () as session :
650650 session .location .select (loc_name = current_sat_location .name )
651- session .host .manage_table_columns ({column .ui : column .displayed for column in columns })
652- file_path = session .host .export ()
651+ # Save original column settings
652+ original_headers = session .all_hosts .get_displayed_table_headers ()
653+ original_columns = {header : True for header in original_headers if header is not None }
654+
655+ def restore_columns ():
656+ """Restore original column settings after test"""
657+ with target_sat .ui_session () as restore_session :
658+ restore_session .location .select (loc_name = current_sat_location .name )
659+ wait_for (lambda : restore_session .browser .refresh (), timeout = 5 )
660+ all_possible_columns = {column .ui : False for column in columns }
661+ all_possible_columns .update (original_columns )
662+ restore_session .all_hosts .manage_table_columns (all_possible_columns )
663+
664+ request .addfinalizer (restore_columns )
665+
666+ # Set test-specific columns
667+ session .all_hosts .manage_table_columns ({column .ui : column .displayed for column in columns })
668+ file_path = session .all_hosts .export ()
653669 with open (file_path , newline = '' ) as fh :
654670 csvfile = csv .DictReader (fh )
655671 assert set (csvfile .fieldnames ) == set (
0 commit comments