Compare commits

...

4 Commits

Author SHA1 Message Date
Constantin Graf
83e17d4a40 Updated composer dependencies 2024-11-16 16:18:06 +01:00
Gregor Vostrak
5b27853546 Add e2e test for live timer 2024-11-15 18:04:39 +01:00
Gregor Vostrak
f49f7b2c9b fix live timer after reload 2024-11-15 16:48:02 +01:00
Constantin Graf
9e77500d94 Extended healthcheck debug in debug mode 2024-11-15 13:17:33 +01:00
8 changed files with 712 additions and 612 deletions

View File

@@ -14,7 +14,7 @@ class ActiveUserOverview extends BaseWidget
{
protected static ?int $sort = 1;
protected static ?string $heading = 'A Registrations';
protected ?string $heading = 'A Registrations';
protected function getCards(): array
{

View File

@@ -45,18 +45,34 @@ class HealthCheckController extends Controller
$dbTimezone = DB::select('show timezone;');
$response = [
'ip_address' => $ipAddress,
'url' => $request->url(),
'path' => $request->path(),
'hostname' => $hostname,
'timestamp' => Carbon::now()->timestamp,
'date_time_utc' => Carbon::now('UTC')->toDateTimeString(),
'date_time_app' => Carbon::now()->toDateTimeString(),
'timezone' => $dbTimezone[0]->TimeZone,
'secure' => $secure,
'is_trusted_proxy' => $isTrustedProxy,
];
if (app()->hasDebugModeEnabled()) {
$response['app_debug'] = true;
$response['app_url'] = config('app.url');
$response['app_env'] = app()->environment();
$response['app_timezone'] = config('app.timezone');
$response['app_force_https'] = config('app.force_https');
$response['trusted_proxies'] = config('trustedproxy.proxies');
$headers = $request->headers->all();
if (isset($headers['cookie'])) {
$headers['cookie'] = '***';
}
$response['headers'] = $headers;
}
return response()
->json([
'ip_address' => $ipAddress,
'url' => $request->url(),
'path' => $request->path(),
'hostname' => $hostname,
'timestamp' => Carbon::now()->timestamp,
'date_time_utc' => Carbon::now('UTC')->toDateTimeString(),
'date_time_app' => Carbon::now()->toDateTimeString(),
'timezone' => $dbTimezone[0]->TimeZone,
'secure' => $secure,
'is_trusted_proxy' => $isTrustedProxy,
]);
->json($response);
}
}

View File

@@ -7,11 +7,11 @@
"require": {
"php": "8.3.*",
"ext-zip": "*",
"brick/money": "^0.9.0",
"datomatic/laravel-enum-helper": "^1.1",
"brick/money": "^0.10.0",
"datomatic/laravel-enum-helper": "^2.0.0",
"dedoc/scramble": "dev-main",
"filament/filament": "^3.2",
"flowframe/laravel-trend": "^0.2.0",
"flowframe/laravel-trend": "^0.3.0",
"gotenberg/gotenberg-php": "^2.8",
"guzzlehttp/guzzle": "^7.2",
"inertiajs/inertia-laravel": "^1.0",

1185
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -65,7 +65,7 @@ return [
'asset_url' => env('ASSET_URL'),
'force_https' => env('APP_FORCE_HTTPS', false),
'force_https' => (bool) env('APP_FORCE_HTTPS', false),
/*
|--------------------------------------------------------------------------

View File

@@ -57,6 +57,38 @@ test('test that starting and stopping a timer with a description works', async (
await assertThatTimerIsStopped(page);
});
test('test that starting the time entry starts the live timer and that it keeps running after reload', async ({
page,
}) => {
await goToDashboard(page);
await Promise.all([
newTimeEntryResponse(page),
startOrStopTimerWithButton(page),
]);
await assertThatTimerHasStarted(page);
await page.waitForTimeout(500);
const beforeTimerValue = await page
.getByTestId('time_entry_time')
.inputValue();
await page.waitForTimeout(2000);
const afterWaitTimeValue = await page
.getByTestId('time_entry_time')
.inputValue();
expect(afterWaitTimeValue).not.toEqual(beforeTimerValue);
await page.reload();
await page.waitForTimeout(500);
const afterReloadTimerValue = await page
.getByTestId('time_entry_time')
.inputValue();
await page.waitForTimeout(2000);
const afterReloadAfterWaitTimerValue = await page
.getByTestId('time_entry_time')
.inputValue();
expect(afterReloadTimerValue).not.toEqual(afterReloadAfterWaitTimerValue);
});
test('test that starting and updating the description while running works', async ({
page,
}) => {

View File

@@ -66,6 +66,12 @@ export const useCurrentTimeEntryStore = defineStore('currentTimeEntry', () => {
if (timeEntriesResponse?.data) {
if (timeEntriesResponse.data) {
currentTimeEntry.value = timeEntriesResponse.data;
if (
currentTimeEntry.value.start !== '' &&
currentTimeEntry.value.end === null
) {
startLiveTimer();
}
} else {
currentTimeEntry.value = { ...emptyTimeEntry };
}

View File

@@ -33,20 +33,57 @@ class HealthCheckEndpointTest extends EndpointTestAbstract
public function test_debug_endpoint_returns_ok(): void
{
// Arrange
config(['app.debug' => false]);
// Act
$response = $this->get('health-check/debug');
// Assert
$response->assertSuccessful();
$response->assertJsonStructure([
'ip_address',
'hostname',
'timestamp',
'date_time_utc',
$response->assertExactJsonStructure([
'date_time_app',
'timezone',
'secure',
'date_time_utc',
'hostname',
'ip_address',
'is_trusted_proxy',
'path',
'secure',
'timestamp',
'timezone',
'url',
]);
config(['app.debug' => true]);
}
public function test_debug_endpoint_returns_more_information_if_debug_mode_is_enabled(): void
{
// Arrange
config(['app.debug' => true]);
// Act
$response = $this->get('health-check/debug');
// Assert
$response->assertSuccessful();
$response->assertExactJsonStructure([
'app_debug',
'app_env',
'app_force_https',
'app_timezone',
'app_url',
'date_time_app',
'date_time_utc',
'headers',
'hostname',
'ip_address',
'is_trusted_proxy',
'path',
'secure',
'timestamp',
'timezone',
'trusted_proxies',
'url',
]);
}
}