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

(-)a/t/db_dependent/selenium/administration_tasks.t (-4 / +24 lines)
Lines 32-38 my $login = $ENV{KOHA_USER} || 'koha'; Link Here
32
my $itemtype      = 'UT_DVD';
32
my $itemtype      = 'UT_DVD';
33
my $frameworkcode = 'UTFW';     # frameworkcode is only 4 characters max!
33
my $frameworkcode = 'UTFW';     # frameworkcode is only 4 characters max!
34
my $branchcode    = 'UT_BC';
34
my $branchcode    = 'UT_BC';
35
my $categoryname = 'Test';
35
my $av_category   = 'AV_CAT_TEST';
36
our ($cleanup_needed);
36
our ($cleanup_needed);
37
37
38
SKIP: {
38
SKIP: {
Lines 131-146 SKIP: { Link Here
131
131
132
        $s->click( { href => '/admin/authorised_values.pl', main => 'doc' } ); #Authorized values
132
        $s->click( { href => '/admin/authorised_values.pl', main => 'doc' } ); #Authorized values
133
133
134
        $s->click( { href => '/admin/authorised_values.pl?op=add_form&category=Adult', main => 'doc3' } ); # New category
134
        $s->click( { href => { 'ends-with' => '/admin/authorised_values.pl?op=add_form' }, main => 'doc3' } ); # New category
135
        $s->fill_form( { authorised_value => 'Hardover', lib => 'Hardcover book'} );
135
        $s->fill_form( { category => $av_category } );
136
        $s->submit_form;
136
        $s->submit_form;
137
137
138
        $s->click(
138
        $s->click(
139
            {
139
            {
140
                href => '/admin/authorised_values.pl?op=delete&searchfield=Adult&id=400',
140
                href => '/admin/authorised_values.pl?op=add_form&category=' . $av_category,
141
                main => 'doc3'
142
            }
143
        );    # New authorised value for ...
144
        $s->fill_form(
145
            {
146
                authorised_value => "$av_category" . "_xxx",
147
                lib              => "This is a description for staff",
148
                lib_opac         => "This is a description for OPAC"
149
            }
150
        );
151
        $s->submit_form;
152
153
        my $dbh = C4::Context->dbh;
154
        my ( $av_id ) = $dbh->selectrow_array(q|
155
            SELECT id FROM authorised_values WHERE category=?|, undef, $av_category );
156
        $s->click(
157
            {
158
                href => '/admin/authorised_values.pl?op=delete&searchfield=' . $av_category . '&id=' . $av_id,
141
                main => 'doc3'
159
                main => 'doc3'
142
            }
160
            }
143
        );
161
        );
162
        $s->driver->accept_alert;
144
    };
163
    };
145
164
146
    { #Patron categories
165
    { #Patron categories
Lines 171-174 sub cleanup { Link Here
171
    $dbh->do(q|DELETE FROM itemtypes WHERE itemtype=?|, undef, $itemtype);
190
    $dbh->do(q|DELETE FROM itemtypes WHERE itemtype=?|, undef, $itemtype);
172
    $dbh->do(q|DELETE FROM biblio_framework WHERE frameworkcode=?|, undef, $frameworkcode);
191
    $dbh->do(q|DELETE FROM biblio_framework WHERE frameworkcode=?|, undef, $frameworkcode);
173
    $dbh->do(q|DELETE FROM branches WHERE branchcode=?|, undef, $branchcode);
192
    $dbh->do(q|DELETE FROM branches WHERE branchcode=?|, undef, $branchcode);
193
    $dbh->do(q|DELETE FROM authorised_value_categories WHERE category_name=?|, undef, $av_category);
174
}
194
}
(-)a/t/lib/Selenium.pm (-2 / +16 lines)
Lines 99-105 sub click { Link Here
99
        $xpath_selector = '//div[@id="'.$params->{main}.'"]';
99
        $xpath_selector = '//div[@id="'.$params->{main}.'"]';
100
    }
100
    }
101
    if ( exists $params->{href} ) {
101
    if ( exists $params->{href} ) {
102
        $xpath_selector .= '//a[contains(@href, "'.$params->{href}.'")]';
102
        if ( ref( $params->{href} ) ) {
103
            for my $k ( keys %{ $params->{href} } ) {
104
                if ( $k eq 'ends-with' ) {
105
                    # ends-with version for xpath version 1
106
                    my $ends_with = $params->{href}{"ends-with"};
107
                    $xpath_selector .= '//a[substring(@href, string-length(@href) - string-length("'.$ends_with.'") + 1 ) = "'.$ends_with.'"]';
108
                    # ends-with version for xpath version 2
109
                    #$xpath_selector .= '//a[ends-with(@href, "'.$ends_with.'") ]';
110
111
            } else {
112
                    die "Only ends-with is supported so far ($k)";
113
                }
114
            }
115
        } else {
116
            $xpath_selector .= '//a[contains(@href, "'.$params->{href}.'")]';
117
        }
103
    }
118
    }
104
    if ( exists $params->{id} ) {
119
    if ( exists $params->{id} ) {
105
        $xpath_selector .= '//*[@id="'.$params->{id}.'"]';
120
        $xpath_selector .= '//*[@id="'.$params->{id}.'"]';
106
- 

Return to bug 19243