[Rt-commit] rt branch, 4.6/search-selection-next, repushed

Blaine Motsinger blaine at bestpractical.com
Thu Mar 12 17:38:13 EDT 2020


The branch 4.6/search-selection-next was deleted and repushed:
       was 7d7a5ec6c9af3d61141ac51ff1e002970a83b484
       now d3730cd86a8c645bbaf69ae25f381c1d74607fb5

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: 7d7a5ec6c ! 8: d3730cd86 Update tests for MyRT Helper changes
    @@ -6,6 +6,156 @@
         updated to now post JSON to a Helper, instead of form values to
         the page itself.  This commit updates the tests to also post JSON
         to the Helper.
    +
    +diff --git a/t/mail/dashboard-chart-with-utf8.t b/t/mail/dashboard-chart-with-utf8.t
    +--- a/t/mail/dashboard-chart-with-utf8.t
    ++++ b/t/mail/dashboard-chart-with-utf8.t
    +@@
    + $m->field( 'Name' => 'dashboard foo' );
    + $m->click_button( value => 'Create' );
    + 
    ++my ( $dashboard_id ) = ( $m->uri =~ /id=(\d+)/ );
    ++ok( $dashboard_id, "got an ID for the dashboard, $dashboard_id" );
    ++
    ++$m->get_ok( $baseurl . '/Dashboards/Queries.html?id=' . $dashboard_id );
    + $m->follow_link_ok( { text => 'Content' } );
    +-my $form  = $m->form_name('Dashboard-Searches-body');
    +-my @input = $form->find_input('Searches-body-Available');
    +-my ($dashboards_component) =
    +-  map { ( $_->possible_values )[1] }
    +-  grep { ( $_->value_names )[1] =~ /^Chart/ } @input;
    +-$form->value( 'Searches-body-Available' => $dashboards_component );
    +-$m->click_button( name => 'add' );
    +-$m->content_contains('Dashboard updated');
    + 
    ++# add content, Chart: chart foo, to dashboard body
    ++# we need to get the saved search id from the content before submitting the json.
    ++my $regex = qr/data-type="saved" data-name="RT::User-/ . $root->id . qr/-SavedSearch-(\d+)"/;
    ++my ( $saved_search_id ) = $m->content =~ /$regex/;
    ++ok( $saved_search_id, "got an ID for the saved search, $saved_search_id" );
    ++
    ++my $payload = {
    ++    "dashboard_id" => $dashboard_id,
    ++    "panes"        => {
    ++        "body"    => [
    ++            {
    ++              "description" => "chart foo",
    ++              "name" => "RT::User-" . $root->id . "-SavedSearch-" . $saved_search_id,
    ++              "searchId" => "",
    ++              "searchType" => "Chart",
    ++              "type" => "saved"
    ++            },
    ++        ],
    ++        "sidebar" => [
    ++        ],
    ++    }
    ++};
    ++
    ++my $json = JSON::to_json( $payload );
    ++my $res  = $m->post(
    ++    $baseurl . '/Helpers/UpdateDashboard',
    ++    [ content => $json ],
    ++);
    ++is( $res->code, 200, "add content 'Chart: chart foo' to dashboard body" );
    ++
    ++$m->get_ok( $baseurl . '/Dashboards/Queries.html?id=' . $dashboard_id );
    + $m->follow_link_ok( { text => 'Subscription' } );
    + $m->form_name('SubscribeDashboard');
    + $m->field( 'Frequency' => 'daily' );
    +
    +diff --git a/t/mail/dashboard-empty.t b/t/mail/dashboard-empty.t
    +--- a/t/mail/dashboard-empty.t
    ++++ b/t/mail/dashboard-empty.t
    +@@
    + ok( $m->login, 'logged in' );
    + 
    + sub create_dashboard {
    +-    my ($name, $suppress_if_empty, $assets) = @_;
    ++    my ($dashboard_name, $suppress_if_empty, $assets) = @_;
    + 
    +     # first, create and populate a "suppress if empty" dashboard
    +     $m->get_ok('/Dashboards/Modify.html?Create=1');
    +     $m->form_name('ModifyDashboard');
    +-    $m->field( 'Name' => $name );
    ++    $m->field( 'Name' => $dashboard_name );
    +     $m->click_button( value => 'Create' );
    + 
    ++    my ( $dashboard_id ) = ( $m->uri =~ /id=(\d+)/ );
    ++    ok( $dashboard_id, "got a dashboard ID, $dashboard_id" );
    ++
    +     $m->follow_link_ok( { text => 'Content' } );
    +-    my $form  = $m->form_name('Dashboard-Searches-body');
    +-    my @input = $form->find_input('Searches-body-Available');
    + 
    +     my $add_component = sub {
    +-        my $name = shift;
    +-        my ($dashboards_component) =
    +-          map { ( $_->possible_values )[1] }
    +-          grep { ( $_->value_names )[1] =~ $name } @input;
    +-        $form->value( 'Searches-body-Available' => $dashboards_component );
    +-        $m->click_button( name => 'add' );
    +-        $m->content_contains('Dashboard updated');
    ++        my $component_name = shift;
    ++
    ++        my $payload = {
    ++            "dashboard_id" => $dashboard_id,
    ++            "panes"        => {
    ++                "body" => [
    ++                ],
    ++                "sidebar" => [
    ++                ],
    ++            },
    ++        };
    ++
    ++        my $component = {
    ++            "description" => "",
    ++            "name" => "",
    ++            "searchId" => "",
    ++            "searchType" => "",
    ++            "type" => "",
    ++        };
    ++
    ++        if ( $component_name eq 'My Tickets' ) {
    ++            my ( $search_id ) = $m->content =~ /data-search-id="(\d+)" data-description="My Tickets"/;
    ++            ok( $search_id, "got an ID for the search, $search_id");
    ++
    ++            $component->{type}        = 'system';
    ++            $component->{description} = 'My Tickets';
    ++            $component->{searchId}    = $search_id;
    ++            $component->{name}        = 'My Tickets';
    ++        }
    ++        else {  # component_name is 'My Assets'
    ++            $component->{type}        = 'component';
    ++            $component->{description} = 'MyAssets';
    ++            $component->{name}        = 'MyAssets';
    ++        }
    ++
    ++        push @{$payload->{panes}->{body}}, $component;
    ++
    ++        my $json = JSON::to_json( $payload );
    ++        my $res  = $m->post(
    ++            $baseurl . '/Helpers/UpdateDashboard',
    ++            [ content => $json ],
    ++        );
    ++        is( $res->code, 200, "added '$component_name' to dashboard '$dashboard_name'" );
    +     };
    + 
    +     $add_component->('My Tickets') unless $assets;
    +     $add_component->('MyAssets') if $assets;
    + 
    ++    $m->get_ok('/Dashboards/Queries.html?id=' . $dashboard_id);
    +     $m->follow_link_ok( { text => 'Subscription' } );
    +     $m->form_name('SubscribeDashboard');
    +     $m->field( 'Frequency' => 'daily' );
    +@@
    +     $m->field( 'SuppressIfEmpty' => 1 ) if $suppress_if_empty;
    + 
    +     $m->click_button( name => 'Save' );
    +-    $m->content_contains("Subscribed to dashboard $name");
    ++    $m->content_contains("Subscribed to dashboard $dashboard_name");
    + }
    + 
    + create_dashboard('Suppress if empty', 1);
     
     diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
     --- a/t/mail/dashboards.t
    @@ -57,58 +207,15 @@
          $m->follow_link_ok({text => 'Show'});
          $m->title_is('Testing! Dashboard');
          $m->content_contains('My dashboards');
    -     $m->content_like(qr{<a href="/Dashboards/\d+/Testing!">Testing!</a>});
    --
    - }
    - 
    - sub create_subscription {
    -@@
    -     my $dashboard_id = $subscription->SubValue('DashboardId');
    -     ok($dashboard_id, 'got dashboard id');
    - 
    --
    -     return ($dashboard_id, $subscription_id);
    - }
    - 
    -@@
    -     Subject => $expected_subject,
    +@@
    +     BodyUnlike => qr/My dashboards/,
      );
      
     -
    - produces_no_dashboard_mail_ok(
    -     Name   => "no dashboard mail it's a dry run",
    -     All    => 1,
    -@@
    -     Subject =>  "[example.com] a Daily b Testing! c\n",
    - );
    - 
     -
      @mails = RT::Test->fetch_caught_mails;
      is(@mails, 0, "no mail leftover");
      
    -@@
    -     BodyUnlike => qr/My dashboards/,
    - );
    - 
    --
    --
    - @mails = RT::Test->fetch_caught_mails;
    - is(@mails, 0, "no mail leftover");
    - 
    -@@
    -     Time    => $bad_time,
    - );
    - 
    --
    - @mails = RT::Test->fetch_caught_mails;
    - is(@mails, 0, "no mail leftover");
    - 
    -@@
    -     Time    => $bad_time,
    - );
    - 
    --done_testing;
    -+done_testing();
     
     diff --git a/t/web/custom_frontpage.t b/t/web/custom_frontpage.t
     --- a/t/web/custom_frontpage.t
    @@ -309,7 +416,7 @@
          $m->content_contains($desc . " [more]", "found description: $desc");
      }
      
    -+done_testing();
    ++done_testing;
     
     diff --git a/t/web/dashboards-basics.t b/t/web/dashboards-basics.t
     --- a/t/web/dashboards-basics.t
    @@ -598,16 +705,14 @@
     +    [ content => $json ],
      );
     +is( $res->code, 200, "added search foo to dashboard" );
    -+
    -+$m->content_lacks('Unable to find search Saved Search: foo', 'deleted message is gone' );
      
     -$m->content_lacks('Deleted queries', 'deleted message is gone' );
     -$m->content_lacks( 'value="Update"', 'update button is gone too' );
    -+done_testing();
    - 
    +-
     -$m->get_warnings; # we'll get a lot of warnings because the deleted search
    -+__END__
    - 
    ++$m->content_lacks('Unable to find search Saved Search: foo', 'deleted message is gone' );
    + 
    ++done_testing;
     
     diff --git a/t/web/dashboards-search-cache.t b/t/web/dashboards-search-cache.t
     --- a/t/web/dashboards-search-cache.t
    @@ -763,4 +868,4 @@
      $m->text_contains('New Name');
      $m->text_unlike(qr/Original Name/); # t-w-m lacks text_lacks
     +
    -+done_testing();
    ++done_testing;



More information about the rt-commit mailing list