From 7603f89ff6e9f15cae16c8785b695709d9ad0e4a Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Mon, 30 Oct 2017 04:23:30 +0000 Subject: [PATCH] Bug 19185: Change to use ENV, fix login and passwords The kohadevbox has admin/admin set, so for testing when creating the initial superuser, if you wish to minimize effort, use admin/admin. Otherwise, make sure to: export KOHA_USER={whatever your user is} export KOHA_PASS={whatever your password is} before attempting to run the test. Also, this test was failing because 'sub auth' was using the ugliest of xpath's to find the submit button. I've noticed the other selenium tests have similar functions. It might be an idea to build a t/lib/Selenium.pm so as to reduce code duplication and older versions differing from newer versions. --- t/db_dependent/selenium/installkoha.t | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/t/db_dependent/selenium/installkoha.t b/t/db_dependent/selenium/installkoha.t index 46eb885..f1209c1 100644 --- a/t/db_dependent/selenium/installkoha.t +++ b/t/db_dependent/selenium/installkoha.t @@ -34,8 +34,12 @@ use MARC::Record; use MARC::Field; my $dbh = C4::Context->dbh; -my $login = 'koha_kohadev'; -my $password = 'password'; +my $login = $ENV{KOHA_USER} || 'koha_kohadev'; +my $password = $ENV{KOHA_PASS} || 'password'; +my $staff_client_base_url = + $ENV{KOHA_INTRANET_URL} || C4::Context->preference("staffClientBaseUrl") || q{}; +my $base_url= $staff_client_base_url . "/cgi-bin/koha/"; +my $opac_url = $ENV{KOHA_OPAC_URL} || C4::Context->preference("OPACBaseURL") || q{}; our $sample_data = { category => { @@ -48,8 +52,8 @@ our $sample_data = { surname => 'test_patron_surname', cardnumber => '4242424242', userid => 'test_username', - password => 'password', - password2 => 'password' + password => 'Password123', + password2 => 'Password123' }, }; @@ -182,8 +186,8 @@ END { sub auth { my ( $driver, $login, $password) = @_; - fill_form( $driver, { userid => 'koha_kohadev', password => 'password' } ); - my $login_button = $driver->find_element_by_xpath('/html/body/div/div/div/form/fieldset/input'); + fill_form( $driver, { userid => $login, password => $password } ); + my $login_button = $driver->find_element('//input[@id="submit"]'); $login_button->submit(); } -- 2.1.4