Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for pending colors #16

Merged
merged 2 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions application/controllers/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,21 @@ private function loop_through($cur_suites) {
$this->suites_content .= '<div class="block_info tests_passed"><i class="material-icons">check</i> <div class="info ">'.$suite->totalPasses.'</div></div>';
}
if ($suite->totalFailures > 0) {
$this->suites_content .= '<div class="block_info tests_failed"><i class="material-icons">close</i> <div class="info ">'.$suite->totalFailures.'</div></div>';
$this->suites_content .= '<div class="block_info tests_failed"><i class="material-icons">clear</i> <div class="info ">'.$suite->totalFailures.'</div></div>';
}
if ($suite->totalSkipped> 0) {
$this->suites_content .= '<div class="block_info tests_skipped"><i class="material-icons">double_arrow</i> <div class="info ">'.$suite->totalSkipped.'</div></div>';
$this->suites_content .= '<div class="block_info tests_skipped"><i class="material-icons">pause</i> <div class="info ">'.$suite->totalSkipped.'</div></div>';
}
if ($suite->totalPending> 0) {
$this->suites_content .= '<div class="block_info tests_pending"><i class="material-icons">skip_next</i> <div class="info ">'.$suite->totalPending.'</div></div>';
$this->suites_content .= '<div class="block_info tests_pending"><i class="material-icons">pause</i> <div class="info ">'.$suite->totalPending.'</div></div>';
}
$this->suites_content .= '<div class="metric_container">';
$this->suites_content .= '<div class="metric">';
$this->suites_content .= '<div class="background"><div class="metric_number">'.(round($suite->totalPasses/count($suite->tests), 3) * 100).'%</div><div class="advancement" style="width:'.(round($suite->totalPasses/count($suite->tests), 3) * 100).'%"></div></div>';
$this->suites_content .= '
<div class="background"><div class="metric_number">'.(round($suite->totalPasses/count($suite->tests), 3) * 100).'%</div>
<div class="advancement advancement_pending" style="width:'.(round(($suite->totalPending+$suite->totalSkipped)/count($suite->tests), 3) * 100).'%"></div>
<div class="advancement advancement_passed" style="width:'.(round($suite->totalPasses/count($suite->tests), 3) * 100).'%"></div>
</div>';
$this->suites_content .= '</div>';
$this->suites_content .= '</div>';

Expand All @@ -144,20 +148,20 @@ private function loop_through($cur_suites) {
foreach ($suite->tests as $test) {
$icon = '';
if ($test->state == 'passed') {
$icon = '<i class="icon material-icons">check_circle</i>';
$icon = '<i class="icon material-icons">check</i>';
}
if ($test->state == 'failed') {
$icon = '<i class="icon material-icons">remove_circle</i>';
$icon = '<i class="icon material-icons">clear</i>';
}
if ($test->state == 'pending') {
$icon = '<i class="icon material-icons">double_arrow</i>';
$icon = '<i class="icon material-icons">pause</i>';
}
if ($test->state == 'skipped') {
$icon = '<i class="icon material-icons">error</i>';
$icon = '<i class="icon material-icons">pause</i>';
}
$this->suites_content .= '<section class="test_component '.$test->state.'">';
$this->suites_content .= '<div class="block_test">';
$this->suites_content .= '<div id="' . $test->uuid . '" class="test"><div class="test_' . $test->state . '"> ' .$icon.' <span class="test_title" id="' . $test->uuid . '">'.$test->title . '</span></div>';
$this->suites_content .= '<div id="' . $test->uuid . '" class="test"><div class="test_' . $test->state . '"> ' .$icon.' <div class="test_title" id="' . $test->uuid . '">'.$test->title . '</div></div>';
$this->suites_content .= '<div class="test_duration"><i class="material-icons">timer</i> '.format_duration($test->duration).'</div>';
if ($test->state == 'failed') {
$this->suites_content .= '<div class="test_info error_message">' . htmlentities($test->error_message) . '</div>';
Expand Down
12 changes: 6 additions & 6 deletions application/models/Execution.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ function getPreciseStats($criteria)
$req = "SELECT e.id, e.ref, e.start_date, DATE(e.start_date) custom_start_date,e.end_date, e.failures,
SUM(IF(t.error_message LIKE BINARY 'AssertionError: Expected File%', 1, 0)) file_not_found,
SUM(IF(t.error_message LIKE 'AssertionError:%' AND t.error_message NOT LIKE 'AssertionError: Expected File%', 1, 0)) value_expected,
SUM(IF(t.error_message REGEXP 'element(.*) still not existing', 1, 0)) not_visible_after_timeout,
SUM(IF(t.error_message LIKE '%An element could not%', 1, 0)) wrong_locator
SUM(IF((t.error_message REGEXP 'element(.*) still not existing' OR t.error_message REGEXP 'TimeoutError:*'), 1, 0)) not_visible_after_timeout,
SUM(IF((t.error_message LIKE '%An element could not%' OR t.error_message LIKE 'Error: No node found for selector*'), 1, 0)) wrong_locator
FROM $this->table e
INNER JOIN suite s ON s.execution_id = e.id
INNER JOIN test t ON t.suite_id = s.id
Expand Down Expand Up @@ -151,11 +151,11 @@ function getPreciseStats($criteria)
*/
function getExecutionPreciseStats($execution_id)
{
$req = "SELECT e.id,
SUM(IF(t.error_message LIKE 'AssertionError: Expected File%', 1, 0)) file_not_found, e.failures,
$req = "SELECT e.id, e.ref, e.start_date, DATE(e.start_date) custom_start_date,e.end_date, e.failures,
SUM(IF(t.error_message LIKE BINARY 'AssertionError: Expected File%', 1, 0)) file_not_found,
SUM(IF(t.error_message LIKE 'AssertionError:%' AND t.error_message NOT LIKE 'AssertionError: Expected File%', 1, 0)) value_expected,
SUM(IF(t.error_message REGEXP 'element(.*) still not existing', 1, 0)) not_visible_after_timeout,
SUM(IF(t.error_message LIKE '%An element could not%', 1, 0)) wrong_locator
SUM(IF((t.error_message REGEXP 'element(.*) still not existing' OR t.error_message REGEXP 'TimeoutError:*'), 1, 0)) not_visible_after_timeout,
SUM(IF((t.error_message LIKE '%An element could not%' OR t.error_message LIKE 'Error: No node found for selector*'), 1, 0)) wrong_locator
FROM execution e
INNER JOIN suite s ON s.execution_id = e.id
INNER JOIN test t ON t.suite_id = s.id
Expand Down
8 changes: 4 additions & 4 deletions application/views/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
$content = '';
if (is_object($execution)) {
if ($execution->passes > 0) {
$content .= '<div class="content_block count_passed" title="Tests passed"><i class="material-icons">check_circle_outline</i> ' . $execution->passes . '</div>';
$content .= '<div class="content_block count_passed" title="Tests passed"><i class="material-icons icon icon-passed">check</i> ' . $execution->passes . '</div>';
}
if ($execution->failures > 0) {
$content .= '<div class="content_block count_failed" title="Tests failed"><i class="material-icons">highlight_off</i> ' . $execution->failures . '</div>';
$content .= '<div class="content_block count_failed" title="Tests failed"><i class="material-icons icon icon-failed">clear</i> ' . $execution->failures . '</div>';
}
if ($execution->skipped > 0) {
$content .= '<div class="content_block count_skipped" title="Tests skipped"><i class="material-icons">radio_button_checked</i> ' . $execution->skipped . '</div>';
if ($execution->pending > 0) {
$content .= '<div class="content_block count_pending" title="Tests pending"><i class="material-icons icon icon-pending">pause</i> ' . $execution->pending . '</div>';
}
$download_link = '';
if (count($gcp_files_list) > 0) {
Expand Down
8 changes: 4 additions & 4 deletions application/views/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@
<i class="material-icons">assignment</i> <span><?php echo $execution->tests; ?></span>
</div>
<div class="recap_block passed_tests" title="Number of passed tests">
<i class="material-icons">check_circle_outline</i> <span><?php echo $execution->passes; ?></span>
<i class="material-icons">check</i> <span><?php echo $execution->passes; ?></span>
</div>
<?php
if ($execution->failures > 0) {
echo '<div class="recap_block failed_tests" title="Number of failed tests">
<i class="material-icons">highlight_off</i> <span>'.$execution->failures.'</span>
<i class="material-icons">clear</i> <span>'.$execution->failures.'</span>
</div>';
}
if ($execution->skipped > 0) {
echo '<div class="recap_block skipped_tests" title="Number of skipped tests">
<i class="material-icons">radio_button_checked</i> <span>'.$execution->skipped.'</span>
<i class="material-icons">pause</i> <span>'.$execution->skipped.'</span>
</div>';
}
if ($execution->pending > 0) {
echo '<div class="recap_block pending_tests" title="Number of pending tests (skipped on purpose)">
<i class="material-icons">double_arrow</i> <span>'.$execution->pending.'</span>
<i class="material-icons">pause</i> <span>'.$execution->pending.'</span>
</div>';
}
?>
Expand Down
91 changes: 66 additions & 25 deletions public/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ button:hover {
color: #E54848;
}

.recap_block.skipped_tests {
color: #C6C6C6;
.recap_block.skipped_tests, .recap_block.pending_tests {
color: #b3e5fc;
}

.suite {
Expand Down Expand Up @@ -321,13 +321,13 @@ button:hover {
}

.informations .block_info.tests_passed {
color: green;
color: #388e3c;
}
.informations .block_info.tests_failed {
color: red;
color: #d32f2f;
}
.informations .block_info.tests_skipped {
color: #a3a3a3;
.informations .block_info.tests_skipped, .informations .block_info.tests_pending {
color: #0288d1;
}

.test_container {
Expand All @@ -348,11 +348,15 @@ button:hover {
}

.test_component.passed:hover {
border-left: 3px solid green;
border-left: 3px solid #388e3c;
}

.test_component.failed:hover {
border-left: 3px solid red;
border-left: 3px solid #d32f2f;
}

.test_component.skipped:hover, .test_component.pending:hover {
border-left: 3px solid #0288d1;
}

.block_test {
Expand All @@ -363,6 +367,7 @@ button:hover {
.test {
position: relative;
line-height: 24px;
margin: 5px 0 2px 0;
}

.test i.icon {
Expand All @@ -372,19 +377,31 @@ button:hover {
}

.test_passed>.icon {
color: green;
color: #c8e6c9;
background-color: #4caf50;
}

.test_failed {
cursor: pointer;
}

.test_failed>.icon {
color: red;
color: #ffcdd2;
background-color: #d32f2f;
}

.test_pending, .test_skipped {
cursor: pointer;
}

.test_pending>.icon, .test_skipped>.icon {
color: #b3e5fc;
background-color: #0288d1;
}

.test_title {
margin-left: 30px;
margin-right: 80px;
font-size: 14px;
}

Expand All @@ -405,7 +422,7 @@ button:hover {
}

.test_info.error_message {
color: red;
color: #d32f2f;
}

.test .test_duration {
Expand All @@ -415,6 +432,7 @@ button:hover {
color: grey;
font-size: 14px;
line-height: 14px;
width: 80px;
}

.test .test_duration .material-icons {
Expand Down Expand Up @@ -524,11 +542,11 @@ hr {
.metric .background {
width: 150px;
height: 30px;
background-color: red;
background-color: #d32f2f;
position: relative;
border-radius: 5px;
}


.metric .background .metric_number {
position: absolute;
top: 0;
Expand All @@ -543,11 +561,18 @@ hr {
}

.metric .background .advancement {
background-color: green;
position: absolute;
top: 0;
bottom: 0;
left: 0;
margin: 0;
height: 30px;
}

.metric .background .advancement_passed {
float: left;
background-color: #4caf50;
}

.metric .background .advancement_pending {
float: right;
background-color: #0288d1;
}

.options {
Expand Down Expand Up @@ -651,19 +676,35 @@ tr td .content_block {
margin: 2px 5px;
}

tr td .content_block i {
line-height: 30px;
.material-icons.icon {
vertical-align: middle;
border-radius: 50%;
padding: 2px;
font-size: 15px;
}

.content_block.count_passed {
color: #388e3c;
}

.material-icons.icon-passed {
background-color: #c8e6c9;
}

.content_block.count_failed {
color: #d32f2f;
}

tr td .content_block.count_passed {
color: rgba(0, 128, 0, 0.8);
.material-icons.icon-failed {
background-color: #ffcdd2;
}

tr td .content_block.count_failed {
color: rgba(128, 0, 0, 0.8);
.content_block.count_pending {
color: #0288d1;
}

tr td .content_block.count_skipped {
.material-icons.icon-pending {
background-color: #b3e5fc;
}

tr td a {
Expand Down