I am running a store() method in which I have to create a project using playwright tests. My playwright index.spec.ts file where I am calling create project is:
import { test } from '@playwright/test';
import { createProject } from './actions/create';
test.describe.serial('Project Module', () => {
let createdProjectId: string | null = null;
test('Create Project', async ({ page }) => {
test.setTimeout(60000);
process.env.RUNNING_AUTOMATION_TESTS = 'true';
console.log('RUNNING_AUTOMATION_TESTS set to ',process.env.RUNNING_AUTOMATION_TESTS);
createdProjectId = await createProject(page);
process.env.RUNNING_AUTOMATION_TESTS = 'false';
console.log('RUNNING_AUTOMATION_TESTS set to',process.env.RUNNING_AUTOMATION_TESTS);
});
});
My controller method where i want the RUNNING_AUTOMATION_TESTS = 'true'; is
if (!config('general.running_automation_tests')) {
$customDomain = $this->cloudflareCustomDomainService->createCustomDomain($input['domain_url'] ?? '');
if (isset($customDomain['error']))
return redirect()->back()->withInput($request->all())->with('custom_domain_error', $customDomain['error']);
else
$input['custom_domain_result'] = $customDomain;
}
But each time i get false getting in test failure. How to fix this issue?
createProjectsendRUNNING_AUTOMATION_TESTSin the request payload?