Skip to content

Instantly share code, notes, and snippets.

@dklawren
Created February 8, 2019 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dklawren/57a4e6d947bd5d03ec0069518ba68d91 to your computer and use it in GitHub Desktop.
Save dklawren/57a4e6d947bd5d03ec0069518ba68d91 to your computer and use it in GitHub Desktop.
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