[Rt-commit] rt branch, 4.6/search-selection-next, repushed
Blaine Motsinger
blaine at bestpractical.com
Tue Mar 10 19:54:16 EDT 2020
The branch 4.6/search-selection-next was deleted and repushed:
was f8725a668bd5176265fa12ee4839fb0a43f8af81
now 3b4a80fbb35a7019a74ff171d0c5809e47589f70
1: 2aab9ecde = 1: 2aab9ecde Add RT-Extension-DashboardSelectionUI to core
2: 6deca7f57 = 2: 6deca7f57 Upgrade jQuery ui sortable and add disableSelection
3: dd7e3e5e8 = 3: dd7e3e5e8 Update DashboardSelectionUI to elevator-light
4: 5d2fb31b1 = 4: 5d2fb31b1 Switch remove icon to fontawesome
5: f554b70cb = 5: f554b70cb Fix reset to defaults
6: 0cc961e47 = 6: 0cc961e47 Force redirect back to the current page on submit
7: e5ff16c4d = 7: e5ff16c4d Add name to forms for UpdateDashboard
8: f8725a668 ! 8: 3b4a80fbb Update tests for MyRT Helper changes
@@ -407,3 +407,159 @@
for my $page (qw/Modify Queries Render Subscription/) {
$m->get("/Dashboards/$page.html?id=$bad_id");
+
+diff --git a/t/web/dashboards-search-cache.t b/t/web/dashboards-search-cache.t
+--- a/t/web/dashboards-search-cache.t
++++ b/t/web/dashboards-search-cache.t
+@@
+ use strict;
+ use warnings;
+
+-use RT::Test tests => 33;
++use RT::Test tests => undef;
+ my ($baseurl, $m) = RT::Test->started_ok;
+
+ my $url = $m->rt_base_url;
+@@
+ $m->click('SavedSearchSave');
+
+ # create the inner dashboard
+-$m->get_ok("$url/Dashboards/Modify.html?Create=1");
++$m->get_ok($url . "Dashboards/Modify.html?Create=1");
+ $m->form_name('ModifyDashboard');
+ $m->field('Name' => 'inner dashboard');
+ $m->click_button(value => 'Create');
+ $m->text_contains('Saved dashboard inner dashboard');
+
+ my ($inner_id) = $m->content =~ /name="id" value="(\d+)"/;
+-ok($inner_id, "got an ID, $inner_id");
++ok($inner_id, "got an ID for inner dashboard, $inner_id");
+
+ # create a dashboard
+-$m->get_ok("$url/Dashboards/Modify.html?Create=1");
++$m->get_ok($url . "Dashboards/Modify.html?Create=1");
+ $m->form_name('ModifyDashboard');
+ $m->field('Name' => 'cachey dashboard');
+ $m->click_button(value => 'Create');
+ $m->text_contains('Saved dashboard cachey dashboard');
+
+ my ($dashboard_id) = $m->content =~ /name="id" value="(\d+)"/;
+-ok($dashboard_id, "got an ID, $dashboard_id");
++ok($dashboard_id, "got an ID for cachey dashboard, $dashboard_id");
+
+ # add the search to the dashboard
+ $m->follow_link_ok({text => 'Content'});
+-my $form = $m->form_name('Dashboard-Searches-body');
+-my @input = $form->find_input('Searches-body-Available');
+-my ($search_value) =
+- map { ( $_->possible_values )[1] }
+- grep { ( $_->value_names )[1] =~ /Saved Search: Original Name/ } @input;
+-$form->value('Searches-body-Available' => $search_value );
+-$m->click_button(name => 'add');
+-$m->text_contains('Dashboard updated');
+
+-# add the dashboard to the dashboard
+-$m->follow_link_ok({text => 'Content'});
+-$form = $m->form_name('Dashboard-Searches-body');
+- at input = $form->find_input('Searches-body-Available');
+-my ($dashboard_value) =
+- map { ( $_->possible_values )[1] }
+- grep { ( $_->value_names )[1] =~ /Dashboard: inner dashboard/ } @input;
+-$form->value('Searches-body-Available' => $dashboard_value );
+-$m->click_button(name => 'add');
+-$m->text_contains('Dashboard updated');
++# we need to get the saved search id from the content before submitting the json.
++my ($saved_search_id) = $m->content =~ /data-type="saved" data-name="RT::User-14-SavedSearch-(\d+)"/;
++ok($saved_search_id, "got an ID for the saved search, $saved_search_id");
++
++# add 'Original Name' portlet to body
++my $payload = {
++ "dashboard_id" => $dashboard_id,
++ "panes" => {
++ "body" => [
++ {
++ "description" => "Original Name",
++ "name" => "RT::User-14-SavedSearch-" . $saved_search_id,
++ "searchId" => "",
++ "searchType" => "Ticket",
++ "type" => "saved"
++ },
++ ],
++ "sidebar" => [
++ ]
++ }
++};
++
++my $json = JSON::to_json( $payload );
++my $res = $m->post(
++ $url . 'Helpers/UpdateDashboard',
++ [ content => $json ],
++);
++is( $res->code, 200, "add 'Original Name' portlet to body" );
++
++# add 'inner dashboard' portlet to body
++push(
++ @{$payload->{panes}->{body}},
++ {
++ "description" => "inner dashboard",
++ "name" => "dashboard-" . $inner_id . "-RT::User-14",
++ "searchId" => "",
++ "searchType" => "",
++ "type" => "dashboard"
++ },
++);
++
++$json = JSON::to_json( $payload );
++$res = $m->post(
++ $url . 'Helpers/UpdateDashboard',
++ [ content => $json ],
++);
++is( $res->code, 200, "add 'inner dashboard' portlet to body" );
+
+ # subscribe to the dashboard
++$m->get_ok($url . "Dashboards/" . $dashboard_id . "/cachey%20dashboard");
+ $m->follow_link_ok({text => 'Subscription'});
+ $m->text_contains('Saved Search: Original Name');
+ $m->text_contains('Dashboard: inner dashboard');
+@@
+
+ # rename the search
+ $m->follow_link_ok({text => 'Tickets'}, 'to query builder');
+-$form = $m->form_name('BuildQuery');
+- at input = $form->find_input('SavedSearchLoad');
+-($search_value) =
++my $form = $m->form_name('BuildQuery');
++my @input = $form->find_input('SavedSearchLoad');
++my ($search_value) =
+ map { ( $_->possible_values )[1] }
+ grep { ( $_->value_names )[1] =~ /Original Name/ } @input;
+ $form->value('SavedSearchLoad' => $search_value );
+@@
+ $m->text_contains('Updated saved search "New Name"');
+
+ # rename the dashboard
+-$m->get_ok("/Dashboards/Modify.html?id=$inner_id");
++$m->get_ok($url . "Dashboards/Modify.html?id=$inner_id");
+ $m->form_name('ModifyDashboard');
+ $m->field('Name' => 'recursive dashboard');
+ $m->click_button(value => 'Save Changes');
+ $m->text_contains('Dashboard recursive dashboard updated');
+
+ # check subscription page again
+-$m->get_ok("/Dashboards/Subscription.html?id=$dashboard_id");
+ TODO: {
+ local $TODO = 'we cache search names too aggressively';
++ $m->get_ok($url . "Dashboards/Subscription.html?id=$dashboard_id");
+ $m->text_contains('Saved Search: New Name');
+ $m->text_unlike(qr/Saved Search: Original Name/); # t-w-m lacks text_lacks
+
+@@
+ $m->text_unlike(qr/Dashboard: inner dashboard/); # t-w-m lacks text_lacks
+ }
+
+-$m->get_ok("/Dashboards/Render.html?id=$dashboard_id");
++$m->get_ok($url . "Dashboards/Render.html?id=$dashboard_id");
+ $m->text_contains('New Name');
+ $m->text_unlike(qr/Original Name/); # t-w-m lacks text_lacks
++
++done_testing();
More information about the rt-commit
mailing list