Bug 19337: Make basic_workflow.t configurable through ENV
This patch makes the basic_workflow.t selenium tests read ENV for the following vars: KOHA_USER KOHA_PASS KOHA_INTRANET_URL SELENIUM_ADDR SELENIUM_PORT to properly configure the running environment. If absent, all variables fallback to current behaviour: KOHA_USER // 'koha' KOHA_PASS // 'koha' KOHA_INTRANET_URL (unchanged) SELENIUM_ADDR // 'localhost' SELENIUM_PORT // 4444 [*] Selenium defaults are documented on the Selenium::Remote::Driver docs. Prerequisites: Make sure you have a working environment for the Selenium tests: - Run: $ sudo apt update $ sudo apt install xvfb firefox-esr To test: - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ wget https://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar \ -O /tmp/selenium.jar k$ SELENIUM_PATH=/tmp/selenium.jar k$ Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null & k$ DISPLAY=:1 java -jar $SELENIUM_PATH & k$ prove t/db_dependent/selenium/basic_workflow.t => SUCCESS: Tests pass - Apply this patch - Run: k$ prove t/db_dependent/selenium/basic_workflow.t => SUCCESS: Tests pass! - Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
c73b6d51da
commit
5bb19808bb
|
|
@ -42,10 +42,15 @@ use Test::More tests => 20;
|
|||
use MARC::Record;
|
||||
use MARC::Field;
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $login = 'koha';
|
||||
my $password = 'koha';
|
||||
my $base_url= ( $ENV{KOHA_INTRANET_URL} || 'http://'.C4::Context->preference("staffClientBaseURL") ) . "/cgi-bin/koha/";
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $login = $ENV{KOHA_USER} || 'koha';
|
||||
my $password = $ENV{KOHA_PASS} || 'koha';
|
||||
my $base_url
|
||||
= ( $ENV{KOHA_INTRANET_URL} || 'http://' . C4::Context->preference("staffClientBaseURL") )
|
||||
. "/cgi-bin/koha/";
|
||||
my $selenium_addr = $ENV{SELENIUM_ADDR} || 'localhost';
|
||||
my $selenium_port = $ENV{SELENIUM_PORT} || 4444;
|
||||
|
||||
|
||||
|
||||
my $number_of_biblios_to_insert = 3;
|
||||
|
|
@ -89,7 +94,11 @@ SKIP: {
|
|||
|
||||
open my $fh, '>>', '/tmp/output.txt';
|
||||
|
||||
my $driver = Selenium::Remote::Driver->new;
|
||||
my $driver = Selenium::Remote::Driver->new(
|
||||
port => $selenium_port,
|
||||
remote_server_addr => $selenium_addr
|
||||
);
|
||||
|
||||
$start = gettimeofday;
|
||||
$prev_time = $start;
|
||||
$driver->get($base_url."mainpage.pl");
|
||||
|
|
@ -202,7 +211,7 @@ END {
|
|||
|
||||
sub auth {
|
||||
my ( $driver, $login, $password) = @_;
|
||||
fill_form( $driver, { userid => 'koha', password => 'koha' } );
|
||||
fill_form( $driver, { userid => $login, password => $password } );
|
||||
my $login_button = $driver->find_element('//input[@id="submit"]');
|
||||
$login_button->submit();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue