View | Details | Raw Unified | Return to bug 13849
Collapse All | Expand All

(-)a/t/db_dependent/cucumber/features/2-biblio.feature (+18 lines)
Line 0 Link Here
1
Feature: Add a biblio
2
 As a librarian
3
 I want to add a new biblio
4
5
 Background:
6
   Given I am logged in as a library admin
7
8
 Scenario: Add a biblio
9
   Given I have gone to the new biblio page
10
   When I have clicked on the ui-id-1 link
11
   And I have filled the input field starting by tag_200_subfield_a_ with "MyBookName"
12
   And I have filled the select field starting by tag_200_subfield_b_ with "LIVR"
13
   And I have filled the input field starting by tag_200_subfield_f_ with "MyAuthor"
14
   And I have filled the input field starting by tag_100_subfield_a_ with "20150601d        u||y0frey50      ba"
15
   When I have clicked on the ui-id-2 link
16
   And I have filled the select field starting by tag_101_subfield_a_ with "fre"
17
   When I have clicked on the saverecord button
18
   Then The biblio "MyBookName" should have been created
(-)a/t/db_dependent/cucumber/features/step_definitions/2-biblio_steps.pl (+13 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
use Test::More;
4
use Test::BDD::Cucumber::StepFile;
5
use C4::Context;
6
7
Then qr(The biblio "(.*)" should have been created), sub {
8
    S->{title} = $1;
9
    my $dbh = C4::Context->dbh;
10
    my $exists = $dbh->selectcol_arrayref(q|
11
        SELECT COUNT(*) FROM biblio where title = ?|, {}, S->{title} );
12
    is( $exists->[0], 1, 'The biblio '.S->{title}.' should exist' );
13
};
(-)a/t/db_dependent/cucumber/features/step_definitions/basic_steps.pl (-1 / +12 lines)
Lines 32-37 Given qr{I have gone to the (.*) page}, sub { Link Here
32
    S->{driver}->get( $path );
32
    S->{driver}->get( $path );
33
};
33
};
34
34
35
When qr(I have filled the (.*) field starting by (.*) with "(.*)"), sub {
36
  my $type = $1;
37
  my $id = $2;
38
  my $value = $3;
39
  my $id_full = S->{driver}->find_element('//'.$type.'[contains(@id,"'.$id.'")]')->get_attribute('id');
40
  t::lib::Cucumber::Form::fill( S->{driver}, { $id_full => $value } );
41
};
42
35
When qr(I have clicked on the submit button), sub {
43
When qr(I have clicked on the submit button), sub {
36
    my $button;
44
    my $button;
37
    # Try to find submit button
45
    # Try to find submit button
Lines 56-63 When qr(I have clicked on the (\S+) (\S+)), sub { Link Here
56
    my $tag;
64
    my $tag;
57
    if ( $type eq 'link' ) {
65
    if ( $type eq 'link' ) {
58
        $tag = 'a';
66
        $tag = 'a';
67
        S->{driver}->find_element('//'.$tag.'[@id="'.$id.'"]')->click;
68
    }
69
    else {
70
        S->{driver}->find_element('//'.$type.'[@id="'.$id.'"]')->click;
59
    }
71
    }
60
    S->{driver}->find_element('//'.$tag.'[@id="'.$id.'"]')->click;
61
};
72
};
62
73
63
When qr{I have filled the field (\S+) with "(.*)"}, sub {
74
When qr{I have filled the field (\S+) with "(.*)"}, sub {
(-)a/t/db_dependent/cucumber/features/step_definitions/hooks_steps.pl (+1 lines)
Lines 2-5 After sub { Link Here
2
    my $dbh = C4::Context->dbh;
2
    my $dbh = C4::Context->dbh;
3
    $dbh->do(q|DELETE FROM categories WHERE categorycode = ?|, {}, S->{patron_category_code});
3
    $dbh->do(q|DELETE FROM categories WHERE categorycode = ?|, {}, S->{patron_category_code});
4
    $dbh->do(q|DELETE FROM borrowers WHERE userid=?|, {}, S->{patron_userid});
4
    $dbh->do(q|DELETE FROM borrowers WHERE userid=?|, {}, S->{patron_userid});
5
    $dbh->do(q|DELETE FROM biblio WHERE title=?|, {}, S->{title});
5
};
6
};
(-)a/t/lib/Cucumber/Paths.pm (-5 / +5 lines)
Lines 6-16 sub get { Link Here
6
    my ( $page ) = @_;
6
    my ( $page ) = @_;
7
    my $base_url = 'http://'.C4::Context->preference("staffClientBaseURL")."/cgi-bin/koha/";
7
    my $base_url = 'http://'.C4::Context->preference("staffClientBaseURL")."/cgi-bin/koha/";
8
    my $paths = {
8
    my $paths = {
9
        'mainpage' => $base_url.'mainpage.pl?logout.x=1',
9
        'mainpage'             => $base_url.'mainpage.pl?logout.x=1',
10
        'patron category list' => $base_url.'admin/categorie.pl',
10
        'patron category list' => $base_url.'admin/categorie.pl',
11
        'new patron category' => $base_url.'admin/categorie.pl?op=add_form',
11
        'new patron category'  => $base_url.'admin/categorie.pl?op=add_form',
12
        'patron home' => $base_url.'members/members-home.pl',
12
        'patron home'          => $base_url.'members/members-home.pl',
13
        'new patron' => $base_url.'members/memberentry.pl?op=add&category_type=A'
13
        'new patron'           => $base_url.'members/memberentry.pl?op=add&category_type=A',
14
        'new biblio'           => $base_url.'cataloguing/addbiblio.pl?frameworkcode=FA',
14
    };
15
    };
15
    die "Invalid path" unless exists $paths->{$page};
16
    die "Invalid path" unless exists $paths->{$page};
16
    return $paths->{$page};
17
    return $paths->{$page};
17
- 

Return to bug 13849