testcafe issue when returning from a Node ExpressJS redirect










0














I'm currently testing a React front-end application with TestCafe. Current environment is:



React: 16.3.2
Node: 8.10.0
TestCafe: 0.23.0
MacOS Mojave 10.14.1



We've written about 65 tests which all run great. We've introduced a Single Sign On component into our application which has posed some automation challenges. Instead of trying to drive TestCafe against our app AND this particular SSO provider, we're using a fake API call instead.



Simplified order of operations for the app during normal usage is:
1. React app starts, detects no SSO credentials
2. Environmental service provides app with a proper SSO URL, react app redirects user to SSO login page using window.location
3. User logs in and SSO redirects back to our react app with a an additional URL query param & respective value.
4. React app proceeds forward in a 'logged in' state



Pretty basic stuff.



When the React app is being tested, we just provide different URLs which point to a local ExpressJS instance on localhost:3002. When the React app performs a window.location to the fake SSO API (http://localhost:3002/fakeOAuth) the ExpressJS instance simply performs a response.redirect(http://localhost:3000/?sso=fakeCode) and now we are back to our React app with the additional synthetic SSO data. This scheme works great when not being driven by TestCafe.



When we drive the React app via TestCafe, TestCafe hangs when returning back from the fake SSO call to the React app. After this hang, we have to forcefully kill TestCafe on the command line with a ctrl-c.



Using chrome debug tools and looking at the console output, there is a message:



Uncaught TypeError: __get$ is not a function
at hotCreateRequire (bundle.js:73)
at bundle.js:719
at bundle.js:722


and a screenshot can be found at the end of this post below.



The Test code:



import Selector from 'testcafe'
fixture 'Landing Page Body Tests'
.page 'localhost:3000

test ('Displays correct main welcome title', async t =>
const landingPage = Selector('.card-title')
await t
.expect((landingPage).innerText).eql('Welcome, Fakeuser', 'Incorrect Username Found')
)


Screenshot of TestCafe failure



Does anyone have any ideas as to why TestCafe crashes? I have reworked the test a few times, researched and experimented with using TestCafe's Roles and ClientFunction classes but to no avail. Any input would be greatly appreciated.










share|improve this question




























    0














    I'm currently testing a React front-end application with TestCafe. Current environment is:



    React: 16.3.2
    Node: 8.10.0
    TestCafe: 0.23.0
    MacOS Mojave 10.14.1



    We've written about 65 tests which all run great. We've introduced a Single Sign On component into our application which has posed some automation challenges. Instead of trying to drive TestCafe against our app AND this particular SSO provider, we're using a fake API call instead.



    Simplified order of operations for the app during normal usage is:
    1. React app starts, detects no SSO credentials
    2. Environmental service provides app with a proper SSO URL, react app redirects user to SSO login page using window.location
    3. User logs in and SSO redirects back to our react app with a an additional URL query param & respective value.
    4. React app proceeds forward in a 'logged in' state



    Pretty basic stuff.



    When the React app is being tested, we just provide different URLs which point to a local ExpressJS instance on localhost:3002. When the React app performs a window.location to the fake SSO API (http://localhost:3002/fakeOAuth) the ExpressJS instance simply performs a response.redirect(http://localhost:3000/?sso=fakeCode) and now we are back to our React app with the additional synthetic SSO data. This scheme works great when not being driven by TestCafe.



    When we drive the React app via TestCafe, TestCafe hangs when returning back from the fake SSO call to the React app. After this hang, we have to forcefully kill TestCafe on the command line with a ctrl-c.



    Using chrome debug tools and looking at the console output, there is a message:



    Uncaught TypeError: __get$ is not a function
    at hotCreateRequire (bundle.js:73)
    at bundle.js:719
    at bundle.js:722


    and a screenshot can be found at the end of this post below.



    The Test code:



    import Selector from 'testcafe'
    fixture 'Landing Page Body Tests'
    .page 'localhost:3000

    test ('Displays correct main welcome title', async t =>
    const landingPage = Selector('.card-title')
    await t
    .expect((landingPage).innerText).eql('Welcome, Fakeuser', 'Incorrect Username Found')
    )


    Screenshot of TestCafe failure



    Does anyone have any ideas as to why TestCafe crashes? I have reworked the test a few times, researched and experimented with using TestCafe's Roles and ClientFunction classes but to no avail. Any input would be greatly appreciated.










    share|improve this question


























      0












      0








      0







      I'm currently testing a React front-end application with TestCafe. Current environment is:



      React: 16.3.2
      Node: 8.10.0
      TestCafe: 0.23.0
      MacOS Mojave 10.14.1



      We've written about 65 tests which all run great. We've introduced a Single Sign On component into our application which has posed some automation challenges. Instead of trying to drive TestCafe against our app AND this particular SSO provider, we're using a fake API call instead.



      Simplified order of operations for the app during normal usage is:
      1. React app starts, detects no SSO credentials
      2. Environmental service provides app with a proper SSO URL, react app redirects user to SSO login page using window.location
      3. User logs in and SSO redirects back to our react app with a an additional URL query param & respective value.
      4. React app proceeds forward in a 'logged in' state



      Pretty basic stuff.



      When the React app is being tested, we just provide different URLs which point to a local ExpressJS instance on localhost:3002. When the React app performs a window.location to the fake SSO API (http://localhost:3002/fakeOAuth) the ExpressJS instance simply performs a response.redirect(http://localhost:3000/?sso=fakeCode) and now we are back to our React app with the additional synthetic SSO data. This scheme works great when not being driven by TestCafe.



      When we drive the React app via TestCafe, TestCafe hangs when returning back from the fake SSO call to the React app. After this hang, we have to forcefully kill TestCafe on the command line with a ctrl-c.



      Using chrome debug tools and looking at the console output, there is a message:



      Uncaught TypeError: __get$ is not a function
      at hotCreateRequire (bundle.js:73)
      at bundle.js:719
      at bundle.js:722


      and a screenshot can be found at the end of this post below.



      The Test code:



      import Selector from 'testcafe'
      fixture 'Landing Page Body Tests'
      .page 'localhost:3000

      test ('Displays correct main welcome title', async t =>
      const landingPage = Selector('.card-title')
      await t
      .expect((landingPage).innerText).eql('Welcome, Fakeuser', 'Incorrect Username Found')
      )


      Screenshot of TestCafe failure



      Does anyone have any ideas as to why TestCafe crashes? I have reworked the test a few times, researched and experimented with using TestCafe's Roles and ClientFunction classes but to no avail. Any input would be greatly appreciated.










      share|improve this question















      I'm currently testing a React front-end application with TestCafe. Current environment is:



      React: 16.3.2
      Node: 8.10.0
      TestCafe: 0.23.0
      MacOS Mojave 10.14.1



      We've written about 65 tests which all run great. We've introduced a Single Sign On component into our application which has posed some automation challenges. Instead of trying to drive TestCafe against our app AND this particular SSO provider, we're using a fake API call instead.



      Simplified order of operations for the app during normal usage is:
      1. React app starts, detects no SSO credentials
      2. Environmental service provides app with a proper SSO URL, react app redirects user to SSO login page using window.location
      3. User logs in and SSO redirects back to our react app with a an additional URL query param & respective value.
      4. React app proceeds forward in a 'logged in' state



      Pretty basic stuff.



      When the React app is being tested, we just provide different URLs which point to a local ExpressJS instance on localhost:3002. When the React app performs a window.location to the fake SSO API (http://localhost:3002/fakeOAuth) the ExpressJS instance simply performs a response.redirect(http://localhost:3000/?sso=fakeCode) and now we are back to our React app with the additional synthetic SSO data. This scheme works great when not being driven by TestCafe.



      When we drive the React app via TestCafe, TestCafe hangs when returning back from the fake SSO call to the React app. After this hang, we have to forcefully kill TestCafe on the command line with a ctrl-c.



      Using chrome debug tools and looking at the console output, there is a message:



      Uncaught TypeError: __get$ is not a function
      at hotCreateRequire (bundle.js:73)
      at bundle.js:719
      at bundle.js:722


      and a screenshot can be found at the end of this post below.



      The Test code:



      import Selector from 'testcafe'
      fixture 'Landing Page Body Tests'
      .page 'localhost:3000

      test ('Displays correct main welcome title', async t =>
      const landingPage = Selector('.card-title')
      await t
      .expect((landingPage).innerText).eql('Welcome, Fakeuser', 'Incorrect Username Found')
      )


      Screenshot of TestCafe failure



      Does anyone have any ideas as to why TestCafe crashes? I have reworked the test a few times, researched and experimented with using TestCafe's Roles and ClientFunction classes but to no avail. Any input would be greatly appreciated.







      node.js reactjs google-chrome express testcafe






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 7 at 23:48

























      asked Nov 7 at 21:35









      BSmith

      83




      83






















          1 Answer
          1






          active

          oldest

          votes


















          1














          It looks like a bug in TestCafe. The __get$function is an internal TestCafe function, and the __get$ is not a function error means that TestCafe wasn't able to process your page properly and install its internal functions in the global window object.



          I suggest that you create a new bug report in the TestCafe repository, and provide a HAR report and an example that can be used to reproduce the problem.






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53198179%2ftestcafe-issue-when-returning-from-a-node-expressjs-redirect%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            It looks like a bug in TestCafe. The __get$function is an internal TestCafe function, and the __get$ is not a function error means that TestCafe wasn't able to process your page properly and install its internal functions in the global window object.



            I suggest that you create a new bug report in the TestCafe repository, and provide a HAR report and an example that can be used to reproduce the problem.






            share|improve this answer



























              1














              It looks like a bug in TestCafe. The __get$function is an internal TestCafe function, and the __get$ is not a function error means that TestCafe wasn't able to process your page properly and install its internal functions in the global window object.



              I suggest that you create a new bug report in the TestCafe repository, and provide a HAR report and an example that can be used to reproduce the problem.






              share|improve this answer

























                1












                1








                1






                It looks like a bug in TestCafe. The __get$function is an internal TestCafe function, and the __get$ is not a function error means that TestCafe wasn't able to process your page properly and install its internal functions in the global window object.



                I suggest that you create a new bug report in the TestCafe repository, and provide a HAR report and an example that can be used to reproduce the problem.






                share|improve this answer














                It looks like a bug in TestCafe. The __get$function is an internal TestCafe function, and the __get$ is not a function error means that TestCafe wasn't able to process your page properly and install its internal functions in the global window object.



                I suggest that you create a new bug report in the TestCafe repository, and provide a HAR report and an example that can be used to reproduce the problem.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 12 at 15:21

























                answered Nov 12 at 15:15









                Andrey Belym

                63137




                63137



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53198179%2ftestcafe-issue-when-returning-from-a-node-expressjs-redirect%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    Node.js Script on GitHub Pages or Amazon S3

                    Museum of Modern and Contemporary Art of Trento and Rovereto