-
Notifications
You must be signed in to change notification settings - Fork 283
/
Copy pathyast2_widget_utils.pm
87 lines (61 loc) · 2.67 KB
/
yast2_widget_utils.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
=head1 yast2_widget_utils.pm
This module provides helper functions for handling YaST widgets in text and graphical mode.
=cut
# SUSE's openQA tests
#
# Copyright 2018 SUSE LLC
# SPDX-License-Identifier: FSFAP
# Summary: This module provides helper functions for handling YaST widgets in text and graphical mode
# Maintainer: Joaquín Rivera <[email protected]>
package yast2_widget_utils;
use base Exporter;
use Exporter;
use strict;
use warnings;
use testapi;
use YaST::workarounds;
use version_utils qw(is_sle);
our @EXPORT = qw(change_service_configuration verify_service_configuration);
=head2 verify_service_configuration
verify_service_configuration([status => $status]);
Verify service configuration: status. This will just verify C<assert_screen> for C<yast2_ncurses_service_$status>.
=cut
sub verify_service_configuration {
my (%args) = @_;
my $status = $args{status};
assert_screen "yast2_ncurses_service_$status";
}
=head2 change_service_configuration
change_service_configuration([after_writing => $after_writing], [after_reboot => $after_reboot]);
Modify service configuration: "after writing" and/or "after reboot" steps
=cut
sub change_service_configuration {
my (%args) = @_;
my $after_writing_ref = $args{after_writing};
my $after_reboot_ref = $args{after_reboot};
apply_workaround_poo124652('yast2_ncurses_service_start_widget') if (is_sle('=15-SP5'));
change_service_configuration_step('after_writing_conf', $after_writing_ref) if $after_writing_ref;
change_service_configuration_step('after_reboot', $after_reboot_ref) if $after_reboot_ref;
}
=head2 change_service_configuration_step
change_service_configuration_step($step_name, $step_conf_ref);
Modify one service configuration step.
C<$step_name> is the name for change service configuration. It is a part of C<needle_selection> which is used for needle match.
C<$step_conf_ref> is used together with 'keys' as a reference for C<$action>. It is used also with 'values' as a reference for C<$shortcut>.
C<$action> is a part of C<needle_selection> which is used for needle match.
=cut
sub change_service_configuration_step {
my ($step_name, $step_conf_ref) = @_;
my ($action) = keys %$step_conf_ref;
my ($shortcut) = values %$step_conf_ref;
my $needle_selection = 'yast2_ncurses_service_' . $action . '_' . $step_name;
my $needle_check = 'yast2_ncurses_service_check_' . $action . '_' . $step_name;
send_key $shortcut;
send_key 'end';
send_key_until_needlematch $needle_selection, 'up', 6, 1;
if (check_var_array('EXTRATEST', 'y2uitest_ncurses')) {
send_key 'ret';
apply_workaround_poo124652($needle_check) if (is_sle('>=15-SP4'));
}
}
1;