@@ -27232,15 +27232,7 @@ var CodeceptApp = (() => {
2723227232 import_react.default.useEffect(() => {
2723327233 const urlParams = new URLSearchParams(location.search)
2723427234 if (urlParams.has('posted')) {
27235- try {
27236- const storedData = localStorage.getItem('codeceptjs_post_data')
27237- if (storedData) {
27238- setPostData(JSON.parse(storedData))
27239- localStorage.removeItem('codeceptjs_post_data')
27240- }
27241- } catch (error) {
27242- setPostData({})
27243- }
27235+ setPostData({})
2724427236 } else {
2724527237 setPostData({})
2724627238 }
@@ -27329,27 +27321,13 @@ var CodeceptApp = (() => {
2732927321 }
2733027322 function FormFilePage() {
2733127323 const postData = usePostData()
27332- const navigate = useNavigate()
27333- const handleSubmit = e => {
27334- e.preventDefault()
27335- const formData = new FormData(e.target)
27336- const data = {}
27337- for (let [key, value] of formData.entries()) {
27338- if (value instanceof File) {
27339- data[key] = `${value.name} (${value.size} bytes, ${value.type})`
27340- } else {
27341- data[key] = value
27342- }
27343- }
27344- localStorage.setItem('codeceptjs_post_data', JSON.stringify(data))
27345- navigate('/?posted=1')
27346- }
2734727324 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
2734827325 children: [
2734927326 /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'File Upload' }),
2735027327 /* @__PURE__ */ (0, import_jsx_runtime.jsx)('div', { className: 'notice', 'qa-id': 'test' }),
2735127328 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('form', {
27352- onSubmit: handleSubmit,
27329+ action: '/form/file',
27330+ method: 'POST',
2735327331 encType: 'multipart/form-data',
2735427332 children: [
2735527333 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('p', {
@@ -27385,23 +27363,13 @@ var CodeceptApp = (() => {
2738527363 }
2738627364 function FormHiddenPage() {
2738727365 const postData = usePostData()
27388- const navigate = useNavigate()
27389- const handleSubmit = e => {
27390- e.preventDefault()
27391- const formData = new FormData(e.target)
27392- const data = {}
27393- for (let [key, value] of formData.entries()) {
27394- data[key] = value
27395- }
27396- localStorage.setItem('codeceptjs_post_data', JSON.stringify(data))
27397- navigate('/?posted=1')
27398- }
2739927366 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
2740027367 children: [
2740127368 /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'Hidden Form' }),
2740227369 /* @__PURE__ */ (0, import_jsx_runtime.jsx)('div', { className: 'notice', 'qa-id': 'test' }),
2740327370 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('form', {
27404- onSubmit: handleSubmit,
27371+ action: '/form/hidden',
27372+ method: 'POST',
2740527373 children: [
2740627374 /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'hidden', name: 'hidden_field', value: 'hidden_value' }),
2740727375 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('p', {
@@ -27509,6 +27477,286 @@ var CodeceptApp = (() => {
2750927477 ],
2751027478 })
2751127479 }
27480+ function FormSelectPage() {
27481+ const postData = usePostData()
27482+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)('html', {
27483+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('body', {
27484+ children: [
27485+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('form', {
27486+ action: '/form/complex',
27487+ method: 'POST',
27488+ children: [
27489+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('label', { htmlFor: 'age', children: 'Select your age' }),
27490+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('select', {
27491+ name: 'age',
27492+ id: 'age',
27493+ children: [
27494+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('option', { value: 'child', children: 'below 13' }),
27495+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('option', { value: 'teenage', children: '13-21' }),
27496+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('option', { value: 'adult', children: '21-60' }),
27497+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('option', { value: 'oldfag', selected: 'selected', children: '60-100' }),
27498+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('option', { value: 'dead', children: '100-210' }),
27499+ ],
27500+ }),
27501+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'submit', value: 'Submit' }),
27502+ ],
27503+ }),
27504+ Object.keys(postData).length > 0 &&
27505+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('pre', {
27506+ style: { whiteSpace: 'pre-wrap' },
27507+ children: Object.entries(postData)
27508+ .map(
27509+ ([key, value]) =>
27510+ `[${key}] => ${
27511+ Array.isArray(value)
27512+ ? `Array
27513+ (
27514+ ${value.map((item, index) => `[${index}] => ${item}`).join('\n ')}
27515+ )`
27516+ : value
27517+ }`,
27518+ )
27519+ .join('\n'),
27520+ }),
27521+ ],
27522+ }),
27523+ })
27524+ }
27525+ function FormFieldPage() {
27526+ const postData = usePostData()
27527+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
27528+ children: [
27529+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'Form Fields' }),
27530+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('form', {
27531+ action: '/form/field',
27532+ method: 'POST',
27533+ children: [
27534+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('p', {
27535+ children: [
27536+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('label', { children: 'Name:' }),
27537+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('br', {}),
27538+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'text', name: 'name', placeholder: 'Enter your name' }),
27539+ ],
27540+ }),
27541+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('p', { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'submit', value: 'Submit' }) }),
27542+ ],
27543+ }),
27544+ Object.keys(postData).length > 0 &&
27545+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('pre', {
27546+ style: { whiteSpace: 'pre-wrap' },
27547+ children: Object.entries(postData)
27548+ .map(
27549+ ([key, value]) =>
27550+ `[${key}] => ${
27551+ Array.isArray(value)
27552+ ? `Array
27553+ (
27554+ ${value.map((item, index) => `[${index}] => ${item}`).join('\n ')}
27555+ )`
27556+ : value
27557+ }`,
27558+ )
27559+ .join('\n'),
27560+ }),
27561+ ],
27562+ })
27563+ }
27564+ function FormCheckboxPage() {
27565+ const postData = usePostData()
27566+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
27567+ children: [
27568+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'Checkbox Form' }),
27569+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('form', {
27570+ action: '/form/checkbox',
27571+ method: 'POST',
27572+ children: [
27573+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('p', {
27574+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('label', {
27575+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'checkbox', name: 'agree', value: 'yes' }), ' I agree to the terms'],
27576+ }),
27577+ }),
27578+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('p', { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'submit', value: 'Submit' }) }),
27579+ ],
27580+ }),
27581+ Object.keys(postData).length > 0 &&
27582+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('pre', {
27583+ style: { whiteSpace: 'pre-wrap' },
27584+ children: Object.entries(postData)
27585+ .map(
27586+ ([key, value]) =>
27587+ `[${key}] => ${
27588+ Array.isArray(value)
27589+ ? `Array
27590+ (
27591+ ${value.map((item, index) => `[${index}] => ${item}`).join('\n ')}
27592+ )`
27593+ : value
27594+ }`,
27595+ )
27596+ .join('\n'),
27597+ }),
27598+ ],
27599+ })
27600+ }
27601+ function FormButtonPage() {
27602+ const postData = usePostData()
27603+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
27604+ children: [
27605+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'Button Form' }),
27606+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('form', {
27607+ action: '/form/button',
27608+ method: 'POST',
27609+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('p', {
27610+ children: [
27611+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('button', { type: 'submit', name: 'action', value: 'save', children: 'Save' }),
27612+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('button', { type: 'submit', name: 'action', value: 'delete', children: 'Delete' }),
27613+ ],
27614+ }),
27615+ }),
27616+ Object.keys(postData).length > 0 &&
27617+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('pre', {
27618+ style: { whiteSpace: 'pre-wrap' },
27619+ children: Object.entries(postData)
27620+ .map(
27621+ ([key, value]) =>
27622+ `[${key}] => ${
27623+ Array.isArray(value)
27624+ ? `Array
27625+ (
27626+ ${value.map((item, index) => `[${index}] => ${item}`).join('\n ')}
27627+ )`
27628+ : value
27629+ }`,
27630+ )
27631+ .join('\n'),
27632+ }),
27633+ ],
27634+ })
27635+ }
27636+ function FormComplexPage() {
27637+ const postData = usePostData()
27638+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
27639+ children: [
27640+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'Form Submitted Successfully' }),
27641+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('p', { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)('a', { href: '/', children: 'Back to index' }) }),
27642+ Object.keys(postData).length > 0 &&
27643+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('pre', {
27644+ style: { whiteSpace: 'pre-wrap' },
27645+ children: Object.entries(postData)
27646+ .map(
27647+ ([key, value]) =>
27648+ `[${key}] => ${
27649+ Array.isArray(value)
27650+ ? `Array
27651+ (
27652+ ${value.map((item, index) => `[${index}] => ${item}`).join('\n ')}
27653+ )`
27654+ : value
27655+ }`,
27656+ )
27657+ .join('\n'),
27658+ }),
27659+ ],
27660+ })
27661+ }
27662+ function FormTextareaPage() {
27663+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
27664+ children: [
27665+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'Textarea Form' }),
27666+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('form', {
27667+ action: '/form/complex',
27668+ method: 'POST',
27669+ children: [
27670+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('p', {
27671+ children: [
27672+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('label', { children: 'Message:' }),
27673+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('br', {}),
27674+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('textarea', { name: 'message', rows: '4', cols: '50', placeholder: 'Enter your message' }),
27675+ ],
27676+ }),
27677+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('p', { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'submit', value: 'Submit' }) }),
27678+ ],
27679+ }),
27680+ ],
27681+ })
27682+ }
27683+ function FormAriaPage() {
27684+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
27685+ children: [
27686+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'Aria Form' }),
27687+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('form', {
27688+ action: '/form/complex',
27689+ method: 'POST',
27690+ children: [
27691+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('p', {
27692+ children: [
27693+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('label', { 'aria-label': 'Username input', children: 'Username:' }),
27694+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'text', name: 'username', 'aria-required': 'true' }),
27695+ ],
27696+ }),
27697+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('p', { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'submit', value: 'Submit', 'aria-label': 'Submit form' }) }),
27698+ ],
27699+ }),
27700+ ],
27701+ })
27702+ }
27703+ function FormExample1Page() {
27704+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
27705+ children: [
27706+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'Example Form 1' }),
27707+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('form', {
27708+ action: '/form/complex',
27709+ method: 'POST',
27710+ children: [
27711+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('p', {
27712+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)('label', { children: 'Example field:' }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'text', name: 'example' })],
27713+ }),
27714+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('p', { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'submit', value: 'Submit' }) }),
27715+ ],
27716+ }),
27717+ ],
27718+ })
27719+ }
27720+ function FormExample7Page() {
27721+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
27722+ children: [
27723+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'Example Form 7' }),
27724+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('form', {
27725+ action: '/form/complex',
27726+ method: 'POST',
27727+ children: [
27728+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('p', {
27729+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)('label', { children: 'Example field 7:' }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'text', name: 'example7' })],
27730+ }),
27731+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('p', { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'submit', value: 'Submit' }) }),
27732+ ],
27733+ }),
27734+ ],
27735+ })
27736+ }
27737+ function FormWaitElementPage() {
27738+ const [showElement, setShowElement] = import_react.default.useState(false)
27739+ import_react.default.useEffect(() => {
27740+ const timer = setTimeout(() => setShowElement(true), 1e3)
27741+ return () => clearTimeout(timer)
27742+ }, [])
27743+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('div', {
27744+ children: [
27745+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('h1', { children: 'Wait Element Form' }),
27746+ showElement &&
27747+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('form', {
27748+ action: '/form/complex',
27749+ method: 'POST',
27750+ children: [
27751+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)('p', {
27752+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)('label', { children: 'Wait field:' }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'text', name: 'waitfield' })],
27753+ }),
27754+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)('p', { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)('input', { type: 'submit', value: 'Submit' }) }),
27755+ ],
27756+ }),
27757+ ],
27758+ })
27759+ }
2751227760 function App() {
2751327761 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BrowserRouter, {
2751427762 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Routes, {
@@ -27517,6 +27765,16 @@ var CodeceptApp = (() => {
2751727765 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/info', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InfoPage, {}) }),
2751827766 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/form/file', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormFilePage, {}) }),
2751927767 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/form/hidden', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormHiddenPage, {}) }),
27768+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/form/select', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormSelectPage, {}) }),
27769+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/form/field', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormFieldPage, {}) }),
27770+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/form/checkbox', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormCheckboxPage, {}) }),
27771+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/form/button', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormButtonPage, {}) }),
27772+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/form/textarea', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormTextareaPage, {}) }),
27773+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/form/aria', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormAriaPage, {}) }),
27774+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/form/example1', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormExample1Page, {}) }),
27775+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/form/example7', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormExample7Page, {}) }),
27776+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/form/wait_element', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormWaitElementPage, {}) }),
27777+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/form/complex', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormComplexPage, {}) }),
2752027778 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/spinner', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpinnerPage, {}) }),
2752127779 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '/search', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SearchPage, {}) }),
2752227780 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Route, { path: '*', element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IndexPage, {}) }),
0 commit comments