summaryrefslogtreecommitdiff
path: root/rt/t/web
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2017-08-06 10:11:28 -0700
committerIvan Kohler <ivan@freeside.biz>2017-08-06 11:55:09 -0700
commit740834abbf5434a60a7ded2c0b48430420e995a9 (patch)
tree6fe0a5d44681215894e1de5f803390614a0c0bf8 /rt/t/web
parentc15f44fcb8de4a64edf8f6d35c2de4392be7464e (diff)
rt 4.2.14 (#13852)
Diffstat (limited to 'rt/t/web')
-rw-r--r--rt/t/web/cf_groupings.t2
-rw-r--r--rt/t/web/cf_textarea.t11
-rw-r--r--rt/t/web/csrf.t14
-rw-r--r--rt/t/web/dashboards-in-menu.t22
-rw-r--r--rt/t/web/gnupg-select-keys-on-create.t47
-rw-r--r--rt/t/web/gnupg-select-keys-on-update.t45
-rw-r--r--rt/t/web/installer.t5
-rw-r--r--rt/t/web/language_update.t4
8 files changed, 98 insertions, 52 deletions
diff --git a/rt/t/web/cf_groupings.t b/rt/t/web/cf_groupings.t
index 0a40f71af..03ca60ad5 100644
--- a/rt/t/web/cf_groupings.t
+++ b/rt/t/web/cf_groupings.t
@@ -65,7 +65,7 @@ my $id = $m->get_ticket_id;
foreach my $grouping (@groupings) {
my $row_id = "CF-$CF{$grouping}-ShowRow";
is $dom->find(qq{#$row_id})->size, 1, "CF on the page";
- is $dom->at(qq{#$row_id})->all_text, "Test$grouping: Test${grouping}Value", "value is set";
+ like $dom->at(qq{#$row_id})->all_text, qr/Test$grouping:\s*Test${grouping}Value/, "value is set";
ok $dom->at(qq{$location{$grouping} #$row_id}), "CF is in the right place";
}
}
diff --git a/rt/t/web/cf_textarea.t b/rt/t/web/cf_textarea.t
index d11bda4d5..444020eae 100644
--- a/rt/t/web/cf_textarea.t
+++ b/rt/t/web/cf_textarea.t
@@ -27,6 +27,10 @@ my $cfs = {
type => 'FreeformSingle',
name => 'TheControlField',
},
+ zero => {
+ type => 'FreeformSingle',
+ name => 'Zero',
+ },
};
while ( my( $label, $data ) = each %$cfs ) {
@@ -55,10 +59,13 @@ $m->submit_form_ok({
$cfs->{area}{input} . '-Magic' => "1",
$cfs->{text}{input} => 'value a',
$cfs->{text}{input} . '-Magic' => "1",
+ $cfs->{zero}{input} => '0',
+ $cfs->{zero}{input} . '-Magic' => "1",
},
}, 'submitted form to initially set CFs');
$m->content_contains('<li>TheControlField value a added</li>');
$m->content_contains("<li>TheTextarea $content added</li>", 'content found');
+$m->content_contains("<li>Zero 0 added</li>", 'zero field found');
# http://issues.bestpractical.com/Ticket/Display.html?id=30378
# #30378: RT 4.2.6 - Very long text fields get updated even when they haven't changed
@@ -71,5 +78,9 @@ $m->submit_form_ok({
$m->content_contains('<li>TheControlField value a changed to value b</li>');
$m->content_lacks("<li>TheTextarea $content changed to $content</li>", 'textarea wasnt updated');
+# http://issues.bestpractical.com/Ticket/Display.html?id=32440
+# #32440: Spurious "CF changed from 0 to 0"
+$m->content_lacks("<li>Zero 0 changed to 0</li>", "Zero wasn't updated");
+
undef $m;
done_testing;
diff --git a/rt/t/web/csrf.t b/rt/t/web/csrf.t
index 3fea28788..ca52122ff 100644
--- a/rt/t/web/csrf.t
+++ b/rt/t/web/csrf.t
@@ -87,7 +87,7 @@ $m->content_lacks('Possible cross-site request forgery');
$m->add_header(Referer => 'http://example.net');
$m->get_ok($test_page);
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/Ticket/Create.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/Ticket/Create.html</tt>");
$m->content_contains("the Referrer header supplied by your browser (example.net:80) is not allowed");
$m->title_is('Possible cross-site request forgery');
@@ -109,7 +109,7 @@ $m->title_is('#1: bad music');
# now a non-whitelisted argument
$m->get_ok("/Ticket/Display.html?id=1&Action=Take");
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/Ticket/Display.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/Ticket/Display.html</tt>");
$m->content_contains("the Referrer header supplied by your browser (example.net:80) is not allowed");
$m->title_is('Possible cross-site request forgery');
@@ -124,7 +124,7 @@ $m->content_contains('Owner changed from Nobody to root');
$m->add_header(Referer => undef);
$m->get_ok($test_page);
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/Ticket/Create.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/Ticket/Create.html</tt>");
$m->content_contains("your browser did not supply a Referrer header");
$m->title_is('Possible cross-site request forgery');
@@ -138,7 +138,7 @@ $m->title_is('Create a new ticket');
$m->add_header(Referer => undef);
$m->get_ok($test_page);
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/Ticket/Create.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/Ticket/Create.html</tt>");
$m->content_contains("your browser did not supply a Referrer header");
$m->title_is('Possible cross-site request forgery');
@@ -161,7 +161,7 @@ my ($token) = $m->content =~ m{CSRF_Token=(\w+)};
$m->add_header(Referer => undef);
$m->get_ok("/Admin/Queues/Modify.html?id=new&Name=test&CSRF_Token=$token");
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/Admin/Queues/Modify.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/Admin/Queues/Modify.html</tt>");
$m->content_contains("your browser did not supply a Referrer header");
$m->title_is('Possible cross-site request forgery');
@@ -194,7 +194,7 @@ $m->field('Attach', $logofile);
$m->add_header(Referer => undef);
$m->submit;
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/Ticket/Create.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/Ticket/Create.html</tt>");
$m->follow_link(text_regex => qr{resume your request});
$m->content_contains('Download bpslogo.png', 'page has file name');
$m->follow_link_ok({text => "Download bpslogo.png"});
@@ -214,7 +214,7 @@ $m->content_contains("My open tickets", "got self-service interface");
$m->add_header(Referer => undef);
$m->get_ok("/SelfService/Create.html?Queue=1");
$m->content_contains("Possible cross-site request forgery");
-$m->content_contains("If you really intended to visit <tt>/SelfService/Create.html</tt>");
+$m->content_contains("If you really intended to visit <tt>$baseurl/SelfService/Create.html</tt>");
$m->content_contains("your browser did not supply a Referrer header");
$m->title_is('Possible cross-site request forgery');
diff --git a/rt/t/web/dashboards-in-menu.t b/rt/t/web/dashboards-in-menu.t
index 3126d55c3..8333313bf 100644
--- a/rt/t/web/dashboards-in-menu.t
+++ b/rt/t/web/dashboards-in-menu.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Test tests => 31;
+use RT::Test tests => undef;
my ($baseurl, $m) = RT::Test->started_ok;
my $system_foo = RT::Dashboard->new($RT::SystemUser);
@@ -75,11 +75,29 @@ $m->content_contains( 'Preferences saved for dashboards in menu.',
'prefs saved' );
$m->follow_link_ok( { text => 'self bar' }, 'follow self bar link' );
$m->title_is( 'self bar Dashboard', 'got self bar dashboard page' );
+
+diag "Test deleting dashboard";
+$m->follow_link_ok( { text => 'self foo' }, 'follow self foo link' );
+$m->follow_link_ok( { text => 'Basics' }, 'Click dashboard Basics' );
+$m->form_name('ModifyDashboard');
+$m->click_button(name => 'Delete');
+
+diag "Reset dashboard menu";
$m->get_ok( $baseurl."/Prefs/DashboardsInMenu.html");
$m->form_with_fields('Reset');
$m->click;
$m->content_contains( 'Preferences saved', 'prefs saved' );
ok( $m->find_link( text => 'system foo' ), 'got system foo link' );
-ok( !$m->find_link( text => 'self foo' ), 'no self foo link' );
ok( !$m->find_link( text => 'self bar' ), 'no self bar link' );
+diag "Delete system dashboard";
+$m->get_ok( $baseurl . "/Dashboards/index.html" );
+$m->follow_link_ok( { text => 'system foo' }, 'follow self foo link' );
+$m->follow_link_ok( { text => 'Basics' }, 'Click dashboard Basics' );
+$m->form_name('ModifyDashboard');
+$m->click_button(name => 'Delete');
+$m->get_ok( $baseurl . "/Dashboards/index.html" );
+$m->content_lacks('system foo', 'Dashboard is deleted');
+
+undef $m;
+done_testing;
diff --git a/rt/t/web/gnupg-select-keys-on-create.t b/rt/t/web/gnupg-select-keys-on-create.t
index e30b264d9..131f4c5cd 100644
--- a/rt/t/web/gnupg-select-keys-on-create.t
+++ b/rt/t/web/gnupg-select-keys-on-create.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Test::GnuPG tests => 79, gnupg_options => { passphrase => 'rt-test' };
+use RT::Test::GnuPG tests => undef, gnupg_options => { passphrase => 'rt-test' };
use RT::Action::SendEmail;
my $queue = RT::Test->load_or_create_queue(
@@ -73,7 +73,7 @@ diag "check that things don't work if there is no key";
diag "import first key of rt-test\@example.com";
my $fpr1 = '';
{
- RT::Test->import_gnupg_key('rt-test@example.com', 'public');
+ RT::Test->import_gnupg_key('rt-test@example.com', 'secret');
my %res = RT::Crypt->GetKeysInfo( Key => 'rt-test@example.com' );
is $res{'info'}[0]{'TrustLevel'}, 0, 'is not trusted key';
$fpr1 = $res{'info'}[0]{'Fingerprint'};
@@ -122,7 +122,7 @@ diag "check that things still doesn't work if key is not trusted";
diag "import a second key of rt-test\@example.com";
my $fpr2 = '';
{
- RT::Test->import_gnupg_key('rt-test@example.com.2', 'public');
+ RT::Test->import_gnupg_key('rt-test@example.com.2', 'secret');
my %res = RT::Crypt->GetKeysInfo( Key => 'rt-test@example.com' );
is $res{'info'}[1]{'TrustLevel'}, 0, 'is not trusted key';
$fpr2 = $res{'info'}[2]{'Fingerprint'};
@@ -239,37 +239,44 @@ diag "check that key selector works and we can select trusted key";
}
diag "check encrypting of attachments";
-{
+for my $encrypt (0, 1) {
RT::Test->clean_caught_mails;
ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
$m->form_name('TicketCreate');
- $m->tick( Encrypt => 1 );
- $m->field( Requestors => 'rt-test@example.com' );
+ $m->tick( Encrypt => 1 ) if $encrypt;
+ $m->field( Requestors => '' );
+ $m->field( Cc => 'rt-test@example.com' );
$m->field( Content => 'Some content' );
$m->field( Attach => $0 );
$m->submit;
- $m->content_contains(
- 'You are going to encrypt outgoing email messages',
- 'problems with keys'
- );
- $m->content_contains(
- 'There are several keys suitable for encryption',
- 'problems with keys'
- );
- my $form = $m->form_name('TicketCreate');
- ok my $input = $form->find_input( 'UseKey-rt-test@example.com' ), 'found key selector';
- is scalar $input->possible_values, 2, 'two options';
+ if ($encrypt) {
+ $m->content_contains(
+ 'You are going to encrypt outgoing email messages',
+ 'problems with keys'
+ );
+ $m->content_contains(
+ 'There are several keys suitable for encryption',
+ 'problems with keys'
+ );
+
+ my $form = $m->form_name('TicketCreate');
+ ok my $input = $form->find_input( 'UseKey-rt-test@example.com' ), 'found key selector';
+ is scalar $input->possible_values, 2, 'two options';
+
+ $m->select( 'UseKey-rt-test@example.com' => $fpr1 );
+ $m->submit;
+ }
- $m->select( 'UseKey-rt-test@example.com' => $fpr1 );
- $m->submit;
$m->content_like( qr/Ticket \d+ created in queue/i, 'ticket created' );
my @mail = RT::Test->fetch_caught_mails;
ok @mail, 'there are some emails';
- check_text_emails( { Encrypt => 1, Attachment => 1 }, @mail );
+ check_text_emails( { Encrypt => $encrypt, Attachment => "Attachment content" }, @mail );
$m->no_warnings_ok;
}
+undef $m;
+done_testing;
diff --git a/rt/t/web/gnupg-select-keys-on-update.t b/rt/t/web/gnupg-select-keys-on-update.t
index a666851db..24d22e708 100644
--- a/rt/t/web/gnupg-select-keys-on-update.t
+++ b/rt/t/web/gnupg-select-keys-on-update.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Test::GnuPG tests => 86, gnupg_options => { passphrase => 'rt-test' };
+use RT::Test::GnuPG tests => undef, gnupg_options => { passphrase => 'rt-test' };
use RT::Action::SendEmail;
@@ -90,7 +90,7 @@ diag "check that things don't work if there is no key";
diag "import first key of rt-test\@example.com";
my $fpr1 = '';
{
- RT::Test->import_gnupg_key('rt-test@example.com', 'public');
+ RT::Test->import_gnupg_key('rt-test@example.com', 'secret');
my %res = RT::Crypt->GetKeysInfo( Key => 'rt-test@example.com' );
is $res{'info'}[0]{'TrustLevel'}, 0, 'is not trusted key';
$fpr1 = $res{'info'}[0]{'Fingerprint'};
@@ -140,7 +140,7 @@ diag "check that things still doesn't work if key is not trusted";
diag "import a second key of rt-test\@example.com";
my $fpr2 = '';
{
- RT::Test->import_gnupg_key('rt-test@example.com.2', 'public');
+ RT::Test->import_gnupg_key('rt-test@example.com.2', 'secret');
my %res = RT::Crypt->GetKeysInfo( Key => 'rt-test@example.com' );
is $res{'info'}[1]{'TrustLevel'}, 0, 'is not trusted key';
$fpr2 = $res{'info'}[2]{'Fingerprint'};
@@ -260,37 +260,44 @@ diag "check that key selector works and we can select trusted key";
}
diag "check encrypting of attachments";
-{
+for my $encrypt (0, 1) {
RT::Test->clean_caught_mails;
ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
$m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
$m->form_name('TicketUpdate');
- $m->tick( Encrypt => 1 );
+ $m->tick( Encrypt => 1 ) if $encrypt;
$m->field( UpdateCc => 'rt-test@example.com' );
$m->field( UpdateContent => 'Some content' );
$m->field( Attach => $0 );
$m->click('SubmitTicket');
- $m->content_contains(
- 'You are going to encrypt outgoing email messages',
- 'problems with keys'
- );
- $m->content_contains(
- 'There are several keys suitable for encryption',
- 'problems with keys'
- );
- my $form = $m->form_name('TicketUpdate');
- ok my $input = $form->find_input( 'UseKey-rt-test@example.com' ), 'found key selector';
- is scalar $input->possible_values, 2, 'two options';
+ if ($encrypt) {
+ $m->content_contains(
+ 'You are going to encrypt outgoing email messages',
+ 'problems with keys'
+ );
+ $m->content_contains(
+ 'There are several keys suitable for encryption',
+ 'problems with keys'
+ );
+
+ my $form = $m->form_name('TicketUpdate');
+ ok my $input = $form->find_input( 'UseKey-rt-test@example.com' ), 'found key selector';
+ is scalar $input->possible_values, 2, 'two options';
+
+ $m->select( 'UseKey-rt-test@example.com' => $fpr1 );
+ $m->click('SubmitTicket');
+ }
- $m->select( 'UseKey-rt-test@example.com' => $fpr1 );
- $m->click('SubmitTicket');
$m->content_contains('Correspondence added', 'Correspondence added' );
my @mail = RT::Test->fetch_caught_mails;
ok @mail, 'there are some emails';
- check_text_emails( { Encrypt => 1, Attachment => 1 }, @mail );
+ check_text_emails( { Encrypt => $encrypt, Attachment => "Attachment content" }, @mail );
$m->no_warnings_ok;
}
+
+undef $m;
+done_testing;
diff --git a/rt/t/web/installer.t b/rt/t/web/installer.t
index 79198a7e8..a690e1a22 100644
--- a/rt/t/web/installer.t
+++ b/rt/t/web/installer.t
@@ -71,9 +71,12 @@ diag "Walking through install screens setting defaults";
}, 'set root password');
# Mail options
+ my $sendmail = File::Spec->rel2abs( File::Spec->catfile(
+ 't', 'security', 'fake-sendmail' ) );
$m->submit_form_ok({
with_fields => {
- OwnerEmail => 'admin@example.com',
+ OwnerEmail => 'admin@example.com',
+ SendmailPath => $sendmail,
},
}, 'set admin email');
diff --git a/rt/t/web/language_update.t b/rt/t/web/language_update.t
index 35082f886..61e094d82 100644
--- a/rt/t/web/language_update.t
+++ b/rt/t/web/language_update.t
@@ -10,13 +10,13 @@ $m->form_with_fields('Lang');
$m->field(Lang => 'zh_TW');
$m->submit;
-$m->text_contains(Encode::decode("UTF-8","並讓現存的 iCal feeds不再能用"), "successfully updated to zh_TW");
+$m->text_contains(Encode::decode("UTF-8","電子郵件信箱"), "successfully updated to zh_TW");
$m->text_contains(Encode::decode("UTF-8","使用語言 的值從 (無) 改為 'zh_TW'"), "when updating to language zh_TW, results are in zh_TW");
$m->form_with_fields('Lang');
$m->field(Lang => 'en_us');
$m->submit;
-$m->text_contains("breaking all existing iCal feeds", "successfully updated to en_us");
+$m->text_contains("Email", "successfully updated to en_us");
$m->text_contains("Lang changed from 'zh_TW' to 'en_us'", "when updating to language en_us, results are in en_us");