All checks were successful
CI / php-lint (pull_request) Successful in 32s
CI / secret-scan (pull_request) Successful in 11s
CI / static-tests (pull_request) Successful in 1m14s
CI / js-tests (pull_request) Successful in 42s
CI / secret-scan (push) Successful in 13s
CI / php-lint (push) Successful in 33s
CI / static-tests (push) Successful in 1m12s
CI / js-tests (push) Successful in 37s
Le panier avait deux vues divergentes : la page cart.html et le panneau de droite. On garde le PANNEAU comme unique vue panier et on supprime : - cart.html + page-cart.js (page panier separee) ; - product.html + page-product.js (fiche produit fantome non atteinte : le clic produit ouvre une modale) ; - l'icone panier de l'en-tete (le panneau montre la commande). Le panneau devient un panier complet : stepper +/- par ligne (decrementer a 0 retire la ligne), en plus du bouton retrait. Cibles tactiles 44px. Repointe le lien retour de payment.html et la redirection panier-vide vers categories.html ; neutralise le href de repli des cartes produit ; nettoie le CSS mort (cart-*, product-detail*, site-header__cart). E2E reecrit (modale options + panneau au lieu de product.html / cart.html). JS 101 verts.
66 lines
3.5 KiB
JavaScript
66 lines
3.5 KiB
JavaScript
// Parcours E2E borne : welcome -> categories -> produits (grille) -> modale d'options
|
|
// au clic produit -> ajout -> le panneau de commande persistant (unique vue panier)
|
|
// reflete la ligne -> paiement -> confirmation. La stack est montee a part (run.sh) ;
|
|
// le panier vit dans localStorage (meme origine), on navigue sans perdre l'etat.
|
|
// Il n'existe plus de page panier ni de page produit separees (lot F3 panier unique).
|
|
const { test, expect } = require('@playwright/test');
|
|
|
|
test('parcours borne : de l\'accueil a la confirmation de commande', async ({ page }) => {
|
|
|
|
await test.step('accueil -> categories', async () => {
|
|
await page.goto('/index.html');
|
|
await expect(page).toHaveTitle(/Bienvenue/);
|
|
await expect(page.locator('#welcome-heading')).toBeVisible();
|
|
// CTA "sur place" -> categories.html?mode=sur-place
|
|
await page.locator('a[href*="categories.html?mode=sur-place"]').click();
|
|
await expect(page).toHaveURL(/categories\.html/);
|
|
});
|
|
|
|
await test.step('categories -> produits', async () => {
|
|
await expect(page.locator('h1.categories-main__heading')).toBeVisible();
|
|
// Categorie 2 = boissons : produits SIMPLES (la categorie 1 = menus, qui ouvrent
|
|
// le composeur a slots, un autre parcours). Un produit simple ouvre la modale options.
|
|
await page.locator('a[href="products.html?category=2"]').click();
|
|
await expect(page).toHaveURL(/products\.html\?category=2/);
|
|
});
|
|
|
|
await test.step('clic produit -> modale options', async () => {
|
|
// Cartes rendues par JS depuis le JSON : auto-wait sur la 1re carte commandable.
|
|
const firstCard = page.locator('#products-grid a.product-card:not(.product-card--unavailable)').first();
|
|
await expect(firstCard).toBeVisible();
|
|
await firstCard.click();
|
|
// product-options.js monte une modale (.composer-overlay) avec le bouton d'ajout #po-add.
|
|
await expect(page.locator('.composer-overlay [role="dialog"]')).toBeVisible();
|
|
await expect(page.locator('#po-add')).toBeVisible();
|
|
});
|
|
|
|
await test.step('ajout -> le panneau de commande reflete la ligne', async () => {
|
|
await page.locator('#po-add').click();
|
|
// La modale se ferme et le panneau persistant (unique vue panier) montre la ligne.
|
|
await expect(page.locator('.composer-overlay')).toHaveCount(0);
|
|
const panel = page.locator('[data-order-panel]');
|
|
await expect(panel.locator('.order-panel__line')).toHaveCount(1);
|
|
// Total calcule (le panneau affiche un montant, plus le placeholder vide).
|
|
await expect(panel.locator('.order-panel__total-value')).not.toHaveText('');
|
|
});
|
|
|
|
await test.step('panneau Payer -> paiement', async () => {
|
|
const payLink = page.locator('[data-order-panel] .order-panel__pay');
|
|
await expect(payLink).toHaveAttribute('aria-disabled', 'false');
|
|
await payLink.click();
|
|
await expect(page).toHaveURL(/payment\.html/);
|
|
});
|
|
|
|
await test.step('paiement -> confirmation', async () => {
|
|
await page.locator('#pay-card').click();
|
|
// Sur-place : page-payment.js ouvre la modale chevalet (numero de table) avant de
|
|
// soumettre. On saisit un numero puis on enregistre pour declencher le checkout.
|
|
await expect(page.locator('#chevalet-input')).toBeVisible();
|
|
await page.locator('#chevalet-input').fill('12');
|
|
await page.locator('#chevalet-ok').click();
|
|
await expect(page).toHaveURL(/confirmation\.html/);
|
|
await expect(page.locator('.confirmation-banner__title')).toHaveText(/Commande confirmee/);
|
|
// Numero de commande genere (plus le placeholder).
|
|
await expect(page.locator('#order-number')).not.toHaveText('—');
|
|
});
|
|
});
|