mirror of
https://github.com/rocky-linux/os-autoinst-distri-rocky.git
synced 2024-11-25 06:31:26 +00:00
drop check_type_string, use upstream merged code instead
Summary: The code from `check_type_string` was effectively merged into os-autoinst's `testapi::type_string` as an optional argument, so let's drop this downstream version and just have the 'safe typing' functions use `type_string`. Test Plan: Run tests, check they pass and work the same (i.e. make sure they're actually checking for screen change when typing). Reviewers: jskladan, garretraziel Reviewed By: garretraziel Subscribers: tflink Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D1033
This commit is contained in:
parent
7f93843dd6
commit
7869c3d07a
@ -6,7 +6,7 @@ use base 'Exporter';
|
|||||||
use Exporter;
|
use Exporter;
|
||||||
|
|
||||||
use testapi;
|
use testapi;
|
||||||
our @EXPORT = qw/run_with_error_check check_type_string type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout/;
|
our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout/;
|
||||||
|
|
||||||
sub run_with_error_check {
|
sub run_with_error_check {
|
||||||
my ($func, $error_screen) = @_;
|
my ($func, $error_screen) = @_;
|
||||||
@ -15,29 +15,11 @@ sub run_with_error_check {
|
|||||||
die "Error screen appeared" if (check_screen $error_screen, 5);
|
die "Error screen appeared" if (check_screen $error_screen, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
# type the string in sets of characters at a time (default 3), waiting
|
|
||||||
# for a screen change after each set. Intended to be safer when the VM
|
|
||||||
# is busy and regular type_string may overload the input buffer. Args
|
|
||||||
# passed along to `type_string`. Accepts additional args:
|
|
||||||
# `size` - size of character groups (default 3) - set to 1 for extreme
|
|
||||||
# safety (but slower and more screenshotting)
|
|
||||||
sub check_type_string {
|
|
||||||
my ($string, %args) = @_;
|
|
||||||
$args{size} //= 3;
|
|
||||||
|
|
||||||
# split string into an array of pieces of specified size
|
|
||||||
# https://stackoverflow.com/questions/372370
|
|
||||||
my @pieces = unpack("(a$args{size})*", $string);
|
|
||||||
for my $piece (@pieces) {
|
|
||||||
wait_screen_change { type_string($piece, %args); };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# high-level 'type this string quite safely but reasonably fast'
|
# high-level 'type this string quite safely but reasonably fast'
|
||||||
# function whose specific implementation may vary
|
# function whose specific implementation may vary
|
||||||
sub type_safely {
|
sub type_safely {
|
||||||
my $string = shift;
|
my $string = shift;
|
||||||
check_type_string($string, max_interval => 20);
|
type_string($string, wait_screen_change => 3, max_interval => 20);
|
||||||
wait_still_screen 2;
|
wait_still_screen 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +27,7 @@ sub type_safely {
|
|||||||
# function whose specific implementation may vary
|
# function whose specific implementation may vary
|
||||||
sub type_very_safely {
|
sub type_very_safely {
|
||||||
my $string = shift;
|
my $string = shift;
|
||||||
check_type_string($string, size => 1, still => 5, max_interval => 1);
|
type_string($string, wait_screen_change => 1, max_interval => 1);
|
||||||
wait_still_screen 5;
|
wait_still_screen 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user