initial
This commit is contained in:
@@ -0,0 +1,205 @@
|
||||
@import "@wordpress/base-styles/colors.native"; // stylelint-disable-line scss/at-import-partial-extension
|
||||
|
||||
.vrts-test-run-receipt {
|
||||
position: relative;
|
||||
padding: 0 12px;
|
||||
margin: 30px auto 30px auto;
|
||||
background-color: #f6f7fb;
|
||||
box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.07);
|
||||
max-width: 280px;
|
||||
transition: box-shadow 0.2s;
|
||||
|
||||
@media (min-width: 851px) {
|
||||
max-width: 100%;
|
||||
margin: 8px 20px 20px;
|
||||
}
|
||||
|
||||
&:has(.vrts-test-run-receipt__link:hover),
|
||||
&:has(.vrts-test-run-receipt__link:focus-visible) {
|
||||
box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
--vrts-test-run-receipt-mask: radial-gradient(10px at top, #0000 97%, #000) 50% / 18.5px 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 100%;
|
||||
content: "";
|
||||
mask: var(--vrts-test-run-receipt-mask);
|
||||
display: block;
|
||||
height: 10px;
|
||||
background: inherit;
|
||||
}
|
||||
|
||||
&::after {
|
||||
--vrts-test-run-receipt-mask: radial-gradient(10px at bottom, #0000 97%, #000) 50% / 18.5px 100%;
|
||||
bottom: -10px;
|
||||
}
|
||||
|
||||
> * {
|
||||
padding: 12px 0;
|
||||
|
||||
&:where(:not(:last-child)) {
|
||||
border-bottom: 1px dashed #c3c4c7;
|
||||
}
|
||||
}
|
||||
|
||||
> svg {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
&__link {
|
||||
display: block;
|
||||
border: none;
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
|
||||
&:focus {
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding-top: 20px;
|
||||
|
||||
&-logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
justify-content: center;
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
|
||||
svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
|
||||
path {
|
||||
fill: #2c3338;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-info {
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
gap: 2px;
|
||||
|
||||
a {
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__info {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
column-gap: 10px;
|
||||
justify-content: center;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
&__pages-status,
|
||||
&__total {
|
||||
line-height: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
|
||||
&-heading,
|
||||
&-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
&-heading {
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
&-row {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
a {
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
display: -webkit-box;
|
||||
color: inherit;
|
||||
max-block-size: 16px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-decoration: none;
|
||||
white-space: initial;
|
||||
word-break: break-all;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__total {
|
||||
border-top: 1px dashed #c3c4c7;
|
||||
margin-top: 2px;
|
||||
|
||||
&-heading {
|
||||
font-size: 14px;
|
||||
|
||||
> :first-child {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
|
||||
&-row {
|
||||
font-size: 12px;
|
||||
|
||||
&--success {
|
||||
color: #4ab866;
|
||||
}
|
||||
|
||||
&--failed {
|
||||
color: #b32d2e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__trigger {
|
||||
font-size: 11px;
|
||||
line-height: 1.4;
|
||||
|
||||
.vrts-test-run-trigger {
|
||||
font-size: inherit;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
&-notes {
|
||||
color: #757575;
|
||||
}
|
||||
}
|
||||
|
||||
&__footer {
|
||||
text-transform: uppercase;
|
||||
text-align: center;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
use Vrts\Core\Utilities\Date_Time_Helpers;
|
||||
use Vrts\Core\Utilities\Url_Helpers;
|
||||
use Vrts\Models\Test_Run;
|
||||
|
||||
$trigger_note = Test_Run::get_trigger_note( $data['run'] );
|
||||
|
||||
?>
|
||||
|
||||
<div class="vrts-test-run-receipt">
|
||||
<?php if ( $data['alerts'] ) : ?>
|
||||
<a id="vrts-alert-receipt" class="vrts-test-run-receipt__link" data-vrts-alert="receipt" href="<?php echo esc_url( Url_Helpers::get_alert_page( 'receipt', $data['run']->id ) ); ?>"></a>
|
||||
<?php endif; ?>
|
||||
<div class="vrts-test-run-receipt__header">
|
||||
<div class="vrts-test-run-receipt__header-logo">
|
||||
<?php vrts()->logo(); ?>
|
||||
<?php esc_html_e( 'VRTs Plugin', 'visual-regression-tests' ); ?>
|
||||
</div>
|
||||
<div class="vrts-test-run-receipt__header-info">
|
||||
<?php esc_html_e( 'Test Receipt', 'visual-regression-tests' ); ?>
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( home_url( '/' ) ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vrts-test-run-receipt__info">
|
||||
<?php
|
||||
// translators: %s: the run number.
|
||||
printf( esc_html__( 'Run #%s', 'visual-regression-tests' ), esc_html( $data['run']->id ) );
|
||||
?>
|
||||
<?php echo wp_kses( Date_Time_Helpers::get_formatted_relative_date_time( $data['run']->finished_at ), [ 'time' => [ 'datetime' => true ] ] ); ?>
|
||||
</div>
|
||||
<div class="vrts-test-run-receipt__pages-status">
|
||||
<div class="vrts-test-run-receipt__pages-status-heading">
|
||||
<span><?php esc_html_e( 'Page', 'visual-regression-tests' ); ?></span>
|
||||
<span><?php esc_html_e( 'Difference', 'visual-regression-tests' ); ?></span>
|
||||
</div>
|
||||
<?php
|
||||
foreach ( $data['tests'] as $test ) :
|
||||
$alert = array_values( array_filter( $data['alerts'], static function ( $alert ) use ( $test ) {
|
||||
return $alert->post_id === $test['post_id'];
|
||||
} ) );
|
||||
$difference = $alert ? ceil( $alert[0]->differences ) : 0;
|
||||
?>
|
||||
<div class="vrts-test-run-receipt__pages-status-row">
|
||||
<?php if ( $test['permalink'] ) : ?>
|
||||
<a href="<?php echo esc_url( $test['permalink'] ); ?>"><?php echo esc_html( Url_Helpers::make_relative( $test['permalink'] ) ); ?></a>
|
||||
<?php else : ?>
|
||||
N/A
|
||||
<?php endif; ?>
|
||||
<span>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s. Test run receipt diff in pixels */
|
||||
esc_html_x( '%spx', 'test run receipt difference', 'visual-regression-tests' ),
|
||||
esc_html( number_format_i18n( $difference ) )
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="vrts-test-run-receipt__total">
|
||||
<div class="vrts-test-run-receipt__total-heading">
|
||||
<span><?php esc_html_e( 'Total', 'visual-regression-tests' ); ?></span>
|
||||
<span>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s. Number of tests */
|
||||
esc_html( _n( '%s Test', '%s Tests', count( $data['tests'] ), 'visual-regression-tests' ) ), count( $data['tests'] )
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="vrts-test-run-receipt__total-row vrts-test-run-receipt__total-row--success">
|
||||
<span><?php esc_html_e( 'Passed', 'visual-regression-tests' ); ?></span>
|
||||
<span>
|
||||
<?php
|
||||
$passed_tests_count = count( $data['tests'] ) - count( $data['alerts'] );
|
||||
printf(
|
||||
/* translators: %s. Number of tests */
|
||||
esc_html( _n( '%s Test', '%s Tests', $passed_tests_count, 'visual-regression-tests' ) ), esc_html( $passed_tests_count )
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="vrts-test-run-receipt__total-row vrts-test-run-receipt__total-row--failed">
|
||||
<span><?php esc_html_e( 'Changes detected', 'visual-regression-tests' ); ?></span>
|
||||
<span>
|
||||
<?php
|
||||
$changed_detected_count = count( $data['alerts'] );
|
||||
printf(
|
||||
/* translators: %s. Number of tests */
|
||||
esc_html( _n( '%s Test', '%s Tests', $changed_detected_count, 'visual-regression-tests' ) ), esc_html( $changed_detected_count )
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vrts-test-run-receipt__trigger">
|
||||
<?php esc_html_e( 'Trigger', 'visual-regression-tests' ); ?>
|
||||
<span class="vrts-test-run-trigger vrts-test-run-trigger--<?php echo esc_attr( $data['run']->trigger ); ?>">
|
||||
<?php echo esc_html( Test_Run::get_trigger_title( $data['run'] ) ); ?>
|
||||
</span>
|
||||
<?php if ( ! empty( $trigger_note ) ) : ?>
|
||||
<span class="vrts-test-run-receipt__trigger-notes" title="<?php echo esc_attr( $trigger_note ); ?>">
|
||||
<?php echo esc_html( $trigger_note ); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="vrts-test-run-receipt__footer">
|
||||
<?php esc_html_e( 'Test Completed!', 'visual-regression-tests' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user