aisingapore / TagUI

Free RPA tool by AI Singapore
Apache License 2.0
5.65k stars 585 forks source link

Bug - frame msg_body #38

Closed thim81 closed 7 years ago

thim81 commented 7 years ago

Hi @kensoh

I run into a bug when trying to use the frame method in a test flow

./src/tagui ./sample/2_signup_user firefox test

In this flow we use Mailinator to confirm a mail. When opening the mail, it opens the mail in a an iframe.

when using frame msg_body in the flow

tagui $ ./src/tagui ./sample/2_signup_user firefox test

It just outputs

Test file: /Users/Sites/localhost/tagui/sample/2_signup_user.js

And then just wait.

If we comment out frame msg_body in the flow, it runs the test without any problems, but it cannot click on anything the iframe

./src/tagui ./sample/2_signup_user firefox test

Test file: /Users/Sites/localhost/tagui/sample/2_signup_user.js           
Mon Jul 31 2017 14:00:35 GMT+0200 (CEST) 
# /Users/Sites/localhost/tagui/sample/2_signup_user 
# https://app.testing.co/login - testing 
# click Create your free account 
...
thim81 commented 7 years ago

Here is the source code of the page with the iframe

`    
   
   
   
   
   
   
   
   
 
 
 
  Mailinator
 
 
 
 
 
   
 
   
 
 
 
 
 
 
 
 
   
 
  <!--[if lt IE 9]>
 
 
  <![endif]-->
   
 
   
 
   
 
  Mailinator
 
 
 
 
 
 
 
 
 
   
 
   
 
  <body data-spy="scroll" data-target="nav"
  style="font-family:'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif" ng-controller="InboxCtrl"
  id="InboxCtrl">
   
   
   
   
 
 
 
 
 
   
 
 
 
   
  <div class="header_logo_text" style="cursor:pointer;float:left;font-weight: bold;color:white;"
  onclick="window.location='/'">
  MAILINATOR
 
 
   
 
  Sign up
 
 
  Log in
 
 
 
 
 
  Upgrade
  FAQ
  API
 
 
 
   
 
 
  <input type="text" placeholder="Enter Inbox" class="lb-input"
  onkeydown="if (event.keyCode == 13) { subInboxSameZone($('#inbox_field_mob').val()); $('#inbox_field_mob').blur(); return false; }"
  id="inbox_field_mob"/>
  <span id='inbox_button_mob' class="lb-btn"
  onclick="subInboxSameZone($('#inbox_field_mob').val()); $('#inbox_field_mob').blur(); return false;">
 
 
 
 
  <div id="activity_light" style="float:left;padding-top: 8px;"
  title="Mailinator Stream Connection Status">
 
 
  <div id="pause_icon"
  onclick="userPauseStream()"
  style="float:left;margin-left: 5px;padding-top: 8px;" title="Pause incoming emails">
 
 
 
 
  privacy-level:
 
 
  {{visibility}}
 
 
  query:
 
 
  {{original_query}}
 
 
  <div id="pin_inbox_icon"
  onclick="pinInbox();"
  style="float:left;margin-left: 3px;padding-top:5px;cursor: pointer;display: {{save_eligible}}"
  title="Save this Query">
 
 
   
 
 
 
  <span class="fa-stack fa-manylarge" title="Delete Emails"
  onclick="trashEmails();"
  style="cursor: pointer">
 
 
 
  <span class="fa-stack fa-manylarge"
   
  title="Login to Save Emails"
   
  style="cursor: pointer">
 
 
 
  <span class="fa-stack fa-manylarge"
   
  title="Login to Forward Emails"
   
  style="cursor: pointer;">
 
 
 
 
   
 
 
   
   
 
   
 
 
 
 
   
 
  <input type="text" placeholder="Enter Inbox" class="lb-input"
  onkeydown="if (event.keyCode == 13) { subInboxSameZone($('#inbox_field').val()); return false; }"
  id="inbox_field"
  />
  <span id='inbox_button' class="lb-btn"
  onclick="subInboxSameZone($('#inbox_field').val()); return false;">
 
 
 
 
   
 
   
   
 
      <li ng-repeat="status in status_list"
      class="lb_all_item">
      <p class="lball-text {{status.active}}" id='bigrow{{status.status_zone}}'
      onclick="itemInboxClick('{{status.status_zone}}')">
      {{status.title}}{{status.count}}

     
        <li ng-repeat="query in status.query_list"
        class="lb_all_sub-item {{query.active}}"
        onclick="subItemInboxClick('{{query.zone}}', '{{query.text}}')">
       
        {{query.pretty}}
        <div style="min-width: 2.4rem;float:right;text-align: right;"
        onclick="unpinInbox('{{query.zone}}', '{{query.text}}', '{{query.saved}}');if(event.stopPropagation){event.stopPropagation();}event.cancelBubble=true;"
        title="Delete Saved Query">
        <i class="fa fa-close"
        style="display:{{query.saved}};cursor: pointer;margin-left: 3px;color:#aaa;">
         
       
       
        {{query.count}}
       
       
       

       
       
       
       
         
       
         
         
       
       
       
         
       
        Mailinator Blog:
        Introducing the Mailinator Realtime Inbox !
       
         
       
        Need your own Private Mailinator?
        Upgrade Now
       
         
       
       
       
        <ins class="adsbygoogle"
        style="display:inline-block;width:160px;height:600px"
        data-ad-client="ca-pub-8366735459736268"
        data-ad-slot="8480074758">
       
       
         
       
        Links monetized by ClickRouter
       
         
         
         
         
       
       
       
       
       
       
       
        {{msg.subject}}
       
       
         
       
       
        {{msg.received}}
         
         
         
         
       
       
       
       
       
       
       
         
        <iframe id="msg_body" style="border: 0;overflow: hidden;"
        width="100%"
        height="100%"
        name="msg_body" marginheight="0">
        EMAIL BODY
       
         
       
        <div id='publicm8rguy'
        style="display:none;text-align:center;background-color:#fff;font-size:18px;padding-top: 40px;">
       
       
        [ This Inbox channel is currently Empty ]
       
       
       
       
         
       
          <li class="all_message-item all_message-item-parent cf"
          ng-repeat="email in emails" id="row_{{email.id}}"
           
          onclick="showTheMessage('{{email.id}}');">
           
         
          <div class="all_message-min-check-container"
          id='check_{{email.id}}'
          onclick="checkBox('{{email.id}}');if(event.stopPropagation){event.stopPropagation();}event.cancelBubble=true;">
          <i class="fa fa-check-square fa-lg" style="display:none;color#aaa;"
          id="checkon_{{email.id}}">
         
         
         
          {{email.to}}
         
         
        {{email.from}}
         
        {{email.subject}}
         
        {{email.humandate}}
         
         
         
         
           
         
         
           
         
         
           
         
           
         
         
         
           
         
         
         
          PRICING
         
         
         
         
          FAQ
         
         
         
         
          API DOCS
         
         
         
         
          BLOG
         
         
         
         
          Conditions and Privacy Policy
           
           
           
            [email protected]
         

         
         
         
         
           
           
         
           
           
           
         
         
           

        `

        kensoh commented 7 years ago

        Hi @thim81 thanks for reporting this! If there is no sensitive info, can you paste the section of the generated CasperJS .js code around the frame handling here?

        It sounds like the generated CasperJS code is likely to be ok, otherwise there will be runtime JS error. The name of the frame also exists in the HTML DOM.

        But somehow the interaction broke somewhere along TagUI-CasperJS-SlimerJS-Firefox. Also, if you run using default mode (PhantomJS) without firefox option, and run with chrome option to run through Chrome, does the same error of hanging there happen? This info can help to isolate where is the cause of the execution hanging.

        thim81 commented 7 years ago

        Here is the flow

        http://www.mailinator.com/v2/inbox.jsp?zone=public
        
        // = MOCKING ========================================================= //
        
        // Mocking data
        data_test = "hyper.koopa.bowser"; 
        
        // = Mailinator ================================================================= //
        wait 3.0
        
        click inbox_field
        enter inbox_field as '+data_test+'
        click #inbox_button
        
        // Show success
        wait 3.0
        
        // Click register mail
        test.assertSelectorHasText(tx('body'), 'Register','Check if mail is send properly to '+data_test+'');
        click Register
        wait 3.0
        
        // Click confirmation link
        // JS this.page.switchToChildFrame(0); // this works but the causes the blank popup behaviour
        frame msg_body
        
        click Confirm email address // causes blank popup
        wait 6.0
        
        kensoh commented 7 years ago

        Running the flow with default option works. The generated .js code for frame handling is below and looks ok.

        casper.wait(3000, function() {
        // Click confirmation link
        // JS this.page.switchToChildFrame(0); // this works but the causes the blank popup behaviour
        {techo('frame msg_body');
        casper.withFrame('msg_body', function() {
        {techo('click Confirm email address // causes blank popup');
        casper.waitFor(function check() {return check_tx('Confirm email address // causes blank popup');},
        function then() {this.click(tx('Confirm email address // causes blank popup'));},
        function timeout() {this.echo('ERROR - cannot find Confirm email address // causes blank popup').exit();});} });} });

        Below is the automation result. Note that the // comment after click Confirm email address should be removed as TagUI will literally take it as part of the text string to look out for -

        START - automation started - Tue Aug 01 2017 00:53:54 GMT+0800 (+08)
        http://www.mailinator.com/v2/inbox.jsp?zone=public - Mailinator
        
        wait 3.0
        click inbox_field
        enter inbox_field as hyper.koopa.bowser
        click #inbox_button
        wait 3.0
        click Register
        wait 3.0
        frame msg_body
        click Confirm email address
        wait 6.0
        
        http://www.mailinator.com/v2/inbox.jsp?zone=public#/#msgpane - Mailinator
        FINISH - automation finished - 24.9s

        Running with Firefox options works for me as well until the part where the popup appears. Running with chrome without test option also works. Looks like there is difference is execution behavior between your system and mine. I'm running on macOS v10.12.6 and Firefox v53.0.2 (64-bit).

        You haven't share your chrome or default mode result, and I assume when you say it just wait means hang without any error message. It should throw error after default 10s timeout, even if the click has the extra // comment behind, and not just wait there.

        thim81 commented 7 years ago

        Indeed it works properly.

        Must be something else in my flow that causes the stopping.