#!/usr/bin/python3## Copyright (C) 2025 Red Hat, Inc.# SPDX-License-Identifier: LGPL-2.1-or-laterimport osimport sysfrom anacondalib import VirtInstallMachineCase, pixel_tests_ignorefrom installer import Installerfrom testlib import nondestructive, test_main # pylint: disable=import-errorHELPERS_DIR = os.path.join(os.path.dirname(__file__), "helpers")sys.path.append(HELPERS_DIR)from payload_dnf import PayloadDNF@nondestructiveclass TestPayloadDNF(VirtInstallMachineCase):provision = {"machine1": {"payload_type": "dnf"}}def testEnvironmentPackages(self):"""Description:Ensure software selection page loads environments and preselects the default environment.Then select another environment and verify that default package groups change.Also verify that package selection can be customized by the user.Expected results:- The list has at least one environment.- The default environment (server) is selected.- Can select another environment (workstation).- Default groups change when environment changes.- User can customize package selection by selecting/deselecting groups."""b = self.browserm = self.machinei = Installer(b, m)dnf = PayloadDNF(b)i.open()i.reach(i.steps.SOFTWARE_SELECTION)# Check that server environment is selected by defaultdnf.check_selected_environment("server-product-environment")# Pixel test the software selection pageb.assert_pixels("#app","software-selection",ignore=pixel_tests_ignore)# Check that container-management is the first item in the optional groups for serverdnf.check_first_optional_group("container-management")# And it's not selected by defaultdnf.check_not_selected_group("container-management")# Select container-management groupdnf.select_group("container-management")# Select workstation environmentdnf.select_environment("workstation-product-environment")# Group selection is reset when environment changesdnf.check_not_selected_group("container-management")dnf.check_not_selected_group("domain-client")# Check that domain-client is the first item in the optional groups for workstationdnf.check_first_optional_group("domain-client")dnf.select_group("domain-client")if __name__ == '__main__':test_main()