366 lines
38 KiB
Plaintext
366 lines
38 KiB
Plaintext
|
|
> job-tracker-ui@0.1.0 test
|
|
> jest --runInBand admin-users-page.test.tsx
|
|
|
|
console.error
|
|
An update to AdminUsersPage inside a test was not wrapped in act(...).
|
|
|
|
When testing, code that causes React state updates should be wrapped into act(...):
|
|
|
|
act(() => {
|
|
/* fire events that update state */
|
|
});
|
|
/* assert on the output */
|
|
|
|
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://react.dev/link/wrap-tests-with-act
|
|
|
|
66 | return () => { checkSessionCookie(); return lifetime.mounted && lifetime.generation===generation && !isSessionInvalidated() && getSessionContext()===context; };
|
|
67 | }, []);
|
|
> 68 | const finishAction=useCallback((active: () => boolean) => { owner.current.busy=false; if (active()) setBusy(false); }, []);
|
|
| ^
|
|
69 |
|
|
70 | const createUser=async () => {
|
|
71 | if (!canCreate) return;
|
|
|
|
at node_modules/react-dom/cjs/react-dom-client.development.js:18758:19
|
|
at runWithFiberInDEV (node_modules/react-dom/cjs/react-dom-client.development.js:874:13)
|
|
at warnIfUpdatesNotWrappedWithActDEV (node_modules/react-dom/cjs/react-dom-client.development.js:18757:9)
|
|
at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom-client.development.js:16409:11)
|
|
at dispatchSetStateInternal (node_modules/react-dom/cjs/react-dom-client.development.js:9170:13)
|
|
at dispatchSetState (node_modules/react-dom/cjs/react-dom-client.development.js:9127:7)
|
|
at setBusy (src/views/AdminUsersPage.tsx:68:103)
|
|
at finishAction (src/views/AdminUsersPage.tsx:123:15)
|
|
|
|
node.exe : FAIL src/admin-users-page.test.tsx (13.775 s)
|
|
At line:1 char:1
|
|
+ & "C:\Program Files\nodejs/node.exe" "C:\Program Files\nodejs/node_mo ...
|
|
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
+ CategoryInfo : NotSpecified: (FAIL src/admin-....tsx (13.775 s):String) [], RemoteException
|
|
+ FullyQualifiedErrorId : NativeCommandError
|
|
|
|
● reports 2FA state without mistaking an older response for disabled (mobile true)
|
|
|
|
Unable to find an element with the text: 2FA enabled. This could be because the text is broken up by multiple
|
|
elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
|
|
|
|
Ignored nodes: comments, script, style
|
|
[36m<body>[39m
|
|
[36m<div>[39m
|
|
[36m<div[39m
|
|
[33maria-busy[39m=[32m"false"[39m
|
|
[33maria-label[39m=[32m"Users"[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-1pt1ae"[39m
|
|
[33mrole[39m=[32m"group"[39m
|
|
[33mtabindex[39m=[32m"-1"[39m
|
|
[36m>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root
|
|
MuiAlert-colorInfo MuiAlert-standardInfo MuiAlert-standard css-cc6lo2-MuiPaper-root-MuiAlert-root"[39m
|
|
[33mrole[39m=[32m"alert"[39m
|
|
[33mstyle[39m=[32m"--Paper-shadow: var(--shadows-0); --Paper-overlay: var(--overlays-0);"[39m
|
|
[36m>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiAlert-icon css-1wrdnka-MuiAlert-icon"[39m
|
|
[36m>[39m
|
|
[36m<svg[39m
|
|
[33maria-hidden[39m=[32m"true"[39m
|
|
[33mclass[39m=[32m"MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-8hoymy-MuiSvgIcon-root"[39m
|
|
[33mdata-testid[39m=[32m"InfoOutlinedIcon"[39m
|
|
[33mfocusable[39m=[32m"false"[39m
|
|
[33mviewBox[39m=[32m"0 0 24 24"[39m
|
|
[36m>[39m
|
|
[36m<path[39m
|
|
[33md[39m=[32m"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,
|
|
12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0
|
|
12,2M11,17H13V11H11V17Z"[39m
|
|
[36m/>[39m
|
|
[36m</svg>[39m
|
|
[36m</div>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiAlert-message css-zioonp-MuiAlert-message"[39m
|
|
[36m>[39m
|
|
[0mThe final administrator is protected. Removing your own administrator role requires explicit
|
|
confirmation.[0m
|
|
[36m</div>[39m
|
|
[36m</div>[39m
|
|
[36m<section[39m
|
|
[33maria-labelledby[39m=[32m"_r_35_"[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-agrbqe"[39m
|
|
[36m>[39m
|
|
[36m<header[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-ekq74m"[39m
|
|
[36m>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-14m33b5"[39m
|
|
[36m>[39m
|
|
[36m<h2[39m
|
|
[33mclass[39m=[32m"MuiTypography-root MuiTypography-sectionTitle
|
|
css-1ebwfki-MuiTypography-root"[39m
|
|
[33mid[39m=[32m"_r_35_"[39m
|
|
[36m>[39m
|
|
[0mCreate user[0m
|
|
[36m</h2>[39m
|
|
[36m</div>[39m
|
|
[36m</header>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-31l7gp"[39m
|
|
[36m>[39m
|
|
[36m<form[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-0"[39m
|
|
[36m>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-1ngi8ue"[39m
|
|
[36m>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiFormControl-root MuiFormControl-fullWidth MuiTextField-root
|
|
css-cmpglg-MuiFormControl-root-MuiTextField-root"[39m
|
|
[36m>[39m
|
|
[36m<label[39m
|
|
[33mclass[39m=[32m"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl
|
|
MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-outlined MuiFormLabel-colorPrimary MuiInputLabel-root
|
|
MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-outlined
|
|
css-gv8fz8-MuiFormLabel-root-MuiInputLabel-root"[39m
|
|
[33mdata-shrink[39m=[32m"false"[39m
|
|
[33mfor[39m=[32m"_r_36_"[39m
|
|
[33mid[39m=[32m"_r_36_-label"[39m
|
|
[36m>[39m
|
|
[0mEmail[0m
|
|
[36m</label>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary
|
|
MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall
|
|
css-1pdqkhm-MuiInputBase-root-MuiOutlinedInput-root"[39m
|
|
[36m>[39m
|
|
[36m<input[39m
|
|
[33maria-invalid[39m=[32m"false"[39m
|
|
[33mclass[39m=[32m"MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputSizeSmall
|
|
css-t1wzep-MuiInputBase-input-MuiOutlinedInput-input"[39m
|
|
[33mid[39m=[32m"_r_36_"[39m
|
|
[33mtype[39m=[32m"text"[39m
|
|
[33mvalue[39m=[32m""[39m
|
|
[36m/>[39m
|
|
[36m<fieldset[39m
|
|
[33maria-hidden[39m=[32m"true"[39m
|
|
[33mclass[39m=[32m"MuiOutlinedInput-notchedOutline
|
|
css-3q580a-MuiNotchedOutlined-root-MuiOutlinedInput-notchedOutline"[39m
|
|
[36m>[39m
|
|
[36m<legend[39m
|
|
[33mclass[39m=[32m"css-1n64csd-MuiNotchedOutlined-root"[39m
|
|
[36m>[39m
|
|
[36m<span>[39m
|
|
[0mEmail[0m
|
|
[36m</span>[39m
|
|
[36m</legend>[39m
|
|
[36m</fieldset>[39m
|
|
[36m</div>[39m
|
|
[36m</div>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiFormControl-root MuiFormControl-fullWidth MuiTextField-root
|
|
css-cmpglg-MuiFormControl-root-MuiTextField-root"[39m
|
|
[36m>[39m
|
|
[36m<label[39m
|
|
[33mclass[39m=[32m"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl
|
|
MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-outlined MuiFormLabel-colorPrimary MuiInputLabel-root
|
|
MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-outlined
|
|
css-gv8fz8-MuiFormLabel-root-MuiInputLabel-root"[39m
|
|
[33mdata-shrink[39m=[32m"false"[39m
|
|
[33mfor[39m=[32m"_r_37_"[39m
|
|
[33mid[39m=[32m"_r_37_-label"[39m
|
|
[36m>[39m
|
|
[0mNew password[0m
|
|
[36m</label>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary
|
|
MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall
|
|
css-1pdqkhm-MuiInputBase-root-MuiOutlinedInput-root"[39m
|
|
[36m>[39m
|
|
[36m<input[39m
|
|
[33maria-invalid[39m=[32m"false"[39m
|
|
[33mclass[39m=[32m"MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputSizeSmall
|
|
css-t1wzep-MuiInputBase-input-MuiOutlinedInput-input"[39m
|
|
[33mid[39m=[32m"_r_37_"[39m
|
|
[33mtype[39m=[32m"password"[39m
|
|
[33mvalue[39m=[32m""[39m
|
|
[36m/>[39m
|
|
[36m<fieldset[39m
|
|
[33maria-hidden[39m=[32m"true"[39m
|
|
[33mclass[39m=[32m"MuiOutlinedInput-notchedOutline css-3q580a-MuiNotchedOut...
|
|
|
|
73 | { ...common, id: 'unknown', email: 'unknown@example.test' },
|
|
74 | ]);
|
|
> 75 | expect(await screen.findByText('2FA enabled')).toBeVisible();
|
|
| ^
|
|
76 | expect(screen.getByText('2FA disabled')).toBeVisible();
|
|
77 | expect(screen.getByText('2FA status unavailable')).toBeVisible();
|
|
78 | expect(mockedApi.get).toHaveBeenCalledWith('/users');
|
|
|
|
at waitForWrapper (node_modules/@testing-library/dom/dist/wait-for.js:163:27)
|
|
at node_modules/@testing-library/dom/dist/query-helpers.js:86:33
|
|
at findByText (src/admin-users-page.test.tsx:75:23)
|
|
|
|
● reports 2FA state without mistaking an older response for disabled (mobile false)
|
|
|
|
Unable to find an element with the text: 2FA enabled. This could be because the text is broken up by multiple
|
|
elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
|
|
|
|
Ignored nodes: comments, script, style
|
|
[36m<body>[39m
|
|
[36m<div>[39m
|
|
[36m<div[39m
|
|
[33maria-busy[39m=[32m"false"[39m
|
|
[33maria-label[39m=[32m"Users"[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-1pt1ae"[39m
|
|
[33mrole[39m=[32m"group"[39m
|
|
[33mtabindex[39m=[32m"-1"[39m
|
|
[36m>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root
|
|
MuiAlert-colorInfo MuiAlert-standardInfo MuiAlert-standard css-cc6lo2-MuiPaper-root-MuiAlert-root"[39m
|
|
[33mrole[39m=[32m"alert"[39m
|
|
[33mstyle[39m=[32m"--Paper-shadow: var(--shadows-0); --Paper-overlay: var(--overlays-0);"[39m
|
|
[36m>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiAlert-icon css-1wrdnka-MuiAlert-icon"[39m
|
|
[36m>[39m
|
|
[36m<svg[39m
|
|
[33maria-hidden[39m=[32m"true"[39m
|
|
[33mclass[39m=[32m"MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-8hoymy-MuiSvgIcon-root"[39m
|
|
[33mdata-testid[39m=[32m"InfoOutlinedIcon"[39m
|
|
[33mfocusable[39m=[32m"false"[39m
|
|
[33mviewBox[39m=[32m"0 0 24 24"[39m
|
|
[36m>[39m
|
|
[36m<path[39m
|
|
[33md[39m=[32m"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,
|
|
12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0
|
|
12,2M11,17H13V11H11V17Z"[39m
|
|
[36m/>[39m
|
|
[36m</svg>[39m
|
|
[36m</div>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiAlert-message css-zioonp-MuiAlert-message"[39m
|
|
[36m>[39m
|
|
[0mThe final administrator is protected. Removing your own administrator role requires explicit
|
|
confirmation.[0m
|
|
[36m</div>[39m
|
|
[36m</div>[39m
|
|
[36m<section[39m
|
|
[33maria-labelledby[39m=[32m"_r_3u_"[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-agrbqe"[39m
|
|
[36m>[39m
|
|
[36m<header[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-ekq74m"[39m
|
|
[36m>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-14m33b5"[39m
|
|
[36m>[39m
|
|
[36m<h2[39m
|
|
[33mclass[39m=[32m"MuiTypography-root MuiTypography-sectionTitle
|
|
css-1ebwfki-MuiTypography-root"[39m
|
|
[33mid[39m=[32m"_r_3u_"[39m
|
|
[36m>[39m
|
|
[0mCreate user[0m
|
|
[36m</h2>[39m
|
|
[36m</div>[39m
|
|
[36m</header>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-31l7gp"[39m
|
|
[36m>[39m
|
|
[36m<form[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-0"[39m
|
|
[36m>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiBox-root css-1ngi8ue"[39m
|
|
[36m>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiFormControl-root MuiFormControl-fullWidth MuiTextField-root
|
|
css-cmpglg-MuiFormControl-root-MuiTextField-root"[39m
|
|
[36m>[39m
|
|
[36m<label[39m
|
|
[33mclass[39m=[32m"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl
|
|
MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-outlined MuiFormLabel-colorPrimary MuiInputLabel-root
|
|
MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-outlined
|
|
css-gv8fz8-MuiFormLabel-root-MuiInputLabel-root"[39m
|
|
[33mdata-shrink[39m=[32m"false"[39m
|
|
[33mfor[39m=[32m"_r_3v_"[39m
|
|
[33mid[39m=[32m"_r_3v_-label"[39m
|
|
[36m>[39m
|
|
[0mEmail[0m
|
|
[36m</label>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary
|
|
MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall
|
|
css-1pdqkhm-MuiInputBase-root-MuiOutlinedInput-root"[39m
|
|
[36m>[39m
|
|
[36m<input[39m
|
|
[33maria-invalid[39m=[32m"false"[39m
|
|
[33mclass[39m=[32m"MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputSizeSmall
|
|
css-t1wzep-MuiInputBase-input-MuiOutlinedInput-input"[39m
|
|
[33mid[39m=[32m"_r_3v_"[39m
|
|
[33mtype[39m=[32m"text"[39m
|
|
[33mvalue[39m=[32m""[39m
|
|
[36m/>[39m
|
|
[36m<fieldset[39m
|
|
[33maria-hidden[39m=[32m"true"[39m
|
|
[33mclass[39m=[32m"MuiOutlinedInput-notchedOutline
|
|
css-3q580a-MuiNotchedOutlined-root-MuiOutlinedInput-notchedOutline"[39m
|
|
[36m>[39m
|
|
[36m<legend[39m
|
|
[33mclass[39m=[32m"css-1n64csd-MuiNotchedOutlined-root"[39m
|
|
[36m>[39m
|
|
[36m<span>[39m
|
|
[0mEmail[0m
|
|
[36m</span>[39m
|
|
[36m</legend>[39m
|
|
[36m</fieldset>[39m
|
|
[36m</div>[39m
|
|
[36m</div>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiFormControl-root MuiFormControl-fullWidth MuiTextField-root
|
|
css-cmpglg-MuiFormControl-root-MuiTextField-root"[39m
|
|
[36m>[39m
|
|
[36m<label[39m
|
|
[33mclass[39m=[32m"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl
|
|
MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-outlined MuiFormLabel-colorPrimary MuiInputLabel-root
|
|
MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-sizeSmall MuiInputLabel-outlined
|
|
css-gv8fz8-MuiFormLabel-root-MuiInputLabel-root"[39m
|
|
[33mdata-shrink[39m=[32m"false"[39m
|
|
[33mfor[39m=[32m"_r_40_"[39m
|
|
[33mid[39m=[32m"_r_40_-label"[39m
|
|
[36m>[39m
|
|
[0mNew password[0m
|
|
[36m</label>[39m
|
|
[36m<div[39m
|
|
[33mclass[39m=[32m"MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary
|
|
MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall
|
|
css-1pdqkhm-MuiInputBase-root-MuiOutlinedInput-root"[39m
|
|
[36m>[39m
|
|
[36m<input[39m
|
|
[33maria-invalid[39m=[32m"false"[39m
|
|
[33mclass[39m=[32m"MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputSizeSmall
|
|
css-t1wzep-MuiInputBase-input-MuiOutlinedInput-input"[39m
|
|
[33mid[39m=[32m"_r_40_"[39m
|
|
[33mtype[39m=[32m"password"[39m
|
|
[33mvalue[39m=[32m""[39m
|
|
[36m/>[39m
|
|
[36m<fieldset[39m
|
|
[33maria-hidden[39m=[32m"true"[39m
|
|
[33mclass[39m=[32m"MuiOutlinedInput-notchedOutline css-3q580a-MuiNotchedOut...
|
|
|
|
73 | { ...common, id: 'unknown', email: 'unknown@example.test' },
|
|
74 | ]);
|
|
> 75 | expect(await screen.findByText('2FA enabled')).toBeVisible();
|
|
| ^
|
|
76 | expect(screen.getByText('2FA disabled')).toBeVisible();
|
|
77 | expect(screen.getByText('2FA status unavailable')).toBeVisible();
|
|
78 | expect(mockedApi.get).toHaveBeenCalledWith('/users');
|
|
|
|
at waitForWrapper (node_modules/@testing-library/dom/dist/wait-for.js:163:27)
|
|
at node_modules/@testing-library/dom/dist/query-helpers.js:86:33
|
|
at findByText (src/admin-users-page.test.tsx:75:23)
|
|
|
|
Test Suites: 1 failed, 1 total
|
|
Tests: 2 failed, 12 passed, 14 total
|
|
Snapshots: 0 total
|
|
Time: 14.829 s, estimated 15 s
|
|
Ran all test suites matching admin-users-page.test.tsx.
|