[Rt-commit] rt branch, 4.6/select-queue-in-ticket-create, repushed
Aaron Trevena
ast at bestpractical.com
Fri Jan 24 08:01:29 EST 2020
The branch 4.6/select-queue-in-ticket-create was deleted and repushed:
was 1df7a27498a22a53d1133cebd9f20945d01f34ab
now 0f8723d2471ac989b1af7fd4d1504605c431628c
1: 771c36decf = 1: 771c36decf Select Queue in Ticket Create page
2: 1df7a27498 ! 2: 0f8723d247 Select Queue in Ticket Create page Tests
@@ -1,21 +1,9 @@
Author: Aaron Trevena <ast at bestpractical.com>
- Select Queue in Ticket Create page Tests and test dependancies
+ Select Queue in Ticket Create page Tests
Added new tests for creating tickets with custom fields and
lifecycles, and with or without queue specified
-
-diff --git a/etc/cpanfile b/etc/cpanfile
---- a/etc/cpanfile
-+++ b/etc/cpanfile
-@@
- requires 'Test::NoWarnings';
- requires 'Test::Pod';
- requires 'Test::Warn';
-+ requires 'Test::HTML::Form', '>= 1.01';
- requires 'Test::WWW::Mechanize', '>= 1.30';
- requires 'Test::WWW::Mechanize::PSGI';
- requires 'WWW::Mechanize', '>= 1.80';
diff --git a/t/customfields/access_via_queue.t b/t/customfields/access_via_queue.t
--- a/t/customfields/access_via_queue.t
@@ -298,14 +286,6 @@
--- a/t/web/csrf.t
+++ b/t/web/csrf.t
@@
- use warnings;
-
- use RT::Test tests => undef;
-+use Test::HTML::Form;
-
- my $ticket = RT::Ticket->new(RT::CurrentUser->new('root'));
- my ($ok, $msg) = $ticket->Create(Queue => 1, Owner => 'nobody', Subject => 'bad music');
-@@
$m->title_is('Possible cross-site request forgery');
# Sending a wrong CSRF is just a normal request. We'll make a request
@@ -329,8 +309,7 @@
$m->title_is('Create a new ticket in General');
-$m->text_unlike(qr/Queue:\s*Other queue/);
-$m->text_like(qr/Queue:\s*General/);
-+form_select_field_matches($m, { field_name => 'Queue', selected => 1, form_name => 'TicketCreate'}, 'Queue selection dropdown populated and pre-selected');
-+
++is($m->form_name('TicketCreate')->value('Queue'), 1, 'Queue selection dropdown populated and pre-selected');
# Ensure that file uploads work across the interstitial
$m->delete_header('Referer');
@@ -355,7 +334,6 @@
@@
+use strict;
+use warnings;
-+use Test::HTML::Form;
+
+use RT::Test tests => undef;
+use RT::Lifecycle;
@@ -402,28 +380,24 @@
+$m->submit_form(
+ form_name => "CreateTicketInQueue",
+);
-+no_tag($m,'input',{ name => $cf_form_id }, 'no custom field');
-+form_select_field_matches($m, { field_name => 'Queue', selected => $queue3->id,
-+ form_name => 'TicketCreate'}, 'Queue selection dropdown populated');
-+form_select_field_matches($m, { field_name => 'Status', selected => "new",
-+ form_name => 'TicketCreate'}, 'Status selection dropdown populated');
-+
++
++ok(!$m->form_name('TicketCreate')->find_input($cf_form_id), 'custom field not present');
++is($m->form_name('TicketCreate')->value('Queue'), $queue4->id, 'Queue selection dropdown populated and pre-selected');
++is($m->form_name('TicketCreate')->value('Status'), 'new', 'Status selection dropdown populated and pre-selected');
+
+$m->get_ok( '/Ticket/Create.html', 'go to ticket create page with no queue id' );
-+no_tag($m,'input',{ name => $cf_form_id }, 'no custom field');
-+form_select_field_matches($m, { field_name => 'Queue', selected => $queue3->id,
-+ form_name => 'TicketCreate'}, 'Queue selection dropdown populated');
-+form_select_field_matches($m, { field_name => 'Status', selected => "new",
-+ form_name => 'TicketCreate'}, 'Status selection dropdown populated');
++ok(!$m->form_name('TicketCreate')->find_input($cf_form_id), 'custom field not present');
++is($m->form_name('TicketCreate')->value('Queue'), $queue4->id, 'Queue selection dropdown populated and pre-selected');
++is($m->form_name('TicketCreate')->value('Status'), 'new', 'Status selection dropdown populated and pre-selected');
+
+# test ticket creation on reload from selected queue, specifying queue with custom fields
+note('reload ticket create page with selected queue');
+$m->get_ok( '/Ticket/Create.html?QueueChanged=1&Queue='.$queue1->id,
+ 'go to ticket create page' );
+
-+form_select_field_matches($m, { field_name => 'Queue', selected => $queue1->id,
-+ form_name => 'TicketCreate'}, 'Queue selection dropdown populated and pre-selected');
-+form_field_value_matches($m, $cf_form_id, "", 'TicketCreate', 'custom field is present');
++is($m->form_name('TicketCreate')->value('Queue'), $queue1->id, 'Queue selection dropdown populated and pre-selected');
++ok($m->form_name('TicketCreate')->find_input($cf_form_id), 'custom field present');
++is($m->form_name('TicketCreate')->value($cf_form_id), '', 'custom field present and empty');
+
+my $form = $m->form_name('TicketCreate');
+my $status_input = $form->find_input('Status');
More information about the rt-commit
mailing list