Add header tagline, footer (copyright, contact, MIT licence) and an About/credits panel with CC BY attribution

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
denis
2026-10-17 15:08:54 +02:00
parent 5d2cc0eedf
commit d5e2358a17
10 changed files with 363 additions and 8 deletions
+50 -2
View File
@@ -242,7 +242,7 @@ test('voix hors ligne : télécharger les narrations Piper puis les écouter san
const [, cached, total] = status.match(/(\d+) voix sur (\d+)/) ?? [];
assert.ok(Number(total) > 40 && cached === total, `toutes les voix du français sont en cache : ${status}`);
assert.equal(await group.getByRole('button', { name: 'Télécharger les voix pour le hors ligne' }).isDisabled(), true);
await page.locator('.drawer-right .drawer-close').click();
await page.locator('.drawer-right.is-open .drawer-close').click();
await page.locator('.drawer-right.is-open').waitFor({ state: 'hidden' });
// Hors connexion : un niveau lointain se lit avec la voix Piper (fichier du cache), pas avec la synthèse système.
@@ -259,6 +259,54 @@ test('voix hors ligne : télécharger les narrations Piper puis les écouter san
assert.deepEqual(errors, []);
});
test('bandeau, pied de page et « À propos » : ce que fait PyQuest, droits, licence, contact, crédits', { skip, timeout: 120000 }, async () => {
const page = await (await browser.newContext({ locale: 'fr-FR' })).newPage();
const errors = [];
page.on('pageerror', (error) => errors.push(error.message));
await page.goto(base);
await page.waitForSelector('.explain', { timeout: 60000 });
// Le bandeau dit ce que fait l'application ; l'onglet aussi.
assert.match(await page.textContent('#app-tagline'), /Apprendre Python par la pratique, dans ton navigateur/);
assert.match(await page.title(), /PyQuest — apprendre Python/);
// Pied de page : droits, contact, licence (texte complet servi), à propos.
const footer = page.locator('#app-footer');
assert.match(await footer.textContent(), /© 2026 PyQuest/);
assert.equal(await footer.getByRole('link', { name: 'dd@linuxtarn.org' }).getAttribute('href'), 'mailto:dd@linuxtarn.org');
const licenseLink = footer.getByRole('link', { name: 'Licence MIT' });
const licenseResponse = await page.request.get(new URL(await licenseLink.getAttribute('href'), base).href);
assert.equal(licenseResponse.status(), 200);
assert.match(await licenseResponse.text(), /MIT License/);
// « À propos et crédits » : panneau accessible, avec l'attribution de la voix française.
await footer.getByRole('button', { name: 'À propos et crédits' }).click();
const drawer = page.locator('.drawer-right.is-open');
await drawer.waitFor();
assert.match(await drawer.textContent(), /À propos de PyQuest/);
assert.match(await drawer.textContent(), /Qu'est-ce que PyQuest \?/);
assert.match(await drawer.textContent(), /Licence MIT|licence MIT/);
assert.match(await drawer.textContent(), /SIWIS.*CC BY 4\.0/s);
assert.equal(await drawer.getByRole('link', { name: 'dd@linuxtarn.org' }).getAttribute('href'), 'mailto:dd@linuxtarn.org');
for (const link of await drawer.locator('a[target=_blank]').all()) {
assert.match(await link.getAttribute('rel'), /noopener/);
}
assert.equal(await page.evaluate(() => document.getElementById('app-root').inert), true);
await page.keyboard.press('Escape');
await drawer.waitFor({ state: 'hidden' });
assert.equal(await page.evaluate(() => document.activeElement.id), 'about-toggle', 'le focus revient sur le bouton');
// En anglais : bandeau et pied de page suivent la langue.
await page.locator('#settings-toggle').click();
await page.getByLabel('Langue').selectOption('en');
await page.locator('.drawer-right.is-open .drawer-close').click();
await page.waitForFunction(() => document.getElementById('app-tagline').textContent.startsWith('Learn Python'));
assert.match(await footer.textContent(), /MIT licence/);
await footer.getByRole('button', { name: 'About and credits' }).click();
assert.match(await page.locator('.drawer-right.is-open').textContent(), /What is PyQuest\?/);
assert.deepEqual(errors, []);
});
test('niveau 07 : boucle while avec plusieurs saisies successives dans l\'interface', { skip, timeout: 120000 }, async () => {
const page = await (await browser.newContext()).newPage();
const errors = [];
@@ -398,7 +446,7 @@ test('navigation : lien direct vers un niveau, tiroirs accessibles, précédent/
await page.locator('.drawer-right.is-open').waitFor();
for (let i = 0; i < 30; i++) await page.keyboard.press('Tab');
assert.equal(await page.evaluate(() => Boolean(document.activeElement.closest('.drawer-right'))), true, 'focus piégé');
await page.locator('.drawer-right .drawer-close').click();
await page.locator('.drawer-right.is-open .drawer-close').click();
await page.locator('.drawer-right.is-open').waitFor({ state: 'hidden' });
// Choisir un niveau dans le tiroir le ferme et l'ouvre.
+36
View File
@@ -0,0 +1,36 @@
import { test } from 'node:test';
import assert from 'node:assert';
import { readFileSync } from 'node:fs';
const read = (path) => readFileSync(new URL(`../../${path}`, import.meta.url), 'utf8');
test('la licence servie par l\'application est celle du dépôt', () => {
assert.equal(read('app/LICENSE.txt'), read('LICENSE'));
assert.match(read('LICENSE'), /MIT License/);
});
test('le texte « À propos » existe en français et en anglais, avec les mêmes clés', () => {
const fr = JSON.parse(read('app/js/i18n/fr.json'));
const en = JSON.parse(read('app/js/i18n/en.json'));
const aboutKeys = (catalog) => Object.keys(catalog).filter((key) => /^(about|footer)\.|^app\.(tagline|docTitle)$/.test(key)).sort();
assert.deepEqual(aboutKeys(en), aboutKeys(fr));
assert.ok(aboutKeys(fr).length > 25);
// L'attribution exigée par la licence CC BY 4.0 de la voix française figure dans les deux langues.
for (const catalog of [fr, en]) {
assert.match(catalog['about.credits.cc'], /SIWIS/);
assert.match(catalog['about.credits.cc'], /CC BY 4\.0/);
}
});
test('chaque crédit a un rôle traduit et le contact est celui du projet', async () => {
const source = read('app/js/ui/AboutPanel.js');
const fr = JSON.parse(read('app/js/i18n/fr.json'));
const en = JSON.parse(read('app/js/i18n/en.json'));
const roles = [...source.matchAll(/role: '([^']+)'/g)].map((match) => match[1]);
assert.ok(roles.length >= 8);
for (const role of roles) {
assert.ok(fr[role] && en[role], `rôle sans traduction : ${role}`);
}
assert.match(source, /CONTACT_EMAIL = 'dd@linuxtarn\.org'/);
assert.match(read('app/index.html'), /mailto:dd@linuxtarn\.org/);
});