Skip to content

Commit

Permalink
Update tests for new classes on validation failure
Browse files Browse the repository at this point in the history
Also remove the catalog selection form submit since
we no longer present that as a separate modal before
the create asset page.
  • Loading branch information
cbrandtbuffalo committed Jan 2, 2025
1 parent 5ec2f55 commit 399fbdd
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions t/assets/web.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ my $material = create_cf( Name => 'Material' );
ok $material->id, "Created CF";

my %CF = (
Height => ".CF-" . $height->id . "-Edit form-control",
Material => ".CF-" . $material->id . "-Edit form-control",
Purchased => ".CF-" . $purchased->id . "-Edit form-control",
Height => ".CF-" . $height->id . "-Edit form-control ",
Material => ".CF-" . $material->id . "-Edit form-control ",
Purchased => ".CF-" . $purchased->id . "-Edit form-control ",
);

my ($base, $m) = RT::Test::Assets->started_ok;
Expand Down Expand Up @@ -57,11 +57,11 @@ diag "Create with CFs";
ok apply_cfs($height, $material), "Applied CFs";

$m->follow_link_ok({ id => "assets-create" }, "Asset create link");
$m->submit_form_ok({ with_fields => { Catalog => $catalog->id } }, "Picked a catalog");

ok $m->form_with_fields(qw(id Name Description)), "Found form";
$m->submit_form_ok({
fields => {
Catalog => $catalog->id,
id => 'new',
Name => 'Standing desk',
$CF{Height} => 'forty-six inches',
Expand All @@ -74,7 +74,7 @@ diag "Create with CFs";
# Intentionally fix only the invalid CF to test the other fields are
# preserved across errors
ok $m->form_with_fields(qw(id Name Description)), "Found form again";
$m->set_fields( $CF{Height} => '46"' );
$m->set_fields( $CF{Height} . 'is-invalid' => '46"' );
$m->submit_form_ok({}, "resubmitted form");

$m->content_like(qr/Asset .* created/, "Found created message");
Expand All @@ -92,17 +92,16 @@ diag "Create with CFs in other groups";
ok apply_cfs($purchased), "Applied CF";

$m->follow_link_ok({ id => "assets-create" }, "Asset create link");
$m->submit_form_ok({ with_fields => { Catalog => $catalog->id } }, "Picked a catalog");

ok $m->form_with_fields(qw(id Name Description)), "Found form";

$m->submit_form_ok({
fields => {
Catalog => $catalog->id ,
id => 'new',
Name => 'Chair',
$CF{Height} => '23',
},
}, "submited create form");
}, "submitted create form");

$m->content_like(qr/Asset .* created/, "Found created message");
$m->content_unlike(qr/Purchased.*?must match .*?Year/, "Lacks validation error for Purchased");
Expand Down

0 comments on commit 399fbdd

Please sign in to comment.