This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Bugzilla::Test::Selenium; | |
use 5.10.1; | |
use Moo; | |
use Test2::V0; | |
use Test::Selenium::Remote::Driver; | |
has 'driver_class' => (is => 'ro', default => 'Test::Selenium::Remote::Driver'); | |
has 'driver_args' => (is => 'ro', required => 1,); | |
has 'driver' => ( | |
is => 'lazy', | |
handles => {}, | |
); | |
sub _build_driver { | |
my ($self) = @_; | |
return $self->driver_class->new(%{$self->driver_args}); | |
} | |
sub open_ok { | |
my ($self, $url) = @_; | |
ok($self->get_ok($url)); | |
} | |
sub type_ok { | |
my ($self, $id, $text) = @_; | |
my $el = $self->find_element(qq{//*[\@id="$id"]}, 'xpath'); | |
$el->send_keys_ok($text); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment