Merge remote-tracking branch 'origin/main' into teste-devtools-f
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-12-03 22:30:02 +02:00
21 changed files with 544 additions and 433 deletions
+5 -5
View File
@@ -225,7 +225,7 @@ class PortalServicesTest extends TestCase
$this->assertDatabaseCount('portal_resource_links', 20);
}
public function test_public_document_lists_paginate_five_results_and_preserve_filters(): void
public function test_public_document_lists_paginate_three_results_and_preserve_filters(): void
{
Storage::fake('local');
$this->withoutMiddleware(\Illuminate\Routing\Middleware\ThrottleRequests::class);
@@ -254,14 +254,14 @@ class PortalServicesTest extends TestCase
auth()->logout();
foreach (['documentos', 'legislacao'] as $path) {
foreach ([1 => [5, 1, 5], 2 => [5, 6, 10], 3 => [1, 11, 11]] as $number => [$count, $from, $to]) {
foreach ([1 => [3, 1, 3], 2 => [3, 4, 6], 3 => [3, 7, 9], 4 => [2, 10, 11]] as $number => [$count, $from, $to]) {
$this->get('/'.$path.'?topic=Investimento&page='.$number)->assertOk()->assertInertia(fn (Assert $page) => $page
->has('resources.data', $count)->where('resources.total', 11)
->where('resources.current_page', $number)->where('resources.last_page', 3)
->where('resources.current_page', $number)->where('resources.last_page', 4)
->where('resources.from', $from)->where('resources.to', $to)
->where('resources.data.0.title', sprintf('Pagination QA %02d', $from))
->where('resources.prev_page_url', fn ($url) => $number === 1 ? $url === null : str_contains($url, 'topic=Investimento') && str_contains($url, 'page='.($number - 1)))
->where('resources.next_page_url', fn ($url) => $number === 3 ? $url === null : str_contains($url, 'topic=Investimento') && str_contains($url, 'page='.($number + 1))));
->where('resources.next_page_url', fn ($url) => $number === 4 ? $url === null : str_contains($url, 'topic=Investimento') && str_contains($url, 'page='.($number + 1))));
}
$this->get('/'.$path.'?q=Pagination%20QA%2001')->assertOk()->assertInertia(fn (Assert $page) => $page
->has('resources.data', 1)->where('resources.total', 1)->where('resources.data.0.title', 'Pagination QA 01'));
@@ -349,7 +349,7 @@ class PortalServicesTest extends TestCase
'target_key' => 'fiscal.iva.lei_13_2016_rectification_2017', 'review_status' => 'pending', 'applicability' => 'evidence']);
$this->assertDatabaseHas('audit_events', ['source_system' => 'portal-services', 'entity_type' => 'portal_resources',
'actor_user_id' => $manager->id, 'action' => 'published_under_user_authorization']);
$this->get('/documentos')->assertInertia(fn (Assert $page) => $page->has('resources.data', 4));
$this->get('/documentos')->assertInertia(fn (Assert $page) => $page->has('resources.data', 3)->where('resources.total', 4));
$this->get('/documentos?q=22%2F2022')->assertInertia(fn (Assert $page) => $page
->has('resources.data', 1)->where('resources.data.0.id', $resourceIds[0]));
$this->get('/documentos?category=Guia&document_type=legislation')->assertInertia(fn (Assert $page) => $page
@@ -40,6 +40,8 @@ test('footer identifies the decided operator without implying a public partnersh
assert.match(html, /Operado por.*Tempo, Lda\./s);
assert.match(html, /mailto:institution@example.invalid/);
assert.doesNotMatch(html, /parceria com a APIEX/);
// Decisão do proprietário (01/12/2026): o acesso a «Contacto» está no rodapé, não no cabeçalho.
assert.match(html, /<a[^>]*href="\/contacto"[^>]*>[\s\S]*?Contacto/);
});
test('support distinguishes the existing institutional contact from dedicated support', () => {
+12 -3
View File
@@ -101,7 +101,7 @@ compileFunction(output, ['require', 'module', 'exports'])(
module,
module.exports,
);
test('actual header has exactly the requested six primary entries on desktop and mobile for public and signed-in users', () => {
test('actual header has exactly the requested primary entries, with Revista Tempo before Mais, on desktop and mobile for public and signed-in users', () => {
const out = new URL(
'../../outputs/funding-uniform-menu-20261111/',
import.meta.url,
@@ -143,18 +143,26 @@ test('actual header has exactly the requested six primary entries on desktop and
'Realização',
'Suporte',
'Sobre nós',
'Revista Tempo',
'Mais',
]);
// Decisão do proprietário (01/12/2026): a Revista Tempo é entrada principal do cabeçalho.
assert.ok(
/<a[^>]*href="https:\/\/revista\.tempo\.co\.mz\/"[^>]*target="_blank"[^>]*rel="noopener noreferrer"/.test(
nav,
),
);
for (const href of [
'/concursos',
'/fundos',
'/documentos',
'/legislacao',
'/sobre',
'/contacto',
'/acesso-gestao',
])
assert.ok(html.includes('href="' + href + '"'), href);
// Decisão do proprietário (01/12/2026): «Contacto» fica só no rodapé.
assert.equal(nav.includes('href="/contacto"'), false);
assert.ok(html.includes('step=S08'));
assert.equal(html.includes('/management/'), false);
fs.writeFileSync(
@@ -179,6 +187,7 @@ test('actual header has exactly the requested six primary entries on desktop and
'Realização',
'Suporte',
'Sobre nós',
'Revista Tempo',
'Mais',
],
actualHeaderRendered: true,
@@ -200,7 +209,7 @@ test('authorised administration is primary and dashboard is a nested expandable
const nav = html.match(/<nav[^>]*aria-label="Áreas do portal"[\s\S]*?<\/nav>/)?.[0];
assert.ok(nav);
const labels = [...nav.matchAll(/<(?:a|button)[^>]*class="tempo-nav-trigger"[^>]*>([\s\S]*?)<\/(?:a|button)>/g)].map(m => m[1].replace(/<[^>]*>/g, '').replace('Grupo actual', '').trim());
assert.deepEqual(labels, ['Início', 'Descoberta', 'Realização', 'Suporte', 'Administração', 'Sobre nós', 'Mais']);
assert.deepEqual(labels, ['Início', 'Descoberta', 'Realização', 'Suporte', 'Administração', 'Sobre nós', 'Revista Tempo', 'Mais']);
assert.equal((nav.match(/href="\/management\/editorial"/g) ?? []).length, 1);
assert.match(nav, /Dashboard/);
if (mobile) assert.match(nav, /<summary[^>]*>Dashboard<\/summary>/);