Created
February 8, 2019 23:18
-
-
Save dklawren/57a4e6d947bd5d03ec0069518ba68d91 to your computer and use it in GitHub Desktop.
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