Add configurable daypart preferences and order neutral choice last

This commit is contained in:
parkel committed 2026-11-17 23:42:08 +01:00
1 parent e1df255b0b
commit 548f04a5dc
9 files changed
+68 -14

No files matched your search

+5 -2
View File
@@ -9,7 +9,7 @@ if (!base || process.argv.length < 3) throw new Error('Provide HGCF_BASE_URL and
const artifacts = process.env.HGCF_ARTIFACTS || '/tmp/hg-contact-browser';
fs.mkdirSync(artifacts, { recursive: true, mode: 0o700 });
(async () => {
const browser = await chromium.launch({ headless: true });
const browser = await chromium.launch({ headless: true, ...(process.env.HGCF_BROWSER_EXECUTABLE ? { executablePath: process.env.HGCF_BROWSER_EXECUTABLE } : {}) });
const proofs = [];
try {
for (const [index, route] of process.argv.slice(2).entries()) {
@@ -41,7 +41,7 @@ fs.mkdirSync(artifacts, { recursive: true, mode: 0o700 });
await page.locator('[name=mlhc_name]').fill('Test Visitor');
await page.locator('[name=mlhc_email]').fill('visitor@example.com');
await page.locator('[name=mlhc_message]').fill('Browser verification test intercepted before delivery.');
await page.locator('[name=mlhc_consent]').check();
if(await page.locator('[name=mlhc_consent]').count())await page.locator('[name=mlhc_consent]').check();
await page.waitForFunction(() => {
const input = document.querySelector('.mlhc-form input[name=mlhc_altcha]');
return !!input?.value;
@@ -61,6 +61,9 @@ fs.mkdirSync(artifacts, { recursive: true, mode: 0o700 });
await requestMode.check();
assert.equal(await page.locator('[data-hgcf-field=service]').isVisible(), true);
assert.equal(await page.locator('[name=mlhc_message]').getAttribute('required'), null);
const config=JSON.parse(await page.locator('.mlhc-form').getAttribute('data-hgcf-workflows')).request;
assert.equal(config.services.at(-1).value,'unsure');
if(config.timeMode==='daypart'){assert.equal(await page.locator('#mlhc-daypart').isVisible(),true);assert.equal(await page.locator('#mlhc-time').isDisabled(),true);await page.locator('#mlhc-daypart').selectOption(Object.keys(config.dayparts)[0]);assert.equal(await page.locator('#mlhc-daypart').getAttribute('required'),null);}
await page.locator('[name=mlhc_mode][value=question]').check();
}
const geometry = await widget.boundingBox();