refactor(forms): enable approved Form A placements by default
This commit is contained in:
41 files changed
+862
-523
No files matched your search
@@ -13,7 +13,7 @@ const moduleName = process.env.PLAYWRIGHT_MODULE
|
||||
? pathToFileURL(path.resolve(process.env.PLAYWRIGHT_MODULE)).href : 'playwright';
|
||||
const executablePath = process.env.CHROMIUM_EXECUTABLE;
|
||||
const output = await fs.mkdtemp('/tmp/aia-phase10-browser-');
|
||||
const result = { startedAt: new Date().toISOString(), routeCount: 0, opened: 0, failures: [], pageErrors: [], consoleErrors: [], blocked: [], productionAttempts: [], screenshots: [], status: 'failed' };
|
||||
const result = { startedAt: new Date().toISOString(), routeCount: 0, opened: 0, failures: [], pageErrors: [], consoleErrors: [], blocked: [], productionAttempts: [], approvedFormAAttempts: [], screenshots: [], status: 'failed' };
|
||||
let browser;
|
||||
let preview;
|
||||
|
||||
@@ -59,7 +59,17 @@ try {
|
||||
if (url.origin !== origin || !['GET', 'HEAD'].includes(request.method())) {
|
||||
const attempt = { origin: url.origin, path: url.pathname, method: request.method() };
|
||||
result.blocked.push(attempt);
|
||||
if (isProductionLike(url)) result.productionAttempts.push(attempt);
|
||||
const parent = request.frame().parentFrame();
|
||||
const parentPath = parent ? new URL(parent.url()).pathname : '';
|
||||
const locale = parentPath.startsWith('/es/') ? 'es' : 'en';
|
||||
const contacts = ['/contact', '/es/contact'];
|
||||
const landings = ['/lp/aba-therapy', '/lp/aba-insurance', '/lp/aba-ahcccs', '/lp/aba-private-pay', '/lp/early-intervention'];
|
||||
const consultations = ['/client-consultation', '/es/client-consultation', '/schedule-consultation', '/aba-therapy', '/autism-evaluations', '/learner-social-club', '/es/aba-therapy', '/es/autism-evaluations', '/es/learner-social-club'];
|
||||
const formContext = contacts.includes(parentPath) ? 'contact' : landings.includes(parentPath) ? 'landing' : consultations.includes(parentPath) ? 'consultation' : undefined;
|
||||
const approved = request.method() === 'GET' && request.isNavigationRequest() && formContext &&
|
||||
url.href === `https://form.jotform.com/262946078314059?formContext=${formContext}&language=${locale}`;
|
||||
if (approved) result.approvedFormAAttempts.push(attempt);
|
||||
else if (isProductionLike(url)) result.productionAttempts.push(attempt);
|
||||
return route.abort();
|
||||
}
|
||||
return route.continue();
|
||||
|
||||
Reference in new issue
Block a user