Closed ayemelyanenko-chegg closed 1 year ago
Hi @ayemelyanenko-chegg,
I ran the shared example without the --experimental-proxyless
flag, and it also failed.
Please fix the example.
@miherlosev Hello, thanks for getting back to me. I updated the example, please pull in latest for the repo and then re-run and let me know if it worked for you. If it didn't, please post a screenshot if possible, perhaps you are getting blocked from running automation on the production page. If that is the case, then I'll look for another example if possible. Thanks.
I ran the updated example and got the same error as in the https://github.com/DevExpress/testcafe/issues/7588#issuecomment-1484631323. Please, fix it.
Apologies for this @miherlosev. I did manage to get a testcafe log and the comparison between request outputs from running the test locally, perhaps this will help? If not, I will keep looking for ways to have a working sample
export DEBUG="testcafe:*,hammerhead:*" && npx testcafe chrome tests/sampleEventTest.ts --experimental-proxyless -e 2>testcafe.log
https://upload.disroot.org/r/XMYDW6mG#oJwFbCENsp2mgyMoTgu5+XnJKthAwH2WXD4TBSJZ9NQ=
Regular mode console.log(r.request);
{ timestamp: 1680555528136, url: 'https://analytics.chegg.com/rio-service-web/rest/rio-events/batch', method: 'post', headers: { host: 'analytics.chegg.com', connection: 'keep-alive', 'content-length': 4500, accept: 'application/json, text/plain, */*', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36', 'content-type': 'application/json', origin: 'https://www.citationmachine.net', referer: 'https://www.citationmachine.net/', 'accept-encoding': 'gzip, deflate', 'accept-language': 'en-US,en;q=0.9', cookie: 'CVID=5aca262f-e7ce-40ed-9cd3-b60d94b006eb; CSID=1680555525870' }, body: '[{"data":{"component_view":{"component":{"name":"check out our demo page","type":"link","text":"Check out our demo page"}}},"event_id":"28a378f4-5fd8-432c-86d1-9b3b3109158f","event_time":"2023-04-03T20:58:46.173Z","cloud_events_version":"0.1","event_type":"net.citationmachine.clickstream_component_view","source":"/web/citationmachine/ucf","event_type_version":"3","content_type":"application/json","extensions":{"client_common":{"uvn":"31abd50280e3c6ed4f59e03b498f1712642b3e037ced90.62830028","usprivacy":"1YNY","url":"https://www.citationmachine.net/","platform":"desktop","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36","auth_state":"logged_out","test_cells":[{"layer":"al_cell","cell":"av-release-58-control"}],"referral_url":"http://10.0.0.246:59618/browser/idle/dF5nf7-","browser_name":"Chrome","browser_version":"111.0.0.0","os":"macOS","os_ver":"10.15.7","analytics_module_version":"9.6.43","user_subscription_status":[{"product":"citation_machine_plus","status":"non_member"}],"base_event_type":"web","base_event_version":"4","view":{"property":"wt","experience":"cm","view_name":"homepage"},"window_dimensions":{"px_width":1200,"px_height":749},"browser_language":"en-US","session_replay_link":"","client_cookie_consent":",SPD_BG,trg,snc,fnc,prf,","browser_tracking":null,"global_privacy_control":null,"chegg_visitor_id":"5aca262f-e7ce-40ed-9cd3-b60d94b006eb","chegg_session_id":1680555525532}}},{"data":{},"event_id":"9ecb5198-4fd8-4c0e-a7ba-dda256dee687","event_time":"2023-04-03T20:58:46.186Z","cloud_events_version":"0.1","event_type":"net.citationmachine.clickstream_view","source":"/web/citationmachine/ucf","event_type_version":"3","content_type":"application/json","extensions":{"client_common":{"uvn":"31abd50280e3c6ed4f59e03b498f1712642b3e037ced90.62830028","usprivacy":"1YNY","url":"https://www.citationmachine.net/","platform":"desktop","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36","auth_state":"logged_out","test_cells":[{"layer":"al_cell","cell":"av-release-58-control"}],"referral_url":"http://10.0.0.246:59618/browser/idle/dF5nf7-","browser_name":"Chrome","browser_version":"111.0.0.0","os":"macOS","os_ver":"10.15.7","analytics_module_version":"9.6.43","user_subscription_status":[{"product":"citation_machine_plus","status":"non_member"}],"base_event_type":"web","base_event_version":"4","view":{"property":"wt","experience":"cm","view_name":"homepage"},"window_dimensions":{"px_width":1200,"px_height":749},"browser_language":"en-US","session_replay_link":"","client_cookie_consent":",SPD_BG,trg,snc,fnc,prf,","browser_tracking":null,"global_privacy_control":null,"chegg_visitor_id":"5aca262f-e7ce-40ed-9cd3-b60d94b006eb","chegg_session_id":1680555525532}}},{"data":{"allocation_id":"31abd50280e3c6ed4f59e03b498f1712642b3e037ced90.62830028","allocation_id_type":"chegg_uvn","project_id":"17022043465","experiment_id":"22180830219","variant_id":"22164360162"},"event_id":"e6bd3ef2-247b-477b-a499-353ba6402713","event_time":"2023-04-03T20:58:47.764Z","cloud_events_version":"0.1","event_type":"net.citationmachine.optimizely_allocation","source":"/web/citationmachine/ucf","event_type_version":"3","content_type":"application/json","extensions":{"client_common":{"uvn":"31abd50280e3c6ed4f59e03b498f1712642b3e037ced90.62830028","usprivacy":"1YNY","url":"https://www.citationmachine.net/","platform":"desktop","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36","auth_state":"logged_out","test_cells":[{"layer":"al_cell","cell":"av-release-58-control"}],"experiments":[{"experiment_id":"22180830219","variant_id":"22164360162"}],"referral_url":"http://10.0.0.246:59618/browser/idle/dF5nf7-","browser_name":"Chrome","browser_version":"111.0.0.0","os":"macOS","os_ver":"10.15.7","analytics_module_version":"9.6.43","user_subscription_status":[{"product":"citation_machine_plus","status":"non_member"}],"base_event_type":"web","base_event_version":"4","view":{"property":"wt","experience":"cm","view_name":"homepage"},"window_dimensions":{"px_width":1200,"px_height":749},"browser_language":"en-US","session_replay_link":"","client_cookie_consent":",SPD_BG,trg,snc,fnc,prf,","browser_tracking":null,"global_privacy_control":null,"chegg_visitor_id":"5aca262f-e7ce-40ed-9cd3-b60d94b006eb","chegg_session_id":1680555525532}}}]' }
Experimental proxyless console.log(r.request). Please notice the strange body output, it seems like it's in unicode for some reason?
{ timestamp: 1680555616497, url: 'https://analytics.chegg.com/rio-service-web/rest/rio-events/batch', method: 'post', headers: { accept: 'application/json, text/plain, */*', 'content-type': 'application/json', cookie: 'CVID=9a341ace-1c1d-4170-9fcd-8f91fdccd7b5; CSID=1680555615601', origin: 'https://www.citationmachine.net', referer: 'https://www.citationmachine.net/', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36', 'sec-ch-ua': '"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"macOS"' }, body: 'u�Zr���w����{\x07(��\'z{gjg���$��h��^��Z��r��b�K^�Сy�(��.�צ���y�ޞ��w}�ߎ^k���_����k���M��gZkW\x1Cy�ޞ��g��m�ӏ��=��My�~\x19rZ.w��z{l����*\'�W�z{\x7F�*^��\\�֭���i�b��%��,�����(��\'z{\x7F�\'����q��y�܊֭���i�b���q��z{\x7F�*^����*\'��\'����ܩy�i�\'\x1A�*\'�;(��mz{"�{\x1C�\'���(�j\'�������w�������^�V��n8սz�f�{���~�s~��}���)�+�s-X5���\x1Bm����\f\x1C�֭���i�b���ej��g^�Kh��\x1E���z{L�8�����Ɯ�{h�\x12\'��LiÒ_]?ן�\x02�eyg�*+\x7F�~���0�b��rJ\x02��&{�u�M4I�ڮ/�߽�j�a��Z��h�\x07������-�ǥ��Z��ڗ�\x1E�W\x1E�V�o�!y�>�o��{k�Z�}��j_�Xm�����\x1A�\x1A,��|��ۮ�,z��jg���&y���ǫ����*\'�]t�J,��\x0EJ�?����^{jv�����v�^����*\'��7�ǫ�˛���ب��-j۬��\x1D��\\�֭�����!�w��[��֭��������m�\x1E��ޞ��ʗ�y�ڱ�������*\'���\x9A����\x0B^Ɨ����yɯ��?��������\x1E�)ݣ\x0F݊g��*\'��\x7F�\'m�]�Ҝ\x7F�蠆������ǫ�V���y��Q+\x1E�Ȩ��ަV��X���bz{\x7Fr�$��ܢ{\x1E�ԏ\x0F�F��,���r��n�0�������)���e�Z\x1Bj_�+�s/ܢ{k�Y�V�����ȝ��}��]��}��m��}���9��z�x�w!z\b?�+"�����ZߍZq�sW~�^����w�\x1F�W�q�{o�!z\b?��,�����z�Ny�y�O]j֞����\'ts��}Ǿ�ʹ��v��翽\x7F���]���\x1E����ئ{m6��8�M��]4מxٗ%��\x7Fz�����z�"�}5z����r��ȭjب�f��)�rX���ky���\'����q��y�܊֭���i�b���q��z{\x7F�*^����*\'��\'����ܩy�i�\'\x1A�*\'�;(��mz{"�{\x1C�\'���(�j\'�������w�������^�V��n8սz�f�{���~�s~��}���)�+�s-X5���\x1Bm����\f\x1C�֭���i�b���ej��g^�Kh��\x1E���z{L�8�����Ɯ�{h�\x12\'��LiÒ_]?ן�\x02�eyg�*+\x7F�~���0�b��rJ\x02��&{�u�M4I�ڮ/�߽�j�a��Z��h�\x07������-�ǥ��Z��ڗ�\x1E�W\x1E�V�o�!y�>�o��{k�Z�}��j_�Xm�����\x1A�\x1A,��|��ۮ�,z��jg���&y���ǫ����*\'�]t�J,��\x0EJ�?����^{jv�����v�^����*\'��7�ǫ�˛���ب��-j۬��\x1D��\\�֭�����!�w��[��֭��������m�\x1E��ޞ��ʗ�y�ڱ�������*\'���\x9A����\x0B^Ɨ����yɯ��?��������\x1E�)ݣ\x0F݊g��*\'��\x7F�\'m�]�Ҝ\x7F�蠆������ǫ�V���y��Q+\x1E�Ȩ��ަV��X���bz{\x7Fr�$��ܢ{\x1E�ԏ\x0F�F��,���r��n�0�������)���e�Z\x1Bj_�+�s/ܢ{k�Y�V�����ȝ��}��]��}��m��}���9��z�x�w!z\b?�+"�����ZߍZq�sW~�^����w�\x1F�W�q�{o�!z\b?��,�����z�Ny�y�O]j֚�Z\x1Cjب���ۿ7�wמ{�;۾�{�Z����V�덛��^�������}��֥��\x1A�*\'�\'\x7F�*^r\x17��������-�\'u�M�Ӎ�뗱������\'v�_4�}6��ڮ&�����m���o\x1E����\'^��8���wG{�����z\x7FϽם��n|wO^����ئ{m6��8�M��]4}%��\x7Fz�����z�"�}5z����r��ȭjب�f��)ޢ�b�,ޗ/ږZ\x1Cjب��.�ǿ���r+Z�*\'��!�w������ܩ{�ޮȨ�w(�ק��r�橦X�jب���w���슉�rX���ܢi����ۿ7�wמ{�;۾�{�Z����V�덛��^�������}��۬���i̵
�.�Xm��?�\f0r+Z�\'��!�w�z�镫���z�-���z�ځ��2��V��C\x1Ar)���H�ץ1�\x0EI}t�^\x7F�\n' +
'i��l�����ߢ�L��G�y�(\n' +
"\x1A����]4�&�j���~�髭��-jץ�\b\x1Ew�.���\x1E�[%k'�j�zY\zYZm����$���r����^Ɨ��g��DZ������'v�_4�}6��ڮ&�����m���o+y����\x7F��a��\x7F�Z\x1CjXh��}��\x7Fn�0������\n" +
"\x1A���\x0B\x1E��ޮȨ�]u�M(�f�9,����My��ڗ+br��ۥ{�ޮȨ���\x1E��.n�+��b�\x7F쵫n���v�-r+Z�'�f��)���n��Z��'�\x7F�zfޭ��{��z{\x7F�^���jǿz����ޮȨ���{\n" +
k����,-{\x1A^�'�q�&�'��v�z\x1A&z��{\b�v�?v)��Ȩ��q�\b��\x1Dv�Jq�\x17��\x1B{��\x0B\x1E��Z�\x0B����D�z�"�\x7F�z�Z��b�G%�����(�'�r��z{R<?�\x1A��w\x1F��k}���ǫ���rH��{��\thm�\x7F���i̿r����g�YZv���g"w�y�^���v��M����<�}�=�܅� �����+�'}k~5iǾ��]��{��_q\x7F�_u�\x1D��\\�� �Ǭ�*'�'u��9瞵�=
}
testcafe:errors processTestFnError: SyntaxError: Unexpected token u in JSON at position 0`
Hello @ayemelyanenko-chegg ,
Thank you for sharing the log with us. We researched it, but we could not find the cause of this behavior. If possible, please send us a working example with which we can reproduce the issue. It will help us improve the "Native Automation" (aka "Proxyless") mode.
Hello @aleks-pro. Apologies for my inability to provide a working example.
I believe I have missed a step in the instructions and the example should hopefully now work. I also added a log output to show the problem if you manage to get the example to work.
Please follow the steps in the steps to reproduce section again.
Thanks.
Hi,
It works now. Thank you. I reproduced the issue. We will look into it and update this thread once we have any results.
I'm getting the same malformed body from logger with NA enabled, any updates on this? If it helps, I tried decoding with everything from here, but no luck.
We fixed this issue but did not publish the new release yet. Please try installing TestCafe from the latest master branch and check if this helps.
What is your Scenario?
Hello, I am running a test which visits a page, gets a logging event from a request and then parses the request body
What is the Current behavior?
When running the test with native automation, it fails with
What is the Expected behavior?
The test should pass because it passes without native automation
What is your public website URL? (or attach your complete example)
https://www.citationmachine.net/
What is your TestCafe test code?
Your complete configuration file
No response
Your complete test report
Screenshots
Steps to Reproduce
Clone https://github.com/ayemelyanenko-chegg/nextjs-nodejs-example
CD into nextjs-nodejs-example/
cd into my-app
npm install
Export variable in terminal by doing: export CHEGG_ENV=prod
Run with: npx testcafe chrome tests/sampleEventTest.ts --native-automation and test fails. Note the unicode body response in attached screenshot
Run with: npx testcafe chrome tests/sampleEventTest.ts and test passes
TestCafe version
2.5.0
Node.js version
18.15.0
Command-line arguments
npx testcafe chrome tests/sampleEventTest.ts --native-automation
Browser name(s) and version(s)
No response
Platform(s) and version(s)
No response
Other
No response