Lot S : « Proposition seed » dans l'interface (fr, en, es), le texte sans article en vigueur le dit ; e2e repris
Interface au strict nécessaire (le lot U refera la présentation) : la marque « Proposition seed » là où une version est montrée (liste des propositions, Détails, panneau Propositions), seedProposal?: boolean dans types.ts ; au-dessus des ordres, « Aucun article n'est en vigueur » quand c'est le cas. e2e : C3 (aucun texte en vigueur, 33 lignes, trois Propositions seed au cran 2), C9 et C18 (« si tout passe »), C20, C23, C24 et M1 par la liste des propositions dans Monnaie libre ; dans le groupe d'essai, I1, E1 et E2 entrent d'abord par le vote (seedsInForce : deux voix puis leur retrait, le texte reste en vigueur) pour les contrôles qui lisent un texte en vigueur (C4 à C6, C20, C21, C24, C28 à C31). Boucle e2e : 35 / 35. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+41
-1
@@ -75,6 +75,11 @@ export async function signed(page: Page): Promise<{ address: string; dest: strin
|
||||
);
|
||||
}
|
||||
|
||||
/** The line of an article in « Propositions en cours », by its title alone (an excerpt may name it). */
|
||||
export function deepRow(page: Page, title: string) {
|
||||
return page.locator('ul.deep button.row').filter({ has: page.locator('span.title').getByText(title, { exact: true }) });
|
||||
}
|
||||
|
||||
/** A screenshot for the visual check, when `LD_SHOTS` names a directory (never in the loop). */
|
||||
export async function shot(page: Page, name: string) {
|
||||
const dir = process.env.LD_SHOTS;
|
||||
@@ -86,13 +91,48 @@ const CSRF = { 'x-requested-with': 'libredecision' };
|
||||
/** The document of the test group, as the server gives it. */
|
||||
export async function testDoc(page: Page): Promise<{
|
||||
id: string;
|
||||
units: { id: string; code: string; inForce: { id: string; title: string } | null; proposals: { id: string; title: string }[] }[];
|
||||
units: {
|
||||
id: string;
|
||||
code: string;
|
||||
inForce: { id: string; title: string } | null;
|
||||
proposals: { id: string; title: string; seedProposal?: boolean }[];
|
||||
}[];
|
||||
}> {
|
||||
const g = await (await page.request.get('/api/groups/essai')).json();
|
||||
const d = await (await page.request.get(`/api/docs/${g.docs[0].id}`)).json();
|
||||
return { id: d.doc.id, units: d.units };
|
||||
}
|
||||
|
||||
/**
|
||||
* The three seed proposals (ADR 0011: I1, E1 and E2, not in force at the start) brought into
|
||||
* force in the test group, as the vote does it: voices for until each enters, then those
|
||||
* voices withdrawn. A version in force stays so (a permanent vote: only a rival displaces
|
||||
* it), at zero votes, as the controls written before the seed proposals found it. Never in
|
||||
* Monnaie libre, whose vote goes through the chain; nothing done twice.
|
||||
*/
|
||||
export async function seedsInForce(browser: Browser) {
|
||||
const voices = [await person(browser, 'Amorce A'), await person(browser, 'Amorce B')];
|
||||
for (const code of ['I1', 'E1', 'E2']) {
|
||||
const unit = (await testDoc(voices[0]!)).units.find((u) => u.code === code);
|
||||
const seed = unit?.proposals.find((p) => p.seedProposal);
|
||||
if (!unit || unit.inForce || !seed) continue;
|
||||
const cast: Page[] = [];
|
||||
for (const page of voices) {
|
||||
const r = await page.request.post(`/api/proposals/${seed.id}/vote`, { data: { choice: 'for' }, headers: CSRF });
|
||||
if (!r.ok()) throw new Error(`vote ${r.status()} ${await r.text()}`);
|
||||
cast.push(page);
|
||||
if ((await r.json()).entered?.length) break;
|
||||
}
|
||||
for (const page of cast) {
|
||||
const r = await page.request.post(`/api/proposals/${seed.id}/vote`, { data: { choice: null }, headers: CSRF });
|
||||
if (!r.ok()) throw new Error(`withdraw ${r.status()} ${await r.text()}`);
|
||||
}
|
||||
const now = (await testDoc(voices[0]!)).units.find((u) => u.code === code);
|
||||
if (now?.inForce?.id !== seed.id) throw new Error(`${code} did not enter into force`);
|
||||
}
|
||||
for (const page of voices) await page.context().close();
|
||||
}
|
||||
|
||||
/** A new article proposed by the person of `page`, submitted to the vote; returns its id. */
|
||||
export async function propose(page: Page, title: string, body: string): Promise<string> {
|
||||
const doc = await testDoc(page);
|
||||
|
||||
Reference in New Issue
Block a user