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

Test: 347 make playwright wait for hydrated not networkidle #354

Merged
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
4 changes: 2 additions & 2 deletions backend/Testing/Browser/Page/BasePage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public async Task<T> WaitFor()
{
if (Url is not null)
{
await Page.WaitForURLAsync(Url, new() { WaitUntil = WaitUntilState.NetworkIdle });
await Page.WaitForURLAsync(Url, new() { WaitUntil = WaitUntilState.Load });
}
else
{
await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Page.WaitForLoadStateAsync(LoadState.Load);
}
await Task.WhenAll(TestLocators.Select(l => l.WaitForAsync()));
return (T)this;
Expand Down
27 changes: 27 additions & 0 deletions frontend/src/lib/app.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,30 @@ table tr:nth-last-child(-n + 2) .dropdown {
transition: background-color 0.5s;
}
}

.hydrating {
.input,
input,
button {
visibility: hidden;
}

form {
& > * {
visibility: hidden;
}

position: relative;

&::before {
content: '';
@apply loading loading-ring bg-primary;
@apply h-32 max-h-full w-auto;

position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
}
6 changes: 5 additions & 1 deletion frontend/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import { Duration } from '$lib/util/time';
import { browser } from '$app/environment';
import t from '$lib/i18n';
import { onMount } from 'svelte';

export let data: LayoutData;
const { page, updated } = getStores();
Expand All @@ -22,6 +23,9 @@
notifyWarning($t('notifications.update_detected'), Duration.Long);
}
}

let hydrating = true;
onMount(() => hydrating = false);
</script>

<svelte:head>
Expand All @@ -34,7 +38,7 @@
{/if}
</svelte:head>

<div class="flex flex-col justify-between min-h-full">
<div class="flex flex-col justify-between min-h-full" class:hydrating>
<div class="flex flex-col flex-grow">
<slot />
</div>
Expand Down