refactor(forms): enable approved Form A placements by default
This commit is contained in:
41 files changed
+862
-523
No files matched your search
@@ -3,7 +3,7 @@
|
||||
* run this against a loopback-only Astro preview. Every external request is
|
||||
* intercepted and aborted before it can leave the browser.
|
||||
*
|
||||
* FORM_A_IFRAME_BROWSER_MODE=isolated-test \
|
||||
* FORM_A_IFRAME_BROWSER_MODE=live \
|
||||
* PLAYWRIGHT_MODULE=/path/to/playwright/index.mjs \
|
||||
* CHROMIUM_EXECUTABLE=/path/to/chromium node tools/jotform-form-a-browser.mjs
|
||||
*/
|
||||
@@ -18,12 +18,11 @@ import { setTimeout as delay } from 'node:timers/promises';
|
||||
|
||||
const root = fileURLToPath(new URL('../', import.meta.url));
|
||||
const moduleName = process.env.PLAYWRIGHT_MODULE ? pathToFileURL(path.resolve(process.env.PLAYWRIGHT_MODULE)).href : 'playwright';
|
||||
const mode = process.env.FORM_A_IFRAME_BROWSER_MODE ?? 'off';
|
||||
if (!['off', 'mock', 'isolated-test', 'production'].includes(mode)) throw new Error(`Unsupported Form A browser mode: ${mode}`);
|
||||
const mode = process.env.FORM_A_IFRAME_BROWSER_MODE ?? 'live';
|
||||
if (!['off', 'mock', 'live'].includes(mode)) throw new Error(`Unsupported Form A browser mode: ${mode}`);
|
||||
|
||||
const expectedIframe = mode === 'isolated-test' || mode === 'production';
|
||||
const expectedFormMode = mode === 'production' ? 'live' : 'isolated-test';
|
||||
const expectedEnvironment = mode === 'production' ? 'production' : 'isolated-test';
|
||||
const expectedIframe = mode === 'live';
|
||||
const expectedFormMode = 'live';
|
||||
const routes = [
|
||||
{ route: '/contact', locale: 'en', context: 'contact', screenshot: 'contact' },
|
||||
{ route: '/es/contact', locale: 'es', context: 'contact', screenshot: 'es-contact' },
|
||||
@@ -94,7 +93,6 @@ try {
|
||||
assert.equal(await iframe.getAttribute('referrerpolicy'), 'no-referrer', route);
|
||||
assert.equal(await iframe.getAttribute('sandbox'), 'allow-forms allow-scripts allow-same-origin', route);
|
||||
assert.equal(await page.locator(`[data-jotform-form-a][data-form-mode="${expectedFormMode}"]`).count(), 1, route);
|
||||
assert.equal(await page.locator(`[data-jotform-form-a][data-form-environment="${expectedEnvironment}"]`).count(), 1, route);
|
||||
assert.equal(await page.locator(`[data-jotform-form-a][data-form-context="${formContext}"]`).count(), 1, route);
|
||||
const frameBox = await iframe.boundingBox();
|
||||
const expectedFrameHeight = formContext === 'contact'
|
||||
|
||||
Reference in new issue
Block a user