Created
July 17, 2021 12:33
-
-
Save mtreacy002/ab5abf21a637a89c6b203ac84ada44c5 to your computer and use it in GitHub Desktop.
login test failed with afterEach(cleanup)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FAIL src/tests/Login.test.jsx (5.858s) | |
● Console | |
console.error node_modules/@testing-library/react/dist/act-compat.js:52 | |
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function. | |
in Login (at Login.test.jsx:31) | |
in Router (created by BrowserRouter) | |
in BrowserRouter (at Login.test.jsx:31) | |
console.error node_modules/@testing-library/react/dist/act-compat.js:52 | |
Warning: You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. | |
● handles wrong credentials | |
TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:" | |
at Object.proxiedOriginalRequest (node_modules/node-request-interceptor/lib/http/override.js:53:36) | |
at ClientRequestOverride.<anonymous> (node_modules/node-request-interceptor/lib/http/ClientRequest/ClientRequestOverride.js:213:35) | |
at step (node_modules/node-request-interceptor/lib/http/ClientRequest/ClientRequestOverride.js:33:23) | |
at Object.next (node_modules/node-request-interceptor/lib/http/ClientRequest/ClientRequestOverride.js:14:53) | |
at fulfilled (node_modules/node-request-interceptor/lib/http/ClientRequest/ClientRequestOverride.js:5:58) | |
● handles server down | |
Unable to find a label with the text of: errorMessage | |
<body /> | |
73 | }) | |
74 | | |
> 75 | await waitForElement(() => screen.getByLabelText('errorMessage')) | |
| ^ | |
76 | | |
77 | expect(screen.getByLabelText('errorMessage')).toHaveTextContent("Username or password is wrong.") | |
78 | }) | |
at Object.getElementError (node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/config.js:34:12) | |
at getAllByLabelText (node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/queries/label-text.js:121:38) | |
at getByLabelText (node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/query-helpers.js:54:17) | |
at src/tests/Login.test.jsx:75:39 | |
at MutationObserver.onMutation [as _listener] (node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/wait-for-element.js:46:24) | |
at check (node_modules/@sheerun/mutationobserver-shim/MutationObserver.js:47:26) | |
at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:678:19) | |
● handles server down | |
Unable to find a label with the text of: errorMessage | |
<body /> | |
104 | }) | |
105 | | |
> 106 | await waitForElement(() => screen.getByLabelText('errorMessage')) | |
| ^ | |
107 | | |
108 | expect(screen.getByLabelText('errorMessage')).toHaveTextContent("The server is currently unavailable. Try again later") | |
109 | }) | |
at Object.getElementError (node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/config.js:34:12) | |
at getAllByLabelText (node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/queries/label-text.js:121:38) | |
at getByLabelText (node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/query-helpers.js:54:17) | |
at src/tests/Login.test.jsx:106:39 | |
at MutationObserver.onMutation [as _listener] (node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/wait-for-element.js:46:24) | |
at check (node_modules/@sheerun/mutationobserver-shim/MutationObserver.js:47:26) | |
at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:678:19) | |
Test Suites: 2 failed, 1 passed, 3 total | |
Tests: 4 failed, 10 passed, 14 total | |
Snapshots: 0 total | |
Time: 6.7s, estimated 7s | |
Ran all test suites. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment