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 132-147 SKIP: { Link Here
132
132
133
        $s->click( { href => '/admin/authorised_values.pl', main => 'doc' } ); #Authorized values
133
        $s->click( { href => '/admin/authorised_values.pl', main => 'doc' } ); #Authorized values
134
134
135
        $s->click( { href => '/admin/authorised_values.pl?op=add_form&category=Adult', main => 'doc3' } ); # New category
135
        $s->click( { href => { 'ends-with' => '/admin/authorised_values.pl?op=add_form' }, main => 'doc3' } ); # New category
136
        $s->fill_form( { authorised_value => 'Hardover', lib => 'Hardcover book'} );
136
        $s->fill_form( { category => $av_category } );
137
        $s->submit_form;
137
        $s->submit_form;
138
138
139
        $s->click(
139
        $s->click(
140
            {
140
            {
141
                href => '/admin/authorised_values.pl?op=delete&searchfield=Adult&id=400',
141
                href => '/admin/authorised_values.pl?op=add_form&category=' . $av_category,
142
                main => 'doc3'
143
            }
144
        );    # New authorised value for ...
145
        $s->fill_form(
146
            {
147
                authorised_value => "$av_category" . "_xxx",
148
                lib              => "This is a description for staff",
149
                lib_opac         => "This is a description for OPAC"
150
            }
151
        );
152
        $s->submit_form;
153
154
        my $dbh = C4::Context->dbh;
155
        my ( $av_id ) = $dbh->selectrow_array(q|
156
            SELECT id FROM authorised_values WHERE category=?|, undef, $av_category );
157
        $s->click(
158
            {
159
                href => '/admin/authorised_values.pl?op=delete&searchfield=' . $av_category . '&id=' . $av_id,
142
                main => 'doc3'
160
                main => 'doc3'
143
            }
161
            }
144
        );
162
        );
163
        $s->driver->accept_alert;
145
    };
164
    };
146
165
147
    { #Patron categories
166
    { #Patron categories
Lines 172-175 sub cleanup { Link Here
172
    $dbh->do(q|DELETE FROM itemtypes WHERE itemtype=?|, undef, $itemtype);
191
    $dbh->do(q|DELETE FROM itemtypes WHERE itemtype=?|, undef, $itemtype);
173
    $dbh->do(q|DELETE FROM biblio_framework WHERE frameworkcode=?|, undef, $frameworkcode);
192
    $dbh->do(q|DELETE FROM biblio_framework WHERE frameworkcode=?|, undef, $frameworkcode);
174
    $dbh->do(q|DELETE FROM branches WHERE branchcode=?|, undef, $branchcode);
193
    $dbh->do(q|DELETE FROM branches WHERE branchcode=?|, undef, $branchcode);
194
    $dbh->do(q|DELETE FROM authorised_value_categories WHERE category_name=?|, undef, $av_category);
175
}
195
}
(-)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