<<

NAME

t::lib::Selenium - Selenium helper module

SYNOPSIS

    my $s = t::lib::Selenium->new;
    my $driver = $s->driver;
    my $base_url = $s->base_url;
    $s->auth;
    $driver->get($s->base_url . 'mainpage.pl');
    $s->fill_form({ input_id => 'value' });

DESCRIPTION

The goal of this module is to group the different actions we need when we use automation test using Selenium =head1 METHODS

new

    my $s = t::lib::Selenium->new;

    Constructor - Returns the object Selenium
    You can pass login, password, base_url, selenium_addr, selenium_port
    If not passed, the environment variables will be used
    KOHA_USER, KOHA_PASS, KOHA_INTRANET_URL, SELENIUM_ADDR SELENIUM_PORT
    Or koha, koha, syspref staffClientBaseURL, localhost, 4444

auth

    $s->auth;

    Will login into Koha.

fill_form

    $driver->get($url)
    $s->fill_form({
        input_id => 'value',
        element_id => 'other_value',
    });

    Will fill the different elements of a form.
    The keys must be element ids (input and select are supported so far)
    The values must a string.

submit_form

    $s->submit_form;

    It will submit the form using the submit button present in in the fieldset with a clas="action".
    It should be the default way. If it does not work you should certainly fix the Koha interface.

click

    $s->click

    This is a bit dirty for now but will evolve depending on the needs
    3 parameters possible but only the following 2 forms are used:
    $s->click({ href => '/module/script.pl?foo=bar', main => 'doc3' }); # Sometimes we have doc or doc3. To make sure we are not going to hit a link in the header
    $s->click({ id => 'element_id });

click_when_visible

    $c->click_when_visible

    Should always be called to avoid the "An element could not be located on the page" error

AUTHORS

Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Alex Buckley <alexbuckley@catalyst.net.nz>

Koha Development Team

COPYRIGHT

Copyright 2017 - Koha Development Team

LICENSE

This file is part of Koha.

Koha is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

Koha is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Koha; if not, see <http://www.gnu.org/licenses>.

<<