nixos/test-driver: Add new waitForText function.
As promised in the previous commit, this can be used similarly to $machine->waitForWindow, where you supply a regular expression and it's retrying OCR until the regexp matches. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
parent
235c2228ca
commit
8bd025a75e
2 changed files with 18 additions and 0 deletions
|
@ -244,6 +244,13 @@ startAll;
|
|||
connections.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><methodname>waitForText</methodname></term>
|
||||
<listitem><para>Wait until the supplied regular expressions matches
|
||||
the textual contents of the screen by using optical character recognition
|
||||
(see <methodname>getScreenText</methodname>).</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><methodname>waitForWindow</methodname></term>
|
||||
<listitem><para>Wait until an X11 window has appeared whose name
|
||||
|
|
|
@ -518,6 +518,17 @@ sub getScreenText {
|
|||
}
|
||||
|
||||
|
||||
# Wait until a specific regexp matches the textual contents of the screen.
|
||||
sub waitForText {
|
||||
my ($self, $regexp) = @_;
|
||||
$self->nest("waiting for $regexp to appear on the screen", sub {
|
||||
retry sub {
|
||||
return 1 if $self->getScreenText =~ /$regexp/;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
# Wait until it is possible to connect to the X server. Note that
|
||||
# testing the existence of /tmp/.X11-unix/X0 is insufficient.
|
||||
sub waitForX {
|
||||
|
|
Loading…
Reference in a new issue