TT#56376 selenium: capture screenshot if program crashes

Common.pm:
- Capture a screenshot when a program crashes
- Filename will depend on which program crashed i.e ctr_domain crashes are
named crash_domain.png, etc
- NOTE: this will only trigger in jenkins, since /results usually isnt
 mounted on workstations

Change-Id: I9b953ff2381ab19260ff4afbe2deeeff3ebc9188
changes/23/31123/2
Nico Schedel 6 years ago
parent a8711e0e7f
commit 856cc68e88

@ -361,7 +361,8 @@ sub popup_confirm_cancel {
}
sub crash_handler {
my($self) = @_;
my($self, $filename) = @_;
my $jenkins = $ENV{JENKINS};
is("tests", "failed", "This test wasnt successful, check complete test logs for more info");
diag("-----------------------SCRIPT HAS CRASHED-----------------------");
my $url = $self->driver->get_current_url();
@ -407,6 +408,10 @@ sub crash_handler {
diag("Tab Title: $title");
diag("Perl localtime(): $realtime");
}
if($jenkins) {
$self->driver->capture_screenshot($filename);
diag("Screenshot has been taken and is avalible in '/results'");
}
diag("----------------------------------------------------------------");
}
1;

@ -148,7 +148,7 @@ $run_ok = 1;
END {
if(!$run_ok) {
$c->crash_handler();
$c->crash_handler("/results/crash_admin.png");
}
done_testing;
}

@ -227,7 +227,7 @@ $run_ok = 1;
END {
if(!$run_ok) {
$c->crash_handler();
$c->crash_handler("/results/crash_billing.png");
}
done_testing;
}

@ -244,7 +244,7 @@ $run_ok = 1;
END {
if(!$run_ok) {
$c->crash_handler();
$c->crash_handler("/results/crash_customer.png");
}
done_testing;
}

@ -171,7 +171,7 @@ $run_ok = 1;
END {
if(!$run_ok) {
$c->crash_handler();
$c->crash_handler("/results/crash_domain.png");
}
done_testing;
}

@ -225,7 +225,7 @@ $run_ok = 1;
END {
if(!$run_ok) {
$c->crash_handler();
$c->crash_handler("/results/crash_emergency.png");
}
done_testing;
}

@ -183,7 +183,7 @@ $run_ok = 1;
END {
if(!$run_ok) {
$c->crash_handler();
$c->crash_handler("/results/crash_invoice.png");
}
done_testing;
}

@ -304,7 +304,7 @@ $run_ok = 1;
END {
if(!$run_ok) {
$c->crash_handler();
$c->crash_handler("/results/crash_ncos.png");
}
done_testing;
}

@ -330,7 +330,7 @@ $run_ok = 1;
END {
if(!$run_ok) {
$c->crash_handler();
$c->crash_handler("/results/crash_peering.png");
}
done_testing;
}

@ -229,7 +229,7 @@ $run_ok = 1;
END {
if(!$run_ok) {
$c->crash_handler();
$c->crash_handler("/results/crash_reseller.png");
}
done_testing;
}

@ -240,7 +240,7 @@ $run_ok = 1;
END {
if(!$run_ok) {
$c->crash_handler();
$c->crash_handler("/results/crash_rw_ruleset.png");
}
done_testing;
}

@ -416,7 +416,7 @@ $run_ok = 1;
END {
if(!$run_ok) {
$c->crash_handler();
$c->crash_handler("/results/crash_subscriber.png");
}
done_testing;
}

@ -163,7 +163,7 @@ $run_ok = 1;
END {
if(!$run_ok) {
$c->crash_handler();
$c->crash_handler("/results/crash_timeset.png");
}
done_testing;
}
Loading…
Cancel
Save