Bug 21479: Zebra index can return different result

If the zebra index has been rebuilt by previous tests, the order/results
will be different, and we will not have biblionumber 1, 3, 5

Let make this more flexible

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit e7574481b1)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2018-10-15 11:42:34 -03:00 committed by Martin Renvoize
parent ccb364a667
commit 351dfa737b
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 10 additions and 4 deletions

View File

@ -41,18 +41,24 @@ subtest 'OPAC - Remove from cart' => sub {
my @basket_count_elts = $driver->find_elements('//span[@id="basketcount"]/span');
is( scalar(@basket_count_elts), 0, 'Basket should be empty');
$driver->find_element('//a[@class="addtocart cart1"]')->click;
# This will fail if nothing is indexed, but at this point we should have everything setup correctly
my @checkboxes = $driver->find_elements('//input[@type="checkbox"][@name="biblionumber"]');
my $biblionumber1 = $checkboxes[0]->get_value();
my $biblionumber3 = $checkboxes[2]->get_value();
my $biblionumber5 = $checkboxes[4]->get_value();
$driver->find_element('//a[@class="addtocart cart'.$biblionumber1.'"]')->click;
my $basket_count_elt = $driver->find_element('//span[@id="basketcount"]/span');
is( $basket_count_elt->get_text(),
1, 'One element should have been added to the cart' );
$driver->find_element('//a[@class="addtocart cart3"]')->click;
$driver->find_element('//a[@class="addtocart cart5"]')->click;
$driver->find_element('//a[@class="addtocart cart'.$biblionumber3.'"]')->click;
$driver->find_element('//a[@class="addtocart cart'.$biblionumber5.'"]')->click;
$basket_count_elt = $driver->find_element('//span[@id="basketcount"]/span');
is( $basket_count_elt->get_text(),
3, '3 elements should have been added to the cart' );
$driver->find_element('//a[@class="cartRemove cartR3"]')->click;
$driver->find_element('//a[@class="cartRemove cartR'.$biblionumber3.'"]')->click;
$basket_count_elt = $driver->find_element('//span[@id="basketcount"]/span');
is( $basket_count_elt->get_text(),
2, '1 element should have been removed from the cart' );