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:
@@ -244,6 +244,13 @@ startAll;
|
|||||||
connections.</para></listitem>
|
connections.</para></listitem>
|
||||||
</varlistentry>
|
</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>
|
<varlistentry>
|
||||||
<term><methodname>waitForWindow</methodname></term>
|
<term><methodname>waitForWindow</methodname></term>
|
||||||
<listitem><para>Wait until an X11 window has appeared whose name
|
<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
|
# Wait until it is possible to connect to the X server. Note that
|
||||||
# testing the existence of /tmp/.X11-unix/X0 is insufficient.
|
# testing the existence of /tmp/.X11-unix/X0 is insufficient.
|
||||||
sub waitForX {
|
sub waitForX {
|
||||||
|
|||||||
Reference in New Issue
Block a user